roe-typescript 1.1.1 → 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/README.md CHANGED
@@ -3,16 +3,15 @@
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.1** - SDK operation coverage is synchronized across Python,
6
+ > **v1.1.2** - SDK operation coverage is synchronized across Python,
7
7
  > TypeScript, and Go. See `SDK_EXAMPLES.md` for copy-ready examples and use
8
8
  > cases.
9
9
  <!-- ROE-SDK:RELEASE-BANNER:END -->
10
10
 
11
- > **v1.0.80** `RoeHTTPClient`/axios were replaced by the generated
12
- > `openapi-fetch` client exposed as `client.raw`; use `components["schemas"]`
13
- > (or inferred types from the wrappers) where you need response shapes from
14
- > the OpenAPI definitions. Highlights and migration notes across releases live
15
- > in **[CHANGELOG.md](CHANGELOG.md)**.
11
+ > **v1.0.80** - `RoeHTTPClient`/axios were replaced by an OpenAPI-backed
12
+ > transport behind stable public methods such as `client.agents` and
13
+ > `client.policies`. Highlights and migration notes across releases live in
14
+ > **[CHANGELOG.md](CHANGELOG.md)**.
16
15
 
17
16
  ## Installation
18
17
 
@@ -108,22 +107,6 @@ result carries `result.status === JobStatus.FAILURE` and
108
107
  `result.error_message`. Transport / HTTP errors hit the typed hierarchy
109
108
  above.
110
109
 
111
- ## Raw API Access
112
-
113
- The generated raw client is exposed as `client.raw`:
114
-
115
- ```typescript
116
- import { RoeClient } from "roe-typescript";
117
-
118
- const client = new RoeClient({
119
- apiKey: "your-api-key",
120
- organizationId: "your-org-uuid",
121
- });
122
-
123
- const response = await client.raw.GET("/v1/users/current_user/");
124
- console.log(response.response.status);
125
- ```
126
-
127
110
  <!-- ROE-SDK:GENERATED-FRIENDLY-APIS:START -->
128
111
  ## SDK Operation Groups
129
112
 
@@ -159,7 +142,7 @@ const agent = await client.agents.create({
159
142
  ],
160
143
  engineConfig: {
161
144
  url: "${url}",
162
- model: "gpt-4.1-2025-04-14",
145
+ model: "gpt-5.5-2026-04-23",
163
146
  instruction: "Extract company information from this website.",
164
147
  vision_mode: false,
165
148
  crawl_config: {
@@ -201,8 +184,15 @@ await client.agents.delete(agent.id);
201
184
  ```typescript
202
185
  client.agents.list() // List agents
203
186
  client.agents.retrieve("agent-uuid") // Get agent
204
- client.agents.create({ name, ... }) // Create agent
205
- client.agents.update("agent-uuid", { ... }) // Update agent
187
+ client.agents.create({
188
+ name: "Agent",
189
+ engineClassId: "ResearchEngine",
190
+ inputDefinitions: [],
191
+ engineConfig: {},
192
+ }) // Create agent
193
+ client.agents.update("agent-uuid", {
194
+ name: "New name",
195
+ }) // Update agent
206
196
  client.agents.delete("agent-uuid") // Delete agent
207
197
  client.agents.duplicate("agent-uuid") // Duplicate agent
208
198
  ```
@@ -226,8 +216,14 @@ client.agents.runVersion({ agentId, versionId, inputs })
226
216
  client.agents.versions.list(agentId)
227
217
  client.agents.versions.retrieve(agentId, versionId)
228
218
  client.agents.versions.retrieveCurrent(agentId)
229
- client.agents.versions.create({ agentId, ... })
230
- client.agents.versions.update(agentId, versionId, { ... })
219
+ client.agents.versions.create({
220
+ agentId,
221
+ inputDefinitions: [],
222
+ engineConfig: {},
223
+ })
224
+ client.agents.versions.update(agentId, versionId, {
225
+ versionName: "v2",
226
+ })
231
227
  client.agents.versions.delete(agentId, versionId)
232
228
  ```
233
229
 
@@ -245,8 +241,13 @@ client.agents.jobs.deleteData(jobId)
245
241
  ```typescript
246
242
  client.policies.list() // List policies
247
243
  client.policies.retrieve("policy-uuid") // Get policy
248
- client.policies.create({ name, content, ... }) // Create policy
249
- client.policies.update("policy-uuid", { ... }) // Update policy
244
+ client.policies.create({
245
+ name: "Policy",
246
+ content: {},
247
+ }) // Create policy
248
+ client.policies.update("policy-uuid", {
249
+ name: "New policy name",
250
+ }) // Update policy
250
251
  client.policies.delete("policy-uuid") // Delete policy
251
252
  ```
252
253
 
@@ -255,7 +256,11 @@ client.policies.delete("policy-uuid") // Delete policy
255
256
  ```typescript
256
257
  client.policies.versions.list(policyId)
257
258
  client.policies.versions.retrieve(policyId, versionId)
258
- client.policies.versions.create({ policyId, content, ... })
259
+ client.policies.versions.create({
260
+ policyId,
261
+ content: {},
262
+ versionName: "v2",
263
+ })
259
264
  ```
260
265
 
261
266
  ## Rori Agents (Agentic Workflows)
@@ -1,11 +1,20 @@
1
1
  import type { RoeConfig } from "../config.js";
2
2
  import type { RoeRawClient } from "../generated/client.js";
3
+ import { ConnectionsAPI } from "./connections.js";
4
+ import { ConnectorsAPI } from "./connectors.js";
3
5
  import { DiscoveryAPI } from "./discovery.js";
6
+ import { KnowledgeBaseAPI } from "./knowledge_base.js";
4
7
  import { TablesAPI } from "./tables.js";
8
+ export { ConnectionsAPI } from "./connections.js";
9
+ export { ConnectorsAPI } from "./connectors.js";
5
10
  export { DiscoveryAPI } from "./discovery.js";
11
+ export { KnowledgeBaseAPI } from "./knowledge_base.js";
6
12
  export { TablesAPI } from "./tables.js";
7
13
  export type GeneratedApis = {
14
+ readonly connections: ConnectionsAPI;
15
+ readonly connectors: ConnectorsAPI;
8
16
  readonly discovery: DiscoveryAPI;
17
+ readonly knowledge_base: KnowledgeBaseAPI;
9
18
  readonly tables: TablesAPI;
10
19
  };
11
20
  export declare function createGeneratedApis(config: RoeConfig, raw: RoeRawClient): GeneratedApis;
@@ -1,13 +1,22 @@
1
1
  // Auto-generated friendly API facades for the Roe SDK.
2
2
  // Generated by scripts/generate-sdk from openapi/wrappers.yml.
3
3
  // Do not edit by hand.
4
+ import { ConnectionsAPI } from "./connections.js";
5
+ import { ConnectorsAPI } from "./connectors.js";
4
6
  import { DiscoveryAPI } from "./discovery.js";
7
+ import { KnowledgeBaseAPI } from "./knowledge_base.js";
5
8
  import { TablesAPI } from "./tables.js";
9
+ export { ConnectionsAPI } from "./connections.js";
10
+ export { ConnectorsAPI } from "./connectors.js";
6
11
  export { DiscoveryAPI } from "./discovery.js";
12
+ export { KnowledgeBaseAPI } from "./knowledge_base.js";
7
13
  export { TablesAPI } from "./tables.js";
8
14
  export function createGeneratedApis(config, raw) {
9
15
  return {
16
+ connections: new ConnectionsAPI(config, raw),
17
+ connectors: new ConnectorsAPI(config, raw),
10
18
  discovery: new DiscoveryAPI(config, raw),
19
+ knowledge_base: new KnowledgeBaseAPI(config, raw),
11
20
  tables: new TablesAPI(config, raw),
12
21
  };
13
22
  }
@@ -9,7 +9,10 @@ type AgentJobStatus = components["schemas"]["AgentJobSingleStatus"];
9
9
  type AgentJobBatchStatus = components["schemas"]["AgentJobStatus"];
10
10
  type AgentJobResultItem = components["schemas"]["AgentJobResultItem"];
11
11
  type AgentJobDeleteDataResponse = components["schemas"]["AgentJobDeleteDataResponse"];
12
+ type AgentJobCancelAllResponse = components["schemas"]["AgentJobCancelAllResponse"];
13
+ type AgentJobArtifactResult = components["schemas"]["AgentJobArtifactResult"];
12
14
  type AgentDatum = components["schemas"]["AgentDatum"];
15
+ type MessageResponse = components["schemas"]["MessageResponse"];
13
16
  export declare class AgentVersionsAPI {
14
17
  private readonly agentsApi;
15
18
  constructor(agentsApi: AgentsAPI);
@@ -29,6 +32,10 @@ export declare class AgentVersionsAPI {
29
32
  versionName?: string;
30
33
  description?: string;
31
34
  }): Promise<void>;
35
+ replace(agentId: string, versionId: string, replacement: {
36
+ versionName?: string;
37
+ description?: string;
38
+ }): Promise<MessageResponse>;
32
39
  delete(agentId: string, versionId: string): Promise<void>;
33
40
  }
34
41
  export declare class AgentJobsAPI {
@@ -43,7 +50,8 @@ export declare class AgentJobsAPI {
43
50
  retrieveResultMany(jobIds: string[]): Promise<AgentJobResultItem[]>;
44
51
  downloadReference(jobId: string, resourceId: string, asAttachment?: boolean): Promise<Buffer>;
45
52
  cancel(jobId: string): Promise<void>;
46
- cancelAll(agentId: string): Promise<void>;
53
+ cancelAll(agentId: string): Promise<AgentJobCancelAllResponse>;
54
+ retrieveArtifact(jobId: string, artifactKey: string): Promise<AgentJobArtifactResult>;
47
55
  deleteData(jobId: string): Promise<AgentJobDeleteDataResponse>;
48
56
  private iterChunks;
49
57
  }
@@ -72,6 +80,11 @@ export declare class AgentsAPI {
72
80
  disableCache?: boolean;
73
81
  cacheFailedJobs?: boolean;
74
82
  }): Promise<BaseAgent>;
83
+ replace(agentId: string, replacement: {
84
+ name?: string;
85
+ disableCache?: boolean;
86
+ cacheFailedJobs?: boolean;
87
+ }): Promise<BaseAgent>;
75
88
  delete(agentId: string): Promise<void>;
76
89
  duplicate(agentId: string): Promise<AgentVersion>;
77
90
  run(params: {
@@ -92,6 +92,23 @@ export class AgentVersionsAPI {
92
92
  body,
93
93
  });
94
94
  }
95
+ async replace(agentId, versionId, replacement) {
96
+ validateUuid(agentId, "agentId");
97
+ validateUuid(versionId, "versionId");
98
+ const body = {};
99
+ if (replacement.versionName !== undefined)
100
+ body.version_name = replacement.versionName;
101
+ if (replacement.description !== undefined)
102
+ body.description = replacement.description;
103
+ const { data } = await this.raw.PUT("/v1/agents/{agent_id}/versions/{agent_version_id}/", {
104
+ params: {
105
+ path: { agent_id: agentId, agent_version_id: versionId },
106
+ query: { organization_id: this.organizationId },
107
+ },
108
+ body,
109
+ });
110
+ return data;
111
+ }
95
112
  async delete(agentId, versionId) {
96
113
  validateUuid(agentId, "agentId");
97
114
  validateUuid(versionId, "versionId");
@@ -197,12 +214,26 @@ export class AgentJobsAPI {
197
214
  }
198
215
  async cancelAll(agentId) {
199
216
  validateUuid(agentId, "agentId");
200
- await this.raw.POST("/v1/agents/{agent_id}/jobs/cancel-all/", {
217
+ const { data } = await this.raw.POST("/v1/agents/{agent_id}/jobs/cancel-all/", {
201
218
  params: {
202
219
  path: { agent_id: agentId },
203
220
  query: { organization_id: this.organizationId },
204
221
  },
205
222
  });
223
+ return data;
224
+ }
225
+ async retrieveArtifact(jobId, artifactKey) {
226
+ validateUuid(jobId, "jobId");
227
+ const { data } = await this.raw.GET("/v1/agents/jobs/{agent_job_id}/artifacts/result/", {
228
+ params: {
229
+ path: { agent_job_id: jobId },
230
+ query: {
231
+ organization_id: this.organizationId,
232
+ artifact_key: artifactKey,
233
+ },
234
+ },
235
+ });
236
+ return data;
206
237
  }
207
238
  async deleteData(jobId) {
208
239
  validateUuid(jobId, "jobId");
@@ -286,6 +317,24 @@ export class AgentsAPI {
286
317
  });
287
318
  return data;
288
319
  }
320
+ async replace(agentId, replacement) {
321
+ validateUuid(agentId, "agentId");
322
+ const body = {};
323
+ if (replacement.name !== undefined)
324
+ body.name = replacement.name;
325
+ if (replacement.disableCache !== undefined)
326
+ body.disable_cache = replacement.disableCache;
327
+ if (replacement.cacheFailedJobs !== undefined)
328
+ body.cache_failed_jobs = replacement.cacheFailedJobs;
329
+ const { data } = await this.raw.PUT("/v1/agents/{agent_id}/", {
330
+ params: {
331
+ path: { agent_id: agentId },
332
+ query: { organization_id: this.config.organizationId },
333
+ },
334
+ body,
335
+ });
336
+ return data;
337
+ }
289
338
  async delete(agentId) {
290
339
  validateUuid(agentId, "agentId");
291
340
  await this.raw.DELETE("/v1/agents/{agent_id}/", {
@@ -0,0 +1,58 @@
1
+ import type { RoeConfig } from "../config.js";
2
+ import type { RoeRawClient } from "../generated/client.js";
3
+ import type { components } from "../generated/schema.js";
4
+ type Connection = components["schemas"]["Connection"];
5
+ type CreateConnectionRequest = components["schemas"]["CreateConnectionRequest"];
6
+ type PaginatedConnectionListList = components["schemas"]["PaginatedConnectionListList"];
7
+ type TestConnection = components["schemas"]["TestConnection"];
8
+ type TestConnectionCredentialsRequest = components["schemas"]["TestConnectionCredentialsRequest"];
9
+ export declare class ConnectionsAPI {
10
+ readonly config: RoeConfig;
11
+ readonly raw: RoeRawClient;
12
+ /** API for managing external data connections. */
13
+ constructor(config: RoeConfig, raw: RoeRawClient);
14
+ protected get rawClient(): RoeRawClient;
15
+ protected get organizationId(): string;
16
+ /** List connections. */
17
+ list(params?: {
18
+ connectorType?: string;
19
+ search?: string;
20
+ page?: number;
21
+ pageSize?: number;
22
+ }): Promise<PaginatedConnectionListList>;
23
+ /** Create a connection. */
24
+ create(params: {
25
+ connectorType: CreateConnectionRequest["connector_type"];
26
+ name: string;
27
+ config: Record<string, unknown>;
28
+ description?: string;
29
+ authConfig?: Record<string, unknown>;
30
+ }): Promise<Connection>;
31
+ /** Test connection credentials without saving a connection. */
32
+ testCredentials(params: {
33
+ connectorType: TestConnectionCredentialsRequest["connector_type"];
34
+ config: Record<string, unknown>;
35
+ authConfig?: Record<string, unknown>;
36
+ }): Promise<TestConnection>;
37
+ /** Retrieve a connection. */
38
+ retrieve(connectionId: string): Promise<Connection>;
39
+ /** Update mutable connection fields. */
40
+ update(connectionId: string, updates: {
41
+ name?: string;
42
+ description?: string;
43
+ config?: Record<string, unknown>;
44
+ authConfig?: Record<string, unknown>;
45
+ }): Promise<Connection>;
46
+ /** Replace a connection. */
47
+ replace(connectionId: string, replacement: {
48
+ name?: string;
49
+ description?: string;
50
+ config?: Record<string, unknown>;
51
+ authConfig?: Record<string, unknown>;
52
+ }): Promise<Connection>;
53
+ /** Delete a connection. */
54
+ delete(connectionId: string): Promise<void>;
55
+ /** Test a saved connection. */
56
+ test(connectionId: string): Promise<TestConnection>;
57
+ }
58
+ export {};
@@ -0,0 +1,139 @@
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.
4
+ export class ConnectionsAPI {
5
+ /** API for managing external data connections. */
6
+ constructor(config, raw) {
7
+ this.config = config;
8
+ this.raw = raw;
9
+ }
10
+ get rawClient() {
11
+ return this.raw;
12
+ }
13
+ get organizationId() {
14
+ return this.config.organizationId;
15
+ }
16
+ /** List connections. */
17
+ async list(params) {
18
+ const { data } = await this.rawClient.GET("/v1/connections/", {
19
+ params: {
20
+ query: {
21
+ organization_id: this.organizationId,
22
+ ...(params?.connectorType !== undefined
23
+ ? { connector_type: params?.connectorType }
24
+ : {}),
25
+ ...(params?.search !== undefined ? { search: params?.search } : {}),
26
+ ...(params?.page !== undefined ? { page: params?.page } : {}),
27
+ ...(params?.pageSize !== undefined
28
+ ? { page_size: params?.pageSize }
29
+ : {}),
30
+ },
31
+ },
32
+ });
33
+ return data;
34
+ }
35
+ /** Create a connection. */
36
+ async create(params) {
37
+ const body = {
38
+ connector_type: params.connectorType,
39
+ name: params.name,
40
+ config: params.config,
41
+ ...(params.description !== undefined
42
+ ? { description: params.description }
43
+ : {}),
44
+ ...(params.authConfig !== undefined
45
+ ? { auth_config: params.authConfig }
46
+ : {}),
47
+ };
48
+ const { data } = await this.rawClient.POST("/v1/connections/", {
49
+ params: { query: { organization_id: this.organizationId } },
50
+ body,
51
+ });
52
+ return data;
53
+ }
54
+ /** Test connection credentials without saving a connection. */
55
+ async testCredentials(params) {
56
+ const body = {
57
+ connector_type: params.connectorType,
58
+ config: params.config,
59
+ ...(params.authConfig !== undefined
60
+ ? { auth_config: params.authConfig }
61
+ : {}),
62
+ };
63
+ const { data } = await this.rawClient.POST("/v1/connections/test-credentials/", { body });
64
+ return data;
65
+ }
66
+ /** Retrieve a connection. */
67
+ async retrieve(connectionId) {
68
+ const { data } = await this.rawClient.GET("/v1/connections/{id}/", {
69
+ params: {
70
+ path: { id: connectionId },
71
+ query: { organization_id: this.organizationId },
72
+ },
73
+ });
74
+ return data;
75
+ }
76
+ /** Update mutable connection fields. */
77
+ async update(connectionId, updates) {
78
+ const body = {
79
+ ...(updates.name !== undefined ? { name: updates.name } : {}),
80
+ ...(updates.description !== undefined
81
+ ? { description: updates.description }
82
+ : {}),
83
+ ...(updates.config !== undefined ? { config: updates.config } : {}),
84
+ ...(updates.authConfig !== undefined
85
+ ? { auth_config: updates.authConfig }
86
+ : {}),
87
+ };
88
+ const { data } = await this.rawClient.PATCH("/v1/connections/{id}/", {
89
+ params: {
90
+ path: { id: connectionId },
91
+ query: { organization_id: this.organizationId },
92
+ },
93
+ body,
94
+ });
95
+ return data;
96
+ }
97
+ /** Replace a connection. */
98
+ async replace(connectionId, replacement) {
99
+ const body = {
100
+ ...(replacement.name !== undefined ? { name: replacement.name } : {}),
101
+ ...(replacement.description !== undefined
102
+ ? { description: replacement.description }
103
+ : {}),
104
+ ...(replacement.config !== undefined
105
+ ? { config: replacement.config }
106
+ : {}),
107
+ ...(replacement.authConfig !== undefined
108
+ ? { auth_config: replacement.authConfig }
109
+ : {}),
110
+ };
111
+ const { data } = await this.rawClient.PUT("/v1/connections/{id}/", {
112
+ params: {
113
+ path: { id: connectionId },
114
+ query: { organization_id: this.organizationId },
115
+ },
116
+ body,
117
+ });
118
+ return data;
119
+ }
120
+ /** Delete a connection. */
121
+ async delete(connectionId) {
122
+ await this.rawClient.DELETE("/v1/connections/{id}/", {
123
+ params: {
124
+ path: { id: connectionId },
125
+ query: { organization_id: this.organizationId },
126
+ },
127
+ });
128
+ }
129
+ /** Test a saved connection. */
130
+ async test(connectionId) {
131
+ const { data } = await this.rawClient.POST("/v1/connections/{id}/test/", {
132
+ params: {
133
+ path: { id: connectionId },
134
+ query: { organization_id: this.organizationId },
135
+ },
136
+ });
137
+ return data;
138
+ }
139
+ }
@@ -0,0 +1,18 @@
1
+ import type { RoeConfig } from "../config.js";
2
+ import type { RoeRawClient } from "../generated/client.js";
3
+ import type { components } from "../generated/schema.js";
4
+ type ConnectorListResponse = components["schemas"]["ConnectorListResponse"];
5
+ type ConnectorMetadata = components["schemas"]["ConnectorMetadata"];
6
+ export declare class ConnectorsAPI {
7
+ readonly config: RoeConfig;
8
+ readonly raw: RoeRawClient;
9
+ /** API for discovering available connector types. */
10
+ constructor(config: RoeConfig, raw: RoeRawClient);
11
+ protected get rawClient(): RoeRawClient;
12
+ protected get organizationId(): string;
13
+ /** List available connector types. */
14
+ list(): Promise<ConnectorListResponse>;
15
+ /** Retrieve metadata for a connector type. */
16
+ retrieve(connectorType: string): Promise<ConnectorMetadata>;
17
+ }
18
+ export {};
@@ -0,0 +1,26 @@
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.
4
+ export class ConnectorsAPI {
5
+ /** API for discovering available connector types. */
6
+ constructor(config, raw) {
7
+ this.config = config;
8
+ this.raw = raw;
9
+ }
10
+ get rawClient() {
11
+ return this.raw;
12
+ }
13
+ get organizationId() {
14
+ return this.config.organizationId;
15
+ }
16
+ /** List available connector types. */
17
+ async list() {
18
+ const { data } = await this.rawClient.GET("/v1/connectors/", {});
19
+ return data;
20
+ }
21
+ /** Retrieve metadata for a connector type. */
22
+ async retrieve(connectorType) {
23
+ const { data } = await this.rawClient.GET("/v1/connectors/{connector_type}/", { params: { path: { connector_type: connectorType } } });
24
+ return data;
25
+ }
26
+ }
@@ -0,0 +1,67 @@
1
+ import type { RoeConfig } from "../config.js";
2
+ import type { RoeRawClient } from "../generated/client.js";
3
+ import type { components } from "../generated/schema.js";
4
+ type CreateKnowledgeBase = components["schemas"]["CreateKnowledgeBase"];
5
+ type Draft = components["schemas"]["Draft"];
6
+ type KnowledgeBase = components["schemas"]["KnowledgeBase"];
7
+ type PaginatedKnowledgeBaseList = components["schemas"]["PaginatedKnowledgeBaseList"];
8
+ export declare class KnowledgeBaseAPI {
9
+ readonly config: RoeConfig;
10
+ readonly raw: RoeRawClient;
11
+ /** API for managing Knowledge Base lenses and drafts. */
12
+ constructor(config: RoeConfig, raw: RoeRawClient);
13
+ protected get rawClient(): RoeRawClient;
14
+ protected get organizationId(): string;
15
+ /** List all knowledge bases for the organisation. */
16
+ list(params?: {
17
+ page?: number;
18
+ pageSize?: number;
19
+ }): Promise<PaginatedKnowledgeBaseList>;
20
+ /** Create a new knowledge base draft (async generation). */
21
+ create(params: {
22
+ company: string;
23
+ brief: string;
24
+ name?: string;
25
+ productName?: string;
26
+ websiteUrl?: string;
27
+ }): Promise<CreateKnowledgeBase>;
28
+ /** Retrieve a single knowledge base record. */
29
+ retrieve(knowledgeBaseId: string): Promise<KnowledgeBase>;
30
+ /** Delete a knowledge base and its associated Atlas draft or lens. */
31
+ delete(knowledgeBaseId: string): Promise<void>;
32
+ /** Unlink a knowledge base locally, preserving the Atlas lens. */
33
+ unlink(knowledgeBaseId: string): Promise<void>;
34
+ /** Poll the Atlas draft status until ready or error. */
35
+ pollDraft(knowledgeBaseId: string): Promise<Draft>;
36
+ /** Patch the draft's typology/tactic selection. */
37
+ patchSelection(knowledgeBaseId: string, selection: {
38
+ refs: Record<string, unknown>[];
39
+ suggestedName?: string;
40
+ }): Promise<Draft>;
41
+ /** Kick off an async regeneration round with optional feedback. */
42
+ regenerate(knowledgeBaseId: string, params?: {
43
+ feedback?: string;
44
+ }): Promise<Draft>;
45
+ /** Approve or decline a pending regeneration proposal. */
46
+ resolve(knowledgeBaseId: string, params?: {
47
+ refs?: Record<string, unknown>[];
48
+ suggestedName?: string;
49
+ acceptSummary?: boolean;
50
+ discard?: boolean;
51
+ }): Promise<Draft>;
52
+ /** Commit the draft into a permanent Atlas lens. */
53
+ finalize(knowledgeBaseId: string, params?: {
54
+ name?: string;
55
+ mcpEnabled?: boolean;
56
+ public?: boolean;
57
+ }): Promise<KnowledgeBase>;
58
+ /** Sync the lens snapshot from Atlas (best-effort). */
59
+ sync(knowledgeBaseId: string): Promise<KnowledgeBase>;
60
+ /** Fetch the names-only typology and tactic catalog. */
61
+ catalog(): Promise<unknown>;
62
+ /** Fetch and optionally sync a lens by its Atlas ID. */
63
+ lensByAtlasId(atlasLensId: string): Promise<unknown>;
64
+ /** Import a finalized Atlas lens into roe-main by its atlas_lens_id. */
65
+ importLens(atlasLensId: string): Promise<KnowledgeBase>;
66
+ }
67
+ export {};
@@ -0,0 +1,202 @@
1
+ import { BadRequestError } from "../exceptions.js";
2
+ import { isUuidString } from "../utils/fileDetection.js";
3
+ function validateUuid(value, fieldName) {
4
+ if (!isUuidString(value)) {
5
+ throw new BadRequestError(`Invalid ${fieldName}: "${value}" is not a valid UUID`, 400);
6
+ }
7
+ }
8
+ export class KnowledgeBaseAPI {
9
+ /** API for managing Knowledge Base lenses and drafts. */
10
+ constructor(config, raw) {
11
+ this.config = config;
12
+ this.raw = raw;
13
+ }
14
+ get rawClient() {
15
+ return this.raw;
16
+ }
17
+ get organizationId() {
18
+ return this.config.organizationId;
19
+ }
20
+ /** List all knowledge bases for the organisation. */
21
+ async list(params) {
22
+ const { data } = await this.rawClient.GET("/v1/knowledge-base/", {
23
+ params: {
24
+ query: {
25
+ organization_id: this.organizationId,
26
+ ...(params?.page !== undefined ? { page: params.page } : {}),
27
+ ...(params?.pageSize !== undefined
28
+ ? { page_size: params.pageSize }
29
+ : {}),
30
+ },
31
+ },
32
+ });
33
+ return data;
34
+ }
35
+ /** Create a new knowledge base draft (async generation). */
36
+ async create(params) {
37
+ const body = {
38
+ company: params.company,
39
+ brief: params.brief,
40
+ ...(params.name !== undefined ? { name: params.name } : {}),
41
+ ...(params.productName !== undefined
42
+ ? { product_name: params.productName }
43
+ : {}),
44
+ ...(params.websiteUrl !== undefined
45
+ ? { website_url: params.websiteUrl }
46
+ : {}),
47
+ };
48
+ const { data } = await this.rawClient.POST("/v1/knowledge-base/", {
49
+ params: { query: { organization_id: this.organizationId } },
50
+ body,
51
+ });
52
+ return data;
53
+ }
54
+ /** Retrieve a single knowledge base record. */
55
+ async retrieve(knowledgeBaseId) {
56
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
57
+ const { data } = await this.rawClient.GET("/v1/knowledge-base/{id}/", {
58
+ params: {
59
+ path: { id: knowledgeBaseId },
60
+ query: { organization_id: this.organizationId },
61
+ },
62
+ });
63
+ return data;
64
+ }
65
+ /** Delete a knowledge base and its associated Atlas draft or lens. */
66
+ async delete(knowledgeBaseId) {
67
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
68
+ await this.rawClient.DELETE("/v1/knowledge-base/{id}/", {
69
+ params: {
70
+ path: { id: knowledgeBaseId },
71
+ query: { organization_id: this.organizationId },
72
+ },
73
+ });
74
+ }
75
+ /** Unlink a knowledge base locally, preserving the Atlas lens. */
76
+ async unlink(knowledgeBaseId) {
77
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
78
+ await this.rawClient.DELETE("/v1/knowledge-base/{id}/unlink/", {
79
+ params: {
80
+ path: { id: knowledgeBaseId },
81
+ query: { organization_id: this.organizationId },
82
+ },
83
+ });
84
+ }
85
+ /** Poll the Atlas draft status until ready or error. */
86
+ async pollDraft(knowledgeBaseId) {
87
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
88
+ const { data } = await this.rawClient.GET("/v1/knowledge-base/{id}/draft/", {
89
+ params: {
90
+ path: { id: knowledgeBaseId },
91
+ query: { organization_id: this.organizationId },
92
+ },
93
+ });
94
+ return data;
95
+ }
96
+ /** Patch the draft's typology/tactic selection. */
97
+ async patchSelection(knowledgeBaseId, selection) {
98
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
99
+ const body = {
100
+ refs: selection.refs,
101
+ ...(selection.suggestedName !== undefined
102
+ ? { suggested_name: selection.suggestedName }
103
+ : {}),
104
+ };
105
+ const { data } = await this.rawClient.PATCH("/v1/knowledge-base/{id}/selection/", {
106
+ params: {
107
+ path: { id: knowledgeBaseId },
108
+ query: { organization_id: this.organizationId },
109
+ },
110
+ body,
111
+ });
112
+ return data;
113
+ }
114
+ /** Kick off an async regeneration round with optional feedback. */
115
+ async regenerate(knowledgeBaseId, params) {
116
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
117
+ const body = {
118
+ ...(params?.feedback !== undefined ? { feedback: params.feedback } : {}),
119
+ };
120
+ const { data } = await this.rawClient.POST("/v1/knowledge-base/{id}/regenerate/", {
121
+ params: {
122
+ path: { id: knowledgeBaseId },
123
+ query: { organization_id: this.organizationId },
124
+ },
125
+ body,
126
+ });
127
+ return data;
128
+ }
129
+ /** Approve or decline a pending regeneration proposal. */
130
+ async resolve(knowledgeBaseId, params) {
131
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
132
+ const body = {
133
+ accept_summary: params?.acceptSummary ?? false,
134
+ discard: params?.discard ?? false,
135
+ ...(params?.refs !== undefined ? { refs: params.refs } : {}),
136
+ ...(params?.suggestedName !== undefined
137
+ ? { suggested_name: params.suggestedName }
138
+ : {}),
139
+ };
140
+ const { data } = await this.rawClient.POST("/v1/knowledge-base/{id}/resolve/", {
141
+ params: {
142
+ path: { id: knowledgeBaseId },
143
+ query: { organization_id: this.organizationId },
144
+ },
145
+ body,
146
+ });
147
+ return data;
148
+ }
149
+ /** Commit the draft into a permanent Atlas lens. */
150
+ async finalize(knowledgeBaseId, params) {
151
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
152
+ const body = {
153
+ mcp_enabled: params?.mcpEnabled ?? true,
154
+ public: params?.public ?? true,
155
+ ...(params?.name !== undefined ? { name: params.name } : {}),
156
+ };
157
+ const { data } = await this.rawClient.POST("/v1/knowledge-base/{id}/finalize/", {
158
+ params: {
159
+ path: { id: knowledgeBaseId },
160
+ query: { organization_id: this.organizationId },
161
+ },
162
+ body,
163
+ });
164
+ return data;
165
+ }
166
+ /** Sync the lens snapshot from Atlas (best-effort). */
167
+ async sync(knowledgeBaseId) {
168
+ validateUuid(knowledgeBaseId, "knowledgeBaseId");
169
+ const { data } = await this.rawClient.POST("/v1/knowledge-base/{id}/sync/", {
170
+ params: {
171
+ path: { id: knowledgeBaseId },
172
+ query: { organization_id: this.organizationId },
173
+ },
174
+ });
175
+ return data;
176
+ }
177
+ /** Fetch the names-only typology and tactic catalog. */
178
+ async catalog() {
179
+ const { data } = await this.rawClient.GET("/v1/knowledge-base/catalog/", {
180
+ params: { query: { organization_id: this.organizationId } },
181
+ });
182
+ return data;
183
+ }
184
+ /** Fetch and optionally sync a lens by its Atlas ID. */
185
+ async lensByAtlasId(atlasLensId) {
186
+ const { data } = await this.rawClient.GET("/v1/knowledge-base/lens/{atlas_lens_id}/", {
187
+ params: {
188
+ path: { atlas_lens_id: atlasLensId },
189
+ query: { organization_id: this.organizationId },
190
+ },
191
+ });
192
+ return data;
193
+ }
194
+ /** Import a finalized Atlas lens into roe-main by its atlas_lens_id. */
195
+ async importLens(atlasLensId) {
196
+ const { data } = await this.rawClient.POST("/v1/knowledge-base/import-lens/", {
197
+ params: { query: { organization_id: this.organizationId } },
198
+ body: { atlas_lens_id: atlasLensId },
199
+ });
200
+ return data;
201
+ }
202
+ }
@@ -51,6 +51,11 @@ export declare class PoliciesAPI {
51
51
  name?: string;
52
52
  description?: string;
53
53
  }): Promise<UpdatePolicy>;
54
+ /** Replace a policy. */
55
+ replace(policyId: string, replacement: {
56
+ name: string;
57
+ description?: string;
58
+ }): Promise<UpdatePolicy>;
54
59
  /** Delete a policy. */
55
60
  delete(policyId: string): Promise<void>;
56
61
  }
@@ -139,6 +139,24 @@ export class PoliciesAPI {
139
139
  });
140
140
  return data;
141
141
  }
142
+ /** Replace a policy. */
143
+ async replace(policyId, replacement) {
144
+ validateUuid(policyId, "policyId");
145
+ const body = {
146
+ name: replacement.name,
147
+ ...(replacement.description !== undefined
148
+ ? { description: replacement.description }
149
+ : {}),
150
+ };
151
+ const { data } = await this.rawClient.PUT("/v1/policies/{id}/", {
152
+ params: {
153
+ path: { id: policyId },
154
+ query: { organization_id: this.organizationId },
155
+ },
156
+ body,
157
+ });
158
+ return data;
159
+ }
142
160
  /** Delete a policy. */
143
161
  async delete(policyId) {
144
162
  validateUuid(policyId, "policyId");
@@ -2,6 +2,11 @@ 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
4
  import type { FileUpload } from "../models/file.js";
5
+ type TableDescribeResponse = components["schemas"]["TableDescribeResponse"];
6
+ type TableListResponse = components["schemas"]["TableListResponse"];
7
+ type TablePreviewResponse = components["schemas"]["TablePreviewResponse"];
8
+ type TableQueryResultResponse = components["schemas"]["TableQueryResultResponse"];
9
+ type TableQuerySubmitResponse = components["schemas"]["TableQuerySubmitResponse"];
5
10
  type TableUploadResponse = components["schemas"]["TableUploadResponse"];
6
11
  export type TableUploadFile = string | NodeJS.ReadableStream | FileUpload;
7
12
  export type TableUploadParams = {
@@ -13,11 +18,28 @@ export type TableUploadParams = {
13
18
  export declare class TablesAPI {
14
19
  readonly config: RoeConfig;
15
20
  readonly raw: RoeRawClient;
16
- /** API for uploading CSV files into Roe tables. */
21
+ /** API for managing Roe tables. */
17
22
  constructor(config: RoeConfig, raw: RoeRawClient);
18
23
  protected get rawClient(): RoeRawClient;
19
24
  protected get organizationId(): string;
25
+ /** List Roe tables. */
26
+ list(): Promise<TableListResponse>;
20
27
  /** Upload a CSV file and create a Roe table. */
21
28
  upload(params: TableUploadParams): Promise<TableUploadResponse>;
29
+ /** Run a read-only query against Roe tables. */
30
+ query(params: {
31
+ sql: string;
32
+ limit?: number;
33
+ }): Promise<TableQuerySubmitResponse>;
34
+ /** Get the result for a submitted table query. */
35
+ queryResult(tableQueryId: string): Promise<TableQueryResultResponse>;
36
+ /** Describe a Roe table. */
37
+ describe(tableName: string): Promise<TableDescribeResponse>;
38
+ /** Preview rows from a Roe table. */
39
+ preview(tableName: string, options?: {
40
+ limit?: number;
41
+ }): Promise<TablePreviewResponse>;
42
+ /** Delete a Roe table. */
43
+ delete(tableName: string): Promise<void>;
22
44
  }
23
45
  export {};
@@ -4,7 +4,7 @@
4
4
  import { RoeAPIException } from "../exceptions.js";
5
5
  import { postDynamicInputs } from "../utils/dynamicInputs.js";
6
6
  export class TablesAPI {
7
- /** API for uploading CSV files into Roe tables. */
7
+ /** API for managing Roe tables. */
8
8
  constructor(config, raw) {
9
9
  this.config = config;
10
10
  this.raw = raw;
@@ -15,6 +15,11 @@ export class TablesAPI {
15
15
  get organizationId() {
16
16
  return this.config.organizationId;
17
17
  }
18
+ /** List Roe tables. */
19
+ async list() {
20
+ const { data } = await this.rawClient.GET("/v1/tables/", {});
21
+ return data;
22
+ }
18
23
  /** Upload a CSV file and create a Roe table. */
19
24
  async upload(params) {
20
25
  const inputs = {
@@ -29,4 +34,41 @@ export class TablesAPI {
29
34
  }
30
35
  return data;
31
36
  }
37
+ /** Run a read-only query against Roe tables. */
38
+ async query(params) {
39
+ const body = {
40
+ sql: params.sql,
41
+ limit: params.limit ?? 1000,
42
+ };
43
+ const { data } = await this.rawClient.POST("/v1/tables/query/", { body });
44
+ return data;
45
+ }
46
+ /** Get the result for a submitted table query. */
47
+ async queryResult(tableQueryId) {
48
+ const { data } = await this.rawClient.GET("/v1/tables/query/{table_query_id}/result/", { params: { path: { table_query_id: tableQueryId } } });
49
+ return data;
50
+ }
51
+ /** Describe a Roe table. */
52
+ async describe(tableName) {
53
+ const { data } = await this.rawClient.GET("/v1/tables/{table_name}/describe/", { params: { path: { table_name: tableName } } });
54
+ return data;
55
+ }
56
+ /** Preview rows from a Roe table. */
57
+ async preview(tableName, options) {
58
+ const { data } = await this.rawClient.GET("/v1/tables/{table_name}/preview/", {
59
+ params: {
60
+ path: { table_name: tableName },
61
+ query: {
62
+ ...(options?.limit !== undefined ? { limit: options?.limit } : {}),
63
+ },
64
+ },
65
+ });
66
+ return data;
67
+ }
68
+ /** Delete a Roe table. */
69
+ async delete(tableName) {
70
+ await this.rawClient.DELETE("/v1/tables/{table_name}/", {
71
+ params: { path: { table_name: tableName } },
72
+ });
73
+ }
32
74
  }
package/dist/index.js CHANGED
@@ -12,5 +12,5 @@ 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"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roe-typescript",
3
- "version": "1.1.1",
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",