roe-typescript 0.1.3 → 1.0.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.
package/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  TypeScript/Node SDK for the [Roe AI](https://www.roe-ai.com/) API.
4
4
 
5
+ > **v1.0.0** — `RoeHTTPClient`/axios were replaced by the generated
6
+ > `openapi-fetch` client exposed as `client.raw`; use `components["schemas"]`
7
+ > (or inferred types from the wrappers) where you need response shapes from
8
+ > the OpenAPI definitions. Highlights and migration notes across releases live
9
+ > in **[CHANGELOG.md](CHANGELOG.md)**.
10
+
5
11
  ## Installation
6
12
 
7
13
  ```bash
@@ -39,27 +45,43 @@ export ROE_ORGANIZATION_ID="your-org-uuid"
39
45
 
40
46
  ## Job Result Inspection
41
47
 
42
- After waiting for a job, you can inspect its outcome using status helpers:
48
+ After waiting for a job, you can inspect its outcome using the `JobStatus` enum:
43
49
 
44
50
  ```typescript
45
- import { isJobSuccess, isJobFailure, isJobCancelled } from "roe-typescript";
51
+ import { JobStatus } from "roe-typescript";
46
52
 
47
53
  const result = await job.wait();
48
54
 
49
- if (isJobSuccess(result)) {
55
+ if (result.status === JobStatus.SUCCESS || result.status === JobStatus.CACHED) {
50
56
  for (const output of result.outputs) {
51
57
  console.log(`${output.key}: ${output.value}`);
52
58
  }
53
- } else if (isJobCancelled(result)) {
59
+ } else if (result.status === JobStatus.CANCELLED) {
54
60
  console.log("Job was cancelled");
55
- } else if (isJobFailure(result)) {
61
+ } else if (result.status === JobStatus.FAILURE) {
56
62
  console.log("Error:", result.error_message);
57
63
  }
58
64
 
59
65
  // Available fields
60
- result.status // JobStatus enum value or null
66
+ result.status // JobStatus enum value (PENDING, STARTED, RETRY, SUCCESS, FAILURE, CANCELLED, CACHED) or null
61
67
  result.error_message // Error string or null
62
- result.outputs // AgentDatum[]
68
+ result.outputs // AgentDatum[] from components["schemas"]["AgentDatum"]
69
+ ```
70
+
71
+ ## Raw API Access
72
+
73
+ The generated raw client is exposed as `client.raw`:
74
+
75
+ ```typescript
76
+ import { RoeClient } from "roe-typescript";
77
+
78
+ const client = new RoeClient({
79
+ apiKey: "your-api-key",
80
+ organizationId: "your-org-uuid",
81
+ });
82
+
83
+ const response = await client.raw.GET("/v1/users/current_user/");
84
+ console.log(response.response.status);
63
85
  ```
64
86
 
65
87
  ## Full Example
@@ -111,13 +133,6 @@ for (const output of result.outputs) {
111
133
  console.log(JSON.stringify(JSON.parse(output.value), null, 2));
112
134
  }
113
135
 
114
- // Download saved references (screenshots, HTML, markdown)
115
- import { getJobReferences } from "roe-typescript";
116
- for (const ref of getJobReferences(result)) {
117
- const content = await client.agents.jobs.downloadReference(job.id, ref.resource_id);
118
- // Save content as needed
119
- }
120
-
121
136
  // Cleanup
122
137
  await client.agents.delete(agent.id);
123
138
  ```
@@ -457,3 +472,4 @@ const agent = await client.agents.create({
457
472
 
458
473
  - [Roe AI](https://www.roe-ai.com/)
459
474
  - [API Docs](https://docs.roe-ai.com)
475
+ - [Changelog](CHANGELOG.md)
@@ -1,72 +1,78 @@
1
- import { RoeConfig } from "../config.js";
2
- import { RoeHTTPClient } from "../utils/httpClient.js";
3
- import { AgentJobResult, AgentJobResultBatch, AgentJobStatus, AgentJobStatusBatch, AgentDatum, PaginatedResponse, JobDataDeleteResponse } from "../models/responses.js";
4
- import { AgentInputDefinition, AgentVersionWithApi, BaseAgentWithApi } from "../models/agent.js";
1
+ import type { RoeConfig } from "../config.js";
2
+ import type { RoeRawClient } from "../generated/client.js";
3
+ import type { components } from "../generated/schema.js";
5
4
  import { Job, JobBatch } from "../models/job.js";
5
+ type BaseAgent = components["schemas"]["BaseAgent"];
6
+ type PaginatedBaseAgentList = components["schemas"]["PaginatedBaseAgentList"];
7
+ type AgentVersion = components["schemas"]["AgentVersion"];
8
+ type AgentJobStatus = components["schemas"]["AgentJobStatus"];
9
+ type AgentJobResultItem = components["schemas"]["AgentJobResultItem"];
10
+ type AgentJobDeleteDataResponse = components["schemas"]["AgentJobDeleteDataResponse"];
11
+ type AgentDatum = components["schemas"]["AgentDatum"];
6
12
  export declare class AgentVersionsAPI {
7
13
  private readonly agentsApi;
8
14
  constructor(agentsApi: AgentsAPI);
9
- private get http();
10
- list(agentId: string): Promise<AgentVersionWithApi[]>;
11
- retrieve(agentId: string, versionId: string, getSupportsEval?: boolean): Promise<AgentVersionWithApi>;
12
- retrieveCurrent(agentId: string): Promise<AgentVersionWithApi>;
15
+ private get raw();
16
+ private get organizationId();
17
+ list(agentId: string): Promise<AgentVersion[]>;
18
+ retrieve(agentId: string, versionId: string, getSupportsEval?: boolean): Promise<AgentVersion>;
19
+ retrieveCurrent(agentId: string): Promise<AgentVersion>;
13
20
  create(params: {
14
21
  agentId: string;
15
- inputDefinitions?: AgentInputDefinition[];
22
+ inputDefinitions?: Array<Record<string, unknown>>;
16
23
  engineConfig?: Record<string, unknown>;
17
24
  versionName?: string;
18
25
  description?: string;
19
- }): Promise<AgentVersionWithApi>;
26
+ }): Promise<AgentVersion>;
20
27
  update(agentId: string, versionId: string, updates: {
21
28
  versionName?: string;
22
29
  description?: string;
23
30
  }): Promise<void>;
24
31
  delete(agentId: string, versionId: string): Promise<void>;
25
- private wrap;
26
32
  }
27
33
  export declare class AgentJobsAPI {
28
34
  private readonly agentsApi;
29
35
  private static MAX_BATCH_SIZE;
30
36
  constructor(agentsApi: AgentsAPI);
31
- private get http();
37
+ private get raw();
38
+ private get organizationId();
32
39
  retrieveStatus(jobId: string): Promise<AgentJobStatus>;
33
- retrieveResult(jobId: string): Promise<AgentJobResult>;
34
- retrieveStatusMany(jobIds: string[]): Promise<AgentJobStatusBatch[]>;
35
- retrieveResultMany(jobIds: string[]): Promise<AgentJobResultBatch[]>;
40
+ retrieveResult(jobId: string): Promise<components["schemas"]["AgentJobResultResponse"]>;
41
+ retrieveStatusMany(jobIds: string[]): Promise<AgentJobStatus[]>;
42
+ retrieveResultMany(jobIds: string[]): Promise<AgentJobResultItem[]>;
36
43
  downloadReference(jobId: string, resourceId: string, asAttachment?: boolean): Promise<Buffer>;
37
44
  cancel(jobId: string): Promise<void>;
38
45
  cancelAll(agentId: string): Promise<void>;
39
- deleteData(jobId: string): Promise<JobDataDeleteResponse>;
46
+ deleteData(jobId: string): Promise<AgentJobDeleteDataResponse>;
40
47
  private iterChunks;
41
48
  }
42
49
  export declare class AgentsAPI {
43
50
  readonly config: RoeConfig;
44
- readonly httpClient: RoeHTTPClient;
51
+ readonly raw: RoeRawClient;
45
52
  private static MAX_BATCH_SIZE;
46
53
  readonly versions: AgentVersionsAPI;
47
54
  readonly jobs: AgentJobsAPI;
48
- constructor(config: RoeConfig, httpClient: RoeHTTPClient);
49
- private wrapBase;
55
+ constructor(config: RoeConfig, raw: RoeRawClient);
50
56
  list(params?: {
51
57
  page?: number;
52
58
  pageSize?: number;
53
- }): Promise<PaginatedResponse<BaseAgentWithApi>>;
54
- retrieve(agentId: string): Promise<BaseAgentWithApi>;
59
+ }): Promise<PaginatedBaseAgentList>;
60
+ retrieve(agentId: string): Promise<BaseAgent>;
55
61
  create(params: {
56
62
  name: string;
57
63
  engineClassId: string;
58
- inputDefinitions?: AgentInputDefinition[];
64
+ inputDefinitions?: Array<Record<string, unknown>>;
59
65
  engineConfig?: Record<string, unknown>;
60
66
  versionName?: string;
61
67
  description?: string;
62
- }): Promise<BaseAgentWithApi>;
68
+ }): Promise<BaseAgent>;
63
69
  update(agentId: string, updates: {
64
70
  name?: string;
65
71
  disableCache?: boolean;
66
72
  cacheFailedJobs?: boolean;
67
- }): Promise<BaseAgentWithApi>;
73
+ }): Promise<BaseAgent>;
68
74
  delete(agentId: string): Promise<void>;
69
- duplicate(agentId: string): Promise<BaseAgentWithApi>;
75
+ duplicate(agentId: string): Promise<AgentVersion>;
70
76
  run(params: {
71
77
  agentId: string;
72
78
  inputs: Record<string, unknown>;
@@ -88,5 +94,7 @@ export declare class AgentsAPI {
88
94
  metadata?: Record<string, unknown>;
89
95
  }): Promise<Job>;
90
96
  runVersionSync(agentId: string, versionId: string, inputs: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<AgentDatum[]>;
97
+ private extractJobId;
91
98
  private iterChunks;
92
99
  }
100
+ export {};