@agent-os-sdk/client 0.3.12 → 0.3.15
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/AgentOsClient.d.ts +8 -0
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +14 -5
- package/dist/modules/agents.d.ts +92 -11
- package/dist/modules/agents.d.ts.map +1 -1
- package/dist/modules/agents.js +59 -13
- package/dist/modules/apiTokens.d.ts +51 -0
- package/dist/modules/apiTokens.d.ts.map +1 -0
- package/dist/modules/apiTokens.js +48 -0
- package/dist/modules/catalog.d.ts +28 -4
- package/dist/modules/catalog.d.ts.map +1 -1
- package/dist/modules/catalog.js +15 -1
- package/dist/modules/memberships.d.ts +25 -0
- package/dist/modules/memberships.d.ts.map +1 -0
- package/dist/modules/memberships.js +20 -0
- package/dist/modules/workspaces.d.ts +52 -0
- package/dist/modules/workspaces.d.ts.map +1 -1
- package/dist/modules/workspaces.js +18 -0
- package/package.json +2 -2
- package/src/client/AgentOsClient.ts +21 -7
- package/src/modules/agents.ts +136 -18
- package/src/modules/apiTokens.ts +83 -0
- package/src/modules/catalog.ts +38 -5
- package/src/modules/memberships.ts +42 -0
- package/src/modules/workspaces.ts +61 -0
|
@@ -59,6 +59,8 @@ import { MetricsModule } from "../modules/metrics.js";
|
|
|
59
59
|
import { GraphsModule } from "../modules/graphs.js";
|
|
60
60
|
import { CatalogModule } from "../modules/catalog.js";
|
|
61
61
|
import { ApprovalsModule } from "../modules/approvals.js";
|
|
62
|
+
import { ApiTokensModule } from "../modules/apiTokens.js";
|
|
63
|
+
import { MembershipsModule } from "../modules/memberships.js";
|
|
62
64
|
export type { AgentOsClientOptions, AuthProvider } from "./auth.js";
|
|
63
65
|
export { isApiTokenAuth, isJwtAuth } from "./auth.js";
|
|
64
66
|
export declare class AgentOsClient {
|
|
@@ -102,10 +104,16 @@ export declare class AgentOsClient {
|
|
|
102
104
|
get: EvaluationModule["getExperiment"];
|
|
103
105
|
create: EvaluationModule["createExperiment"];
|
|
104
106
|
};
|
|
107
|
+
readonly apiTokens: ApiTokensModule;
|
|
108
|
+
readonly memberships: MembershipsModule;
|
|
105
109
|
readonly agentVersions: {
|
|
106
110
|
list: (agentId: string) => ReturnType<AgentsModule["listVersions"]>;
|
|
107
111
|
get: (agentId: string, versionId: string) => ReturnType<AgentsModule["getVersion"]>;
|
|
108
112
|
create: (agentId: string, body: Parameters<AgentsModule["createVersion"]>[1]) => ReturnType<AgentsModule["createVersion"]>;
|
|
113
|
+
createDraft: (agentId: string, body?: Parameters<AgentsModule["createDraft"]>[1]) => ReturnType<AgentsModule["createDraft"]>;
|
|
114
|
+
getBundle: (agentId: string, versionId: string) => ReturnType<AgentsModule["getBundle"]>;
|
|
115
|
+
update: (agentId: string, versionId: string, body: Parameters<AgentsModule["updateVersion"]>[2]) => ReturnType<AgentsModule["updateVersion"]>;
|
|
116
|
+
publish: (agentId: string, versionId: string) => ReturnType<AgentsModule["publishVersion"]>;
|
|
109
117
|
};
|
|
110
118
|
constructor(options: AgentOsClientOptions);
|
|
111
119
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentOsClient.d.ts","sourceRoot":"","sources":["../../src/client/AgentOsClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EACH,KAAK,oBAAoB,EAK5B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,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e,CAAC,CAAC,CAAC;QAC9I,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,UAAU,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;KAC/F,CAAC;gBAEU,OAAO,EAAE,oBAAoB;IA4EzC;;OAEG;IACH,OAAO,CAAC,aAAa;IAYrB;;;;;;OAMG;YACW,eAAe;IAwC7B;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAIxD,yBAAyB;IACzB,IAAI,QAAQ,IAAI,WAAW,GAAG,KAAK,CAElC;IAED,4CAA4C;IAC5C,IAAI,GAAG,IAAI,SAAS,CAEnB;CACJ"}
|
|
@@ -60,6 +60,8 @@ import { MetricsModule } from "../modules/metrics.js";
|
|
|
60
60
|
import { GraphsModule } from "../modules/graphs.js";
|
|
61
61
|
import { CatalogModule } from "../modules/catalog.js";
|
|
62
62
|
import { ApprovalsModule } from "../modules/approvals.js";
|
|
63
|
+
import { ApiTokensModule } from "../modules/apiTokens.js";
|
|
64
|
+
import { MembershipsModule } from "../modules/memberships.js";
|
|
63
65
|
export { isApiTokenAuth, isJwtAuth } from "./auth.js";
|
|
64
66
|
export class AgentOsClient {
|
|
65
67
|
_client;
|
|
@@ -101,6 +103,8 @@ export class AgentOsClient {
|
|
|
101
103
|
approvals;
|
|
102
104
|
// Convenience aliases
|
|
103
105
|
experiments;
|
|
106
|
+
apiTokens;
|
|
107
|
+
memberships;
|
|
104
108
|
agentVersions;
|
|
105
109
|
constructor(options) {
|
|
106
110
|
this._baseUrl = options.baseUrl;
|
|
@@ -156,10 +160,16 @@ export class AgentOsClient {
|
|
|
156
160
|
get: this.evaluation.getExperiment.bind(this.evaluation),
|
|
157
161
|
create: this.evaluation.createExperiment.bind(this.evaluation),
|
|
158
162
|
};
|
|
163
|
+
this.apiTokens = new ApiTokensModule(this._client);
|
|
164
|
+
this.memberships = new MembershipsModule(this._client);
|
|
159
165
|
this.agentVersions = {
|
|
160
166
|
list: (agentId) => this.agents.listVersions(agentId),
|
|
161
167
|
get: (agentId, versionId) => this.agents.getVersion(agentId, versionId),
|
|
162
168
|
create: (agentId, body) => this.agents.createVersion(agentId, body),
|
|
169
|
+
createDraft: (agentId, body) => this.agents.createDraft(agentId, body),
|
|
170
|
+
getBundle: (agentId, versionId) => this.agents.getBundle(agentId, versionId),
|
|
171
|
+
update: (agentId, versionId, body) => this.agents.updateVersion(agentId, versionId, body),
|
|
172
|
+
publish: (agentId, versionId) => this.agents.publishVersion(agentId, versionId),
|
|
163
173
|
};
|
|
164
174
|
}
|
|
165
175
|
/**
|
|
@@ -205,12 +215,11 @@ export class AgentOsClient {
|
|
|
205
215
|
if (token) {
|
|
206
216
|
headers["Authorization"] = `Bearer ${token}`;
|
|
207
217
|
}
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
218
|
+
// Workspace ID is optional for bootstrap endpoints (e.g., /me)
|
|
219
|
+
// Most endpoints require it, but the header provider allows empty strings
|
|
220
|
+
if (workspaceId) {
|
|
221
|
+
headers["X-Workspace-Id"] = workspaceId;
|
|
212
222
|
}
|
|
213
|
-
headers["X-Workspace-Id"] = workspaceId;
|
|
214
223
|
// NO X-Tenant-Id (backend derives from workspace membership)
|
|
215
224
|
}
|
|
216
225
|
return headers;
|
package/dist/modules/agents.d.ts
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* - list* for collections: listAgents()
|
|
7
7
|
* - create*, update*, delete* for mutations
|
|
8
8
|
*/
|
|
9
|
-
import type { RawClient, APIResponse
|
|
9
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
10
10
|
import type { PaginationParams, PaginatedResponse } from "../client/helpers.js";
|
|
11
|
-
type AgentBundle = components["schemas"]["AgentBundle"];
|
|
12
11
|
export interface Agent {
|
|
13
12
|
id: string;
|
|
14
13
|
name: string;
|
|
@@ -28,6 +27,65 @@ export interface AgentVersion {
|
|
|
28
27
|
format?: string;
|
|
29
28
|
graph_spec?: unknown;
|
|
30
29
|
created_at: string;
|
|
30
|
+
draft_state?: string | null;
|
|
31
|
+
base_version_id?: string | null;
|
|
32
|
+
}
|
|
33
|
+
export interface CreateDraftRequest {
|
|
34
|
+
/** Base type: "live" (current live version) or "version" (specific version) */
|
|
35
|
+
base?: "live" | "version";
|
|
36
|
+
/** Required when base="version" */
|
|
37
|
+
base_version_id?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CreateDraftResponse {
|
|
40
|
+
draft_version_id: string;
|
|
41
|
+
agent_id: string;
|
|
42
|
+
base_version_id?: string | null;
|
|
43
|
+
created_at: string;
|
|
44
|
+
}
|
|
45
|
+
export interface AgentBundle {
|
|
46
|
+
schema_version: string;
|
|
47
|
+
exported_at: string;
|
|
48
|
+
agent?: AgentBundleAgent;
|
|
49
|
+
versions?: AgentBundleVersion[];
|
|
50
|
+
}
|
|
51
|
+
export interface AgentBundleAgent {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
live_version_id?: string | null;
|
|
55
|
+
}
|
|
56
|
+
export interface AgentBundleVersion {
|
|
57
|
+
id: string;
|
|
58
|
+
version_tag: string;
|
|
59
|
+
artifact_uri: string;
|
|
60
|
+
artifact_hash?: string;
|
|
61
|
+
format?: string;
|
|
62
|
+
created_at: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ImportAgentResponse {
|
|
65
|
+
agent_id: string;
|
|
66
|
+
message: string;
|
|
67
|
+
versions_imported: number;
|
|
68
|
+
}
|
|
69
|
+
export interface AgentVersionMetadata {
|
|
70
|
+
id: string;
|
|
71
|
+
agent_id: string;
|
|
72
|
+
version_tag: string;
|
|
73
|
+
created_at: string;
|
|
74
|
+
}
|
|
75
|
+
export interface AgentVersionBundleResponse {
|
|
76
|
+
version: AgentVersionMetadata;
|
|
77
|
+
graph_spec: unknown;
|
|
78
|
+
artifact_hash: string;
|
|
79
|
+
format: string;
|
|
80
|
+
resolved_at: string;
|
|
81
|
+
}
|
|
82
|
+
export interface UpdateAgentVersionRequest {
|
|
83
|
+
graph_spec?: unknown;
|
|
84
|
+
}
|
|
85
|
+
export interface PublishAgentVersionResponse {
|
|
86
|
+
agent_id: string;
|
|
87
|
+
live_version_id: string;
|
|
88
|
+
status: string;
|
|
31
89
|
}
|
|
32
90
|
export interface AgentGraphResponse {
|
|
33
91
|
mermaid?: string;
|
|
@@ -115,23 +173,46 @@ export declare class AgentsModule {
|
|
|
115
173
|
*/
|
|
116
174
|
getVersion(agentId: string, versionId: string): Promise<APIResponse<AgentVersion>>;
|
|
117
175
|
/**
|
|
118
|
-
*
|
|
176
|
+
* Create or retrieve an active draft version for editing.
|
|
177
|
+
* This endpoint is idempotent - calling it multiple times returns the same draft.
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* const { data } = await client.agents.createDraft("agent-uuid", { base: "live" });
|
|
181
|
+
* console.log(data?.draft_version_id);
|
|
182
|
+
* // Then call getBundle(draftVersionId) to load the graph
|
|
183
|
+
* ```
|
|
119
184
|
*/
|
|
120
|
-
|
|
121
|
-
/** Alias for getGraph (convenience) */
|
|
122
|
-
graph: (agentId: string, format?: "mermaid" | "json") => Promise<APIResponse<AgentGraphResponse>>;
|
|
185
|
+
createDraft(agentId: string, body?: CreateDraftRequest): Promise<APIResponse<CreateDraftResponse>>;
|
|
123
186
|
/**
|
|
124
|
-
*
|
|
187
|
+
* Get the full bundle for a version (including resolved graph_spec).
|
|
125
188
|
*/
|
|
126
|
-
|
|
189
|
+
getBundle(agentId: string, versionId: string): Promise<APIResponse<AgentVersionBundleResponse>>;
|
|
190
|
+
/**
|
|
191
|
+
* Update a draft version.
|
|
192
|
+
* Only allowed if draft_state="active".
|
|
193
|
+
*/
|
|
194
|
+
updateVersion(agentId: string, versionId: string, body: UpdateAgentVersionRequest): Promise<APIResponse<AgentVersion>>;
|
|
127
195
|
/**
|
|
128
|
-
*
|
|
196
|
+
* Publish a draft version to live.
|
|
197
|
+
*/
|
|
198
|
+
publishVersion(agentId: string, versionId: string): Promise<APIResponse<PublishAgentVersionResponse>>;
|
|
199
|
+
/**
|
|
200
|
+
* Export an agent as a JSON bundle.
|
|
129
201
|
*/
|
|
130
202
|
export(agentId: string): Promise<APIResponse<AgentBundle>>;
|
|
131
203
|
/**
|
|
132
204
|
* Import an agent bundle.
|
|
133
205
|
*/
|
|
134
|
-
import(bundle: AgentBundle): Promise<APIResponse<
|
|
206
|
+
import(bundle: AgentBundle): Promise<APIResponse<ImportAgentResponse>>;
|
|
207
|
+
/**
|
|
208
|
+
* Get the graph for an agent (Mermaid or JSON).
|
|
209
|
+
*/
|
|
210
|
+
getGraph(agentId: string, format?: "mermaid" | "json"): Promise<APIResponse<AgentGraphResponse>>;
|
|
211
|
+
/** Alias for getGraph (convenience) */
|
|
212
|
+
graph: (agentId: string, format?: "mermaid" | "json") => Promise<APIResponse<AgentGraphResponse>>;
|
|
213
|
+
/**
|
|
214
|
+
* Validate the graph configuration.
|
|
215
|
+
*/
|
|
216
|
+
validateGraph(agentId: string): Promise<APIResponse<GraphValidationResponse>>;
|
|
135
217
|
}
|
|
136
|
-
export {};
|
|
137
218
|
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/modules/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/modules/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAKhF,MAAM,WAAW,KAAK;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,I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G,uCAAuC;IACvC,KAAK,GAAI,SAAS,MAAM,EAAE,SAAS,SAAS,GAAG,MAAM,8CAAoC;IAEzF;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;CAQtF"}
|
package/dist/modules/agents.js
CHANGED
|
@@ -111,30 +111,55 @@ export class AgentsModule {
|
|
|
111
111
|
headers: this.headers(),
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
// ======================== Graph ========================
|
|
115
114
|
/**
|
|
116
|
-
*
|
|
115
|
+
* Create or retrieve an active draft version for editing.
|
|
116
|
+
* This endpoint is idempotent - calling it multiple times returns the same draft.
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const { data } = await client.agents.createDraft("agent-uuid", { base: "live" });
|
|
120
|
+
* console.log(data?.draft_version_id);
|
|
121
|
+
* // Then call getBundle(draftVersionId) to load the graph
|
|
122
|
+
* ```
|
|
117
123
|
*/
|
|
118
|
-
async
|
|
119
|
-
return this.client.
|
|
120
|
-
params: { path: { agentId }
|
|
124
|
+
async createDraft(agentId, body) {
|
|
125
|
+
return this.client.POST("/v1/api/agents/{agentId}/versions/draft", {
|
|
126
|
+
params: { path: { agentId } },
|
|
127
|
+
body: body ?? { base: "live" },
|
|
121
128
|
headers: this.headers(),
|
|
122
129
|
});
|
|
123
130
|
}
|
|
124
|
-
/** Alias for getGraph (convenience) */
|
|
125
|
-
graph = (agentId, format) => this.getGraph(agentId, format);
|
|
126
131
|
/**
|
|
127
|
-
*
|
|
132
|
+
* Get the full bundle for a version (including resolved graph_spec).
|
|
128
133
|
*/
|
|
129
|
-
async
|
|
130
|
-
return this.client.
|
|
131
|
-
params: { path: { agentId } },
|
|
134
|
+
async getBundle(agentId, versionId) {
|
|
135
|
+
return this.client.GET("/v1/api/agents/{agentId}/versions/{versionId}/bundle", {
|
|
136
|
+
params: { path: { agentId, versionId } },
|
|
137
|
+
headers: this.headers(),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Update a draft version.
|
|
142
|
+
* Only allowed if draft_state="active".
|
|
143
|
+
*/
|
|
144
|
+
async updateVersion(agentId, versionId, body) {
|
|
145
|
+
return this.client.PATCH("/v1/api/agents/{agentId}/versions/{versionId}", {
|
|
146
|
+
params: { path: { agentId, versionId } },
|
|
147
|
+
body,
|
|
148
|
+
headers: this.headers(),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Publish a draft version to live.
|
|
153
|
+
*/
|
|
154
|
+
async publishVersion(agentId, versionId) {
|
|
155
|
+
return this.client.POST("/v1/api/agents/{agentId}/versions/{versionId}/publish", {
|
|
156
|
+
params: { path: { agentId, versionId } },
|
|
132
157
|
headers: this.headers(),
|
|
133
158
|
});
|
|
134
159
|
}
|
|
135
|
-
// ========================
|
|
160
|
+
// ======================== Portability ========================
|
|
136
161
|
/**
|
|
137
|
-
* Export an agent
|
|
162
|
+
* Export an agent as a JSON bundle.
|
|
138
163
|
*/
|
|
139
164
|
async export(agentId) {
|
|
140
165
|
return this.client.GET("/v1/api/agents/{id}/export", {
|
|
@@ -151,4 +176,25 @@ export class AgentsModule {
|
|
|
151
176
|
headers: this.headers(),
|
|
152
177
|
});
|
|
153
178
|
}
|
|
179
|
+
// ======================== Graph ========================
|
|
180
|
+
/**
|
|
181
|
+
* Get the graph for an agent (Mermaid or JSON).
|
|
182
|
+
*/
|
|
183
|
+
async getGraph(agentId, format) {
|
|
184
|
+
return this.client.GET("/v1/api/agents/{agentId}/graph", {
|
|
185
|
+
params: { path: { agentId }, query: { format } },
|
|
186
|
+
headers: this.headers(),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/** Alias for getGraph (convenience) */
|
|
190
|
+
graph = (agentId, format) => this.getGraph(agentId, format);
|
|
191
|
+
/**
|
|
192
|
+
* Validate the graph configuration.
|
|
193
|
+
*/
|
|
194
|
+
async validateGraph(agentId) {
|
|
195
|
+
return this.client.POST("/v1/api/agents/{agentId}/graph/validate", {
|
|
196
|
+
params: { path: { agentId } },
|
|
197
|
+
headers: this.headers(),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
154
200
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
2
|
+
export interface ApiToken {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
token_prefix: string;
|
|
6
|
+
scopes: string[];
|
|
7
|
+
created_at: string;
|
|
8
|
+
expires_at?: string | null;
|
|
9
|
+
last_used_at?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface ApiTokenSecret extends ApiToken {
|
|
12
|
+
token: string;
|
|
13
|
+
workspace_id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CreateTokenRequest {
|
|
16
|
+
name: string;
|
|
17
|
+
scopes?: string[];
|
|
18
|
+
expires_at?: string | null;
|
|
19
|
+
environment?: "live" | "test";
|
|
20
|
+
}
|
|
21
|
+
export interface RotateTokenResponse extends ApiTokenSecret {
|
|
22
|
+
rotated_from: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class ApiTokensModule {
|
|
25
|
+
private client;
|
|
26
|
+
constructor(client: RawClient);
|
|
27
|
+
private headers;
|
|
28
|
+
/**
|
|
29
|
+
* List all API tokens for the current workspace.
|
|
30
|
+
*/
|
|
31
|
+
list(): Promise<APIResponse<{
|
|
32
|
+
tokens: ApiToken[];
|
|
33
|
+
}>>;
|
|
34
|
+
/**
|
|
35
|
+
* Create a new API token.
|
|
36
|
+
* The full token secret is only returned in this response.
|
|
37
|
+
*/
|
|
38
|
+
create(body: CreateTokenRequest): Promise<APIResponse<ApiTokenSecret>>;
|
|
39
|
+
/**
|
|
40
|
+
* Revoke an API token immediately.
|
|
41
|
+
*/
|
|
42
|
+
revoke(id: string): Promise<APIResponse<{
|
|
43
|
+
message: string;
|
|
44
|
+
}>>;
|
|
45
|
+
/**
|
|
46
|
+
* Rotate a token (revoke old, create new).
|
|
47
|
+
* Returns the new token secret.
|
|
48
|
+
*/
|
|
49
|
+
rotate(id: string): Promise<APIResponse<RotateTokenResponse>>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=apiTokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiTokens.d.ts","sourceRoot":"","sources":["../../src/modules/apiTokens.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACvD,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,eAAe;IACxB,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B,OAAO,CAAC,OAAO;IAMf;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;QAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;KAAE,CAAC,CAAC;IAM1D;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAO5E;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAOnE;;;OAGG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;CAMtE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export class ApiTokensModule {
|
|
2
|
+
client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
headers() {
|
|
7
|
+
return {
|
|
8
|
+
"Content-Type": "application/json",
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* List all API tokens for the current workspace.
|
|
13
|
+
*/
|
|
14
|
+
async list() {
|
|
15
|
+
return this.client.GET("/v1/api/tokens", {
|
|
16
|
+
headers: this.headers(),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a new API token.
|
|
21
|
+
* The full token secret is only returned in this response.
|
|
22
|
+
*/
|
|
23
|
+
async create(body) {
|
|
24
|
+
return this.client.POST("/v1/api/tokens", {
|
|
25
|
+
body,
|
|
26
|
+
headers: this.headers(),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Revoke an API token immediately.
|
|
31
|
+
*/
|
|
32
|
+
async revoke(id) {
|
|
33
|
+
return this.client.DELETE("/v1/api/tokens/{id}", {
|
|
34
|
+
params: { path: { id } },
|
|
35
|
+
headers: this.headers(),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Rotate a token (revoke old, create new).
|
|
40
|
+
* Returns the new token secret.
|
|
41
|
+
*/
|
|
42
|
+
async rotate(id) {
|
|
43
|
+
return this.client.POST("/v1/api/tokens/{id}/rotate", {
|
|
44
|
+
params: { path: { id } },
|
|
45
|
+
headers: this.headers(),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -35,13 +35,19 @@ export interface CatalogMetadata {
|
|
|
35
35
|
contentHash?: string;
|
|
36
36
|
}
|
|
37
37
|
export interface NodeCatalogResponse extends CatalogMetadata {
|
|
38
|
-
nodes:
|
|
38
|
+
nodes: NodeDefinition[];
|
|
39
39
|
}
|
|
40
40
|
export interface NodeDefinition {
|
|
41
|
-
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
42
43
|
category: string;
|
|
43
|
-
description
|
|
44
|
+
description?: string;
|
|
45
|
+
ports?: {
|
|
46
|
+
inputs?: string[];
|
|
47
|
+
outputs?: string[];
|
|
48
|
+
};
|
|
44
49
|
config_schema?: Record<string, unknown>;
|
|
50
|
+
default_config?: Record<string, unknown>;
|
|
45
51
|
}
|
|
46
52
|
export interface ToolCatalogResponse extends CatalogMetadata {
|
|
47
53
|
tools: ToolDefinition[];
|
|
@@ -57,7 +63,7 @@ export interface ToolDefinition {
|
|
|
57
63
|
credential_requirements?: unknown[];
|
|
58
64
|
}
|
|
59
65
|
export interface TriggerCatalogResponse extends CatalogMetadata {
|
|
60
|
-
|
|
66
|
+
templates: TriggerTemplate[];
|
|
61
67
|
}
|
|
62
68
|
export interface TriggerTemplate {
|
|
63
69
|
slug: string;
|
|
@@ -65,6 +71,18 @@ export interface TriggerTemplate {
|
|
|
65
71
|
description?: string;
|
|
66
72
|
run_input_schema?: Record<string, unknown>;
|
|
67
73
|
}
|
|
74
|
+
export interface PresetCatalogResponse extends CatalogMetadata {
|
|
75
|
+
presets: PresetDefinition[];
|
|
76
|
+
}
|
|
77
|
+
export interface PresetDefinition {
|
|
78
|
+
preset_slug: string;
|
|
79
|
+
base_node_slug: string;
|
|
80
|
+
title: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
default_config?: Record<string, unknown>;
|
|
83
|
+
locked_fields?: string[];
|
|
84
|
+
ui_variant?: string;
|
|
85
|
+
}
|
|
68
86
|
export declare class CatalogModule {
|
|
69
87
|
private client;
|
|
70
88
|
constructor(client: RawClient);
|
|
@@ -83,6 +101,11 @@ export declare class CatalogModule {
|
|
|
83
101
|
* Returns trigger configurations and input schemas.
|
|
84
102
|
*/
|
|
85
103
|
getTriggers(version?: string): Promise<APIResponse<TriggerCatalogResponse>>;
|
|
104
|
+
/**
|
|
105
|
+
* Get the Node Presets Catalog.
|
|
106
|
+
* Returns pre-configured node variants with locked fields.
|
|
107
|
+
*/
|
|
108
|
+
getPresets(version?: string): Promise<APIResponse<PresetCatalogResponse>>;
|
|
86
109
|
/**
|
|
87
110
|
* Get all catalogs at once for convenience.
|
|
88
111
|
* Returns combined catalog data with versions.
|
|
@@ -92,6 +115,7 @@ export declare class CatalogModule {
|
|
|
92
115
|
nodes: NodeCatalogResponse;
|
|
93
116
|
tools: ToolCatalogResponse;
|
|
94
117
|
triggers: TriggerCatalogResponse;
|
|
118
|
+
presets: PresetCatalogResponse;
|
|
95
119
|
catalog_versions: CatalogVersions;
|
|
96
120
|
};
|
|
97
121
|
error?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/modules/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WA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F;;;OAGG;IACG,UAAU,CAAC,OAAO,GAAE,MAAY,GAAG,OAAO,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAQpF;;;OAGG;IACG,MAAM,CAAC,OAAO,GAAE,MAAY,GAAG,OAAO,CAAC;QACzC,IAAI,CAAC,EAAE;YACH,KAAK,EAAE,mBAAmB,CAAC;YAC3B,KAAK,EAAE,mBAAmB,CAAC;YAC3B,QAAQ,EAAE,sBAAsB,CAAC;YACjC,OAAO,EAAE,qBAAqB,CAAC;YAC/B,gBAAgB,EAAE,eAAe,CAAC;SACrC,CAAC;QACF,KAAK,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KAChE,CAAC;CA4BL"}
|
package/dist/modules/catalog.js
CHANGED
|
@@ -59,15 +59,26 @@ export class CatalogModule {
|
|
|
59
59
|
});
|
|
60
60
|
return response;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the Node Presets Catalog.
|
|
64
|
+
* Returns pre-configured node variants with locked fields.
|
|
65
|
+
*/
|
|
66
|
+
async getPresets(version = "1") {
|
|
67
|
+
const response = await this.client.GET("/v1/api/catalog/presets", {
|
|
68
|
+
params: { query: { version } },
|
|
69
|
+
});
|
|
70
|
+
return response;
|
|
71
|
+
}
|
|
62
72
|
/**
|
|
63
73
|
* Get all catalogs at once for convenience.
|
|
64
74
|
* Returns combined catalog data with versions.
|
|
65
75
|
*/
|
|
66
76
|
async getAll(version = "1") {
|
|
67
|
-
const [nodesRes, toolsRes, triggersRes] = await Promise.all([
|
|
77
|
+
const [nodesRes, toolsRes, triggersRes, presetsRes] = await Promise.all([
|
|
68
78
|
this.getNodes(version),
|
|
69
79
|
this.getTools(version),
|
|
70
80
|
this.getTriggers(version),
|
|
81
|
+
this.getPresets(version),
|
|
71
82
|
]);
|
|
72
83
|
if (nodesRes.error)
|
|
73
84
|
return { data: undefined, error: nodesRes.error };
|
|
@@ -75,11 +86,14 @@ export class CatalogModule {
|
|
|
75
86
|
return { data: undefined, error: toolsRes.error };
|
|
76
87
|
if (triggersRes.error)
|
|
77
88
|
return { data: undefined, error: triggersRes.error };
|
|
89
|
+
if (presetsRes.error)
|
|
90
|
+
return { data: undefined, error: presetsRes.error };
|
|
78
91
|
return {
|
|
79
92
|
data: {
|
|
80
93
|
nodes: nodesRes.data,
|
|
81
94
|
tools: toolsRes.data,
|
|
82
95
|
triggers: triggersRes.data,
|
|
96
|
+
presets: presetsRes.data,
|
|
83
97
|
catalog_versions: {
|
|
84
98
|
nodes: version,
|
|
85
99
|
tools: version,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
2
|
+
export interface MembershipResponse {
|
|
3
|
+
id: string;
|
|
4
|
+
user_id: string;
|
|
5
|
+
tenant_id: string;
|
|
6
|
+
role_id: string;
|
|
7
|
+
role_name?: string;
|
|
8
|
+
workspace_id?: string;
|
|
9
|
+
workspace_name?: string;
|
|
10
|
+
created_at: string;
|
|
11
|
+
}
|
|
12
|
+
export interface EnsureMembershipRequest {
|
|
13
|
+
tenant_id?: string;
|
|
14
|
+
workspace_id?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class MembershipsModule {
|
|
17
|
+
private client;
|
|
18
|
+
constructor(client: RawClient);
|
|
19
|
+
private headers;
|
|
20
|
+
/**
|
|
21
|
+
* Ensure the current user has a membership in a tenant (self-provisioning).
|
|
22
|
+
*/
|
|
23
|
+
ensure(body: EnsureMembershipRequest): Promise<APIResponse<MembershipResponse>>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=memberships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../src/modules/memberships.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B,OAAO,CAAC,OAAO;IAMf;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;CAMxF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class MembershipsModule {
|
|
2
|
+
client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
headers() {
|
|
7
|
+
return {
|
|
8
|
+
"Content-Type": "application/json",
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Ensure the current user has a membership in a tenant (self-provisioning).
|
|
13
|
+
*/
|
|
14
|
+
async ensure(body) {
|
|
15
|
+
return this.client.POST("/v1/api/memberships/ensure", {
|
|
16
|
+
body,
|
|
17
|
+
headers: this.headers(),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -48,5 +48,57 @@ export declare class WorkspacesModule {
|
|
|
48
48
|
* Delete a workspace.
|
|
49
49
|
*/
|
|
50
50
|
delete(workspaceId: string): Promise<APIResponse<void>>;
|
|
51
|
+
/**
|
|
52
|
+
* Get workspace quotas.
|
|
53
|
+
*/
|
|
54
|
+
getQuotas(workspaceId: string): Promise<APIResponse<WorkspaceQuotaResponse>>;
|
|
55
|
+
/**
|
|
56
|
+
* Get workspace usage.
|
|
57
|
+
*/
|
|
58
|
+
getUsage(workspaceId: string, params?: {
|
|
59
|
+
from?: string;
|
|
60
|
+
to?: string;
|
|
61
|
+
}): Promise<APIResponse<WorkspaceUsageResponse>>;
|
|
62
|
+
}
|
|
63
|
+
export interface WorkspaceQuotaResponse {
|
|
64
|
+
workspace_id: string;
|
|
65
|
+
quotas: {
|
|
66
|
+
runs_per_month: Quota;
|
|
67
|
+
tokens_per_month: Quota;
|
|
68
|
+
agents_max: Quota;
|
|
69
|
+
storage_mb: Quota;
|
|
70
|
+
};
|
|
71
|
+
reset_at: string;
|
|
72
|
+
source: string;
|
|
73
|
+
}
|
|
74
|
+
export interface Quota {
|
|
75
|
+
limit: number;
|
|
76
|
+
used: number;
|
|
77
|
+
remaining: number;
|
|
78
|
+
}
|
|
79
|
+
export interface WorkspaceUsageResponse {
|
|
80
|
+
workspace_id: string;
|
|
81
|
+
period: {
|
|
82
|
+
from: string;
|
|
83
|
+
to: string;
|
|
84
|
+
};
|
|
85
|
+
usage: {
|
|
86
|
+
total_runs: number;
|
|
87
|
+
completed_runs: number;
|
|
88
|
+
failed_runs: number;
|
|
89
|
+
total_tokens: number;
|
|
90
|
+
input_tokens: number;
|
|
91
|
+
output_tokens: number;
|
|
92
|
+
total_duration_ms: number;
|
|
93
|
+
estimated_count: number;
|
|
94
|
+
};
|
|
95
|
+
daily_breakdown: Array<{
|
|
96
|
+
date: string;
|
|
97
|
+
runs: number;
|
|
98
|
+
tokens_in: number;
|
|
99
|
+
tokens_out: number;
|
|
100
|
+
duration_ms: number;
|
|
101
|
+
}>;
|
|
102
|
+
source: string;
|
|
51
103
|
}
|
|
52
104
|
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","s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H,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,eAAe,EAAE,KAAK,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;IACH,MAAM,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -56,4 +56,22 @@ export class WorkspacesModule {
|
|
|
56
56
|
headers: this.headers(),
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Get workspace quotas.
|
|
61
|
+
*/
|
|
62
|
+
async getQuotas(workspaceId) {
|
|
63
|
+
return this.client.GET("/v1/api/workspaces/{workspaceId}/quotas", {
|
|
64
|
+
params: { path: { workspaceId } },
|
|
65
|
+
headers: this.headers(),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get workspace usage.
|
|
70
|
+
*/
|
|
71
|
+
async getUsage(workspaceId, params) {
|
|
72
|
+
return this.client.GET("/v1/api/workspaces/{workspaceId}/usage", {
|
|
73
|
+
params: { path: { workspaceId }, query: params },
|
|
74
|
+
headers: this.headers(),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
59
77
|
}
|
package/package.json
CHANGED
|
@@ -69,6 +69,8 @@ import { MetricsModule } from "../modules/metrics.js";
|
|
|
69
69
|
import { GraphsModule } from "../modules/graphs.js";
|
|
70
70
|
import { CatalogModule } from "../modules/catalog.js";
|
|
71
71
|
import { ApprovalsModule } from "../modules/approvals.js";
|
|
72
|
+
import { ApiTokensModule } from "../modules/apiTokens.js";
|
|
73
|
+
import { MembershipsModule } from "../modules/memberships.js";
|
|
72
74
|
|
|
73
75
|
// Re-export auth types
|
|
74
76
|
export type { AgentOsClientOptions, AuthProvider } from "./auth.js";
|
|
@@ -122,10 +124,17 @@ export class AgentOsClient {
|
|
|
122
124
|
create: EvaluationModule["createExperiment"];
|
|
123
125
|
};
|
|
124
126
|
|
|
127
|
+
public readonly apiTokens: ApiTokensModule;
|
|
128
|
+
public readonly memberships: MembershipsModule;
|
|
129
|
+
|
|
125
130
|
readonly agentVersions: {
|
|
126
131
|
list: (agentId: string) => ReturnType<AgentsModule["listVersions"]>;
|
|
127
132
|
get: (agentId: string, versionId: string) => ReturnType<AgentsModule["getVersion"]>;
|
|
128
133
|
create: (agentId: string, body: Parameters<AgentsModule["createVersion"]>[1]) => ReturnType<AgentsModule["createVersion"]>;
|
|
134
|
+
createDraft: (agentId: string, body?: Parameters<AgentsModule["createDraft"]>[1]) => ReturnType<AgentsModule["createDraft"]>;
|
|
135
|
+
getBundle: (agentId: string, versionId: string) => ReturnType<AgentsModule["getBundle"]>;
|
|
136
|
+
update: (agentId: string, versionId: string, body: Parameters<AgentsModule["updateVersion"]>[2]) => ReturnType<AgentsModule["updateVersion"]>;
|
|
137
|
+
publish: (agentId: string, versionId: string) => ReturnType<AgentsModule["publishVersion"]>;
|
|
129
138
|
};
|
|
130
139
|
|
|
131
140
|
constructor(options: AgentOsClientOptions) {
|
|
@@ -189,10 +198,18 @@ export class AgentOsClient {
|
|
|
189
198
|
create: this.evaluation.createExperiment.bind(this.evaluation),
|
|
190
199
|
};
|
|
191
200
|
|
|
201
|
+
this.apiTokens = new ApiTokensModule(this._client);
|
|
202
|
+
this.memberships = new MembershipsModule(this._client);
|
|
203
|
+
|
|
192
204
|
this.agentVersions = {
|
|
193
205
|
list: (agentId: string) => this.agents.listVersions(agentId),
|
|
194
206
|
get: (agentId: string, versionId: string) => this.agents.getVersion(agentId, versionId),
|
|
195
207
|
create: (agentId: string, body: any) => this.agents.createVersion(agentId, body),
|
|
208
|
+
createDraft: (agentId: string, body?: { base?: "live" | "version"; base_version_id?: string }) =>
|
|
209
|
+
this.agents.createDraft(agentId, body),
|
|
210
|
+
getBundle: (agentId: string, versionId: string) => this.agents.getBundle(agentId, versionId),
|
|
211
|
+
update: (agentId: string, versionId: string, body: any) => this.agents.updateVersion(agentId, versionId, body),
|
|
212
|
+
publish: (agentId: string, versionId: string) => this.agents.publishVersion(agentId, versionId),
|
|
196
213
|
};
|
|
197
214
|
}
|
|
198
215
|
|
|
@@ -247,14 +264,11 @@ export class AgentOsClient {
|
|
|
247
264
|
headers["Authorization"] = `Bearer ${token}`;
|
|
248
265
|
}
|
|
249
266
|
|
|
250
|
-
//
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
"Call getWorkspaceId() must return a valid workspace ID."
|
|
255
|
-
);
|
|
267
|
+
// Workspace ID is optional for bootstrap endpoints (e.g., /me)
|
|
268
|
+
// Most endpoints require it, but the header provider allows empty strings
|
|
269
|
+
if (workspaceId) {
|
|
270
|
+
headers["X-Workspace-Id"] = workspaceId;
|
|
256
271
|
}
|
|
257
|
-
headers["X-Workspace-Id"] = workspaceId;
|
|
258
272
|
// NO X-Tenant-Id (backend derives from workspace membership)
|
|
259
273
|
}
|
|
260
274
|
|
package/src/modules/agents.ts
CHANGED
|
@@ -12,9 +12,6 @@ import type { PaginationParams, PaginatedResponse } from "../client/helpers.js";
|
|
|
12
12
|
|
|
13
13
|
// Type aliases for this module
|
|
14
14
|
type AgentSchema = components["schemas"]["AgentBundleAgent"];
|
|
15
|
-
type AgentBundle = components["schemas"]["AgentBundle"];
|
|
16
|
-
type AgentVersionSchema = components["schemas"]["AgentBundleVersion"];
|
|
17
|
-
|
|
18
15
|
// Response types
|
|
19
16
|
export interface Agent {
|
|
20
17
|
id: string;
|
|
@@ -36,6 +33,75 @@ export interface AgentVersion {
|
|
|
36
33
|
format?: string;
|
|
37
34
|
graph_spec?: unknown;
|
|
38
35
|
created_at: string;
|
|
36
|
+
draft_state?: string | null;
|
|
37
|
+
base_version_id?: string | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CreateDraftRequest {
|
|
41
|
+
/** Base type: "live" (current live version) or "version" (specific version) */
|
|
42
|
+
base?: "live" | "version";
|
|
43
|
+
/** Required when base="version" */
|
|
44
|
+
base_version_id?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CreateDraftResponse {
|
|
48
|
+
draft_version_id: string;
|
|
49
|
+
agent_id: string;
|
|
50
|
+
base_version_id?: string | null;
|
|
51
|
+
created_at: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface AgentBundle {
|
|
55
|
+
schema_version: string;
|
|
56
|
+
exported_at: string;
|
|
57
|
+
agent?: AgentBundleAgent;
|
|
58
|
+
versions?: AgentBundleVersion[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface AgentBundleAgent {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
live_version_id?: string | null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface AgentBundleVersion {
|
|
68
|
+
id: string;
|
|
69
|
+
version_tag: string;
|
|
70
|
+
artifact_uri: string;
|
|
71
|
+
artifact_hash?: string;
|
|
72
|
+
format?: string;
|
|
73
|
+
created_at: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ImportAgentResponse {
|
|
77
|
+
agent_id: string;
|
|
78
|
+
message: string;
|
|
79
|
+
versions_imported: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface AgentVersionMetadata {
|
|
83
|
+
id: string;
|
|
84
|
+
agent_id: string;
|
|
85
|
+
version_tag: string;
|
|
86
|
+
created_at: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface AgentVersionBundleResponse {
|
|
90
|
+
version: AgentVersionMetadata;
|
|
91
|
+
graph_spec: unknown;
|
|
92
|
+
artifact_hash: string;
|
|
93
|
+
format: string;
|
|
94
|
+
resolved_at: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface UpdateAgentVersionRequest {
|
|
98
|
+
graph_spec?: unknown;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface PublishAgentVersionResponse {
|
|
102
|
+
agent_id: string;
|
|
103
|
+
live_version_id: string;
|
|
104
|
+
status: string;
|
|
39
105
|
}
|
|
40
106
|
|
|
41
107
|
export interface AgentGraphResponse {
|
|
@@ -180,35 +246,60 @@ export class AgentsModule {
|
|
|
180
246
|
});
|
|
181
247
|
}
|
|
182
248
|
|
|
183
|
-
|
|
249
|
+
/**
|
|
250
|
+
* Create or retrieve an active draft version for editing.
|
|
251
|
+
* This endpoint is idempotent - calling it multiple times returns the same draft.
|
|
252
|
+
* @example
|
|
253
|
+
* ```ts
|
|
254
|
+
* const { data } = await client.agents.createDraft("agent-uuid", { base: "live" });
|
|
255
|
+
* console.log(data?.draft_version_id);
|
|
256
|
+
* // Then call getBundle(draftVersionId) to load the graph
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
async createDraft(agentId: string, body?: CreateDraftRequest): Promise<APIResponse<CreateDraftResponse>> {
|
|
260
|
+
return this.client.POST<CreateDraftResponse>("/v1/api/agents/{agentId}/versions/draft", {
|
|
261
|
+
params: { path: { agentId } },
|
|
262
|
+
body: body ?? { base: "live" },
|
|
263
|
+
headers: this.headers(),
|
|
264
|
+
});
|
|
265
|
+
}
|
|
184
266
|
|
|
185
267
|
/**
|
|
186
|
-
* Get the
|
|
268
|
+
* Get the full bundle for a version (including resolved graph_spec).
|
|
187
269
|
*/
|
|
188
|
-
async
|
|
189
|
-
return this.client.GET<
|
|
190
|
-
params: { path: { agentId
|
|
270
|
+
async getBundle(agentId: string, versionId: string): Promise<APIResponse<AgentVersionBundleResponse>> {
|
|
271
|
+
return this.client.GET<AgentVersionBundleResponse>("/v1/api/agents/{agentId}/versions/{versionId}/bundle", {
|
|
272
|
+
params: { path: { agentId, versionId } },
|
|
191
273
|
headers: this.headers(),
|
|
192
274
|
});
|
|
193
275
|
}
|
|
194
276
|
|
|
195
|
-
/**
|
|
196
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Update a draft version.
|
|
279
|
+
* Only allowed if draft_state="active".
|
|
280
|
+
*/
|
|
281
|
+
async updateVersion(agentId: string, versionId: string, body: UpdateAgentVersionRequest): Promise<APIResponse<AgentVersion>> {
|
|
282
|
+
return this.client.PATCH<AgentVersion>("/v1/api/agents/{agentId}/versions/{versionId}", {
|
|
283
|
+
params: { path: { agentId, versionId } },
|
|
284
|
+
body,
|
|
285
|
+
headers: this.headers(),
|
|
286
|
+
});
|
|
287
|
+
}
|
|
197
288
|
|
|
198
289
|
/**
|
|
199
|
-
*
|
|
290
|
+
* Publish a draft version to live.
|
|
200
291
|
*/
|
|
201
|
-
async
|
|
202
|
-
return this.client.POST<
|
|
203
|
-
params: { path: { agentId } },
|
|
292
|
+
async publishVersion(agentId: string, versionId: string): Promise<APIResponse<PublishAgentVersionResponse>> {
|
|
293
|
+
return this.client.POST<PublishAgentVersionResponse>("/v1/api/agents/{agentId}/versions/{versionId}/publish", {
|
|
294
|
+
params: { path: { agentId, versionId } },
|
|
204
295
|
headers: this.headers(),
|
|
205
296
|
});
|
|
206
297
|
}
|
|
207
298
|
|
|
208
|
-
// ========================
|
|
299
|
+
// ======================== Portability ========================
|
|
209
300
|
|
|
210
301
|
/**
|
|
211
|
-
* Export an agent
|
|
302
|
+
* Export an agent as a JSON bundle.
|
|
212
303
|
*/
|
|
213
304
|
async export(agentId: string): Promise<APIResponse<AgentBundle>> {
|
|
214
305
|
return this.client.GET<AgentBundle>("/v1/api/agents/{id}/export", {
|
|
@@ -220,10 +311,37 @@ export class AgentsModule {
|
|
|
220
311
|
/**
|
|
221
312
|
* Import an agent bundle.
|
|
222
313
|
*/
|
|
223
|
-
async import(bundle: AgentBundle): Promise<APIResponse<
|
|
224
|
-
return this.client.POST<
|
|
314
|
+
async import(bundle: AgentBundle): Promise<APIResponse<ImportAgentResponse>> {
|
|
315
|
+
return this.client.POST<ImportAgentResponse>("/v1/api/agents/import", {
|
|
225
316
|
body: bundle,
|
|
226
317
|
headers: this.headers(),
|
|
227
318
|
});
|
|
228
319
|
}
|
|
320
|
+
|
|
321
|
+
// ======================== Graph ========================
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Get the graph for an agent (Mermaid or JSON).
|
|
325
|
+
*/
|
|
326
|
+
async getGraph(agentId: string, format?: "mermaid" | "json"): Promise<APIResponse<AgentGraphResponse>> {
|
|
327
|
+
return this.client.GET<AgentGraphResponse>("/v1/api/agents/{agentId}/graph", {
|
|
328
|
+
params: { path: { agentId }, query: { format } },
|
|
329
|
+
headers: this.headers(),
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** Alias for getGraph (convenience) */
|
|
334
|
+
graph = (agentId: string, format?: "mermaid" | "json") => this.getGraph(agentId, format);
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Validate the graph configuration.
|
|
338
|
+
*/
|
|
339
|
+
async validateGraph(agentId: string): Promise<APIResponse<GraphValidationResponse>> {
|
|
340
|
+
return this.client.POST<GraphValidationResponse>("/v1/api/agents/{agentId}/graph/validate", {
|
|
341
|
+
params: { path: { agentId } },
|
|
342
|
+
headers: this.headers(),
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
229
347
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
3
|
+
|
|
4
|
+
export interface ApiToken {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
token_prefix: string;
|
|
8
|
+
scopes: string[];
|
|
9
|
+
created_at: string;
|
|
10
|
+
expires_at?: string | null;
|
|
11
|
+
last_used_at?: string | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ApiTokenSecret extends ApiToken {
|
|
15
|
+
token: string; // The full secret, only returned once
|
|
16
|
+
workspace_id: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CreateTokenRequest {
|
|
20
|
+
name: string;
|
|
21
|
+
scopes?: string[];
|
|
22
|
+
expires_at?: string | null;
|
|
23
|
+
environment?: "live" | "test";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface RotateTokenResponse extends ApiTokenSecret {
|
|
27
|
+
rotated_from: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class ApiTokensModule {
|
|
31
|
+
private client: RawClient;
|
|
32
|
+
|
|
33
|
+
constructor(client: RawClient) {
|
|
34
|
+
this.client = client;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private headers() {
|
|
38
|
+
return {
|
|
39
|
+
"Content-Type": "application/json",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* List all API tokens for the current workspace.
|
|
45
|
+
*/
|
|
46
|
+
async list(): Promise<APIResponse<{ tokens: ApiToken[] }>> {
|
|
47
|
+
return this.client.GET<{ tokens: ApiToken[] }>("/v1/api/tokens", {
|
|
48
|
+
headers: this.headers(),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Create a new API token.
|
|
54
|
+
* The full token secret is only returned in this response.
|
|
55
|
+
*/
|
|
56
|
+
async create(body: CreateTokenRequest): Promise<APIResponse<ApiTokenSecret>> {
|
|
57
|
+
return this.client.POST<ApiTokenSecret>("/v1/api/tokens", {
|
|
58
|
+
body,
|
|
59
|
+
headers: this.headers(),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Revoke an API token immediately.
|
|
65
|
+
*/
|
|
66
|
+
async revoke(id: string): Promise<APIResponse<{ message: string }>> {
|
|
67
|
+
return this.client.DELETE<{ message: string }>("/v1/api/tokens/{id}", {
|
|
68
|
+
params: { path: { id } },
|
|
69
|
+
headers: this.headers(),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Rotate a token (revoke old, create new).
|
|
75
|
+
* Returns the new token secret.
|
|
76
|
+
*/
|
|
77
|
+
async rotate(id: string): Promise<APIResponse<RotateTokenResponse>> {
|
|
78
|
+
return this.client.POST<RotateTokenResponse>("/v1/api/tokens/{id}/rotate", {
|
|
79
|
+
params: { path: { id } },
|
|
80
|
+
headers: this.headers(),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
package/src/modules/catalog.ts
CHANGED
|
@@ -39,14 +39,17 @@ export interface CatalogMetadata {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export interface NodeCatalogResponse extends CatalogMetadata {
|
|
42
|
-
nodes:
|
|
42
|
+
nodes: NodeDefinition[];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface NodeDefinition {
|
|
46
|
-
|
|
46
|
+
id: string;
|
|
47
|
+
title: string;
|
|
47
48
|
category: string;
|
|
48
|
-
description
|
|
49
|
+
description?: string;
|
|
50
|
+
ports?: { inputs?: string[]; outputs?: string[] };
|
|
49
51
|
config_schema?: Record<string, unknown>;
|
|
52
|
+
default_config?: Record<string, unknown>;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
export interface ToolCatalogResponse extends CatalogMetadata {
|
|
@@ -65,7 +68,7 @@ export interface ToolDefinition {
|
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
export interface TriggerCatalogResponse extends CatalogMetadata {
|
|
68
|
-
|
|
71
|
+
templates: TriggerTemplate[];
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
export interface TriggerTemplate {
|
|
@@ -75,6 +78,20 @@ export interface TriggerTemplate {
|
|
|
75
78
|
run_input_schema?: Record<string, unknown>;
|
|
76
79
|
}
|
|
77
80
|
|
|
81
|
+
export interface PresetCatalogResponse extends CatalogMetadata {
|
|
82
|
+
presets: PresetDefinition[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface PresetDefinition {
|
|
86
|
+
preset_slug: string;
|
|
87
|
+
base_node_slug: string;
|
|
88
|
+
title: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
default_config?: Record<string, unknown>;
|
|
91
|
+
locked_fields?: string[];
|
|
92
|
+
ui_variant?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
78
95
|
export class CatalogModule {
|
|
79
96
|
constructor(private client: RawClient) { }
|
|
80
97
|
|
|
@@ -115,6 +132,18 @@ export class CatalogModule {
|
|
|
115
132
|
return response;
|
|
116
133
|
}
|
|
117
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Get the Node Presets Catalog.
|
|
137
|
+
* Returns pre-configured node variants with locked fields.
|
|
138
|
+
*/
|
|
139
|
+
async getPresets(version: string = "1"): Promise<APIResponse<PresetCatalogResponse>> {
|
|
140
|
+
const response = await this.client.GET<PresetCatalogResponse>("/v1/api/catalog/presets", {
|
|
141
|
+
params: { query: { version } },
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
return response;
|
|
145
|
+
}
|
|
146
|
+
|
|
118
147
|
/**
|
|
119
148
|
* Get all catalogs at once for convenience.
|
|
120
149
|
* Returns combined catalog data with versions.
|
|
@@ -124,25 +153,29 @@ export class CatalogModule {
|
|
|
124
153
|
nodes: NodeCatalogResponse;
|
|
125
154
|
tools: ToolCatalogResponse;
|
|
126
155
|
triggers: TriggerCatalogResponse;
|
|
156
|
+
presets: PresetCatalogResponse;
|
|
127
157
|
catalog_versions: CatalogVersions;
|
|
128
158
|
};
|
|
129
159
|
error?: { code: string; message: string; details?: unknown };
|
|
130
160
|
}> {
|
|
131
|
-
const [nodesRes, toolsRes, triggersRes] = await Promise.all([
|
|
161
|
+
const [nodesRes, toolsRes, triggersRes, presetsRes] = await Promise.all([
|
|
132
162
|
this.getNodes(version),
|
|
133
163
|
this.getTools(version),
|
|
134
164
|
this.getTriggers(version),
|
|
165
|
+
this.getPresets(version),
|
|
135
166
|
]);
|
|
136
167
|
|
|
137
168
|
if (nodesRes.error) return { data: undefined, error: nodesRes.error };
|
|
138
169
|
if (toolsRes.error) return { data: undefined, error: toolsRes.error };
|
|
139
170
|
if (triggersRes.error) return { data: undefined, error: triggersRes.error };
|
|
171
|
+
if (presetsRes.error) return { data: undefined, error: presetsRes.error };
|
|
140
172
|
|
|
141
173
|
return {
|
|
142
174
|
data: {
|
|
143
175
|
nodes: nodesRes.data!,
|
|
144
176
|
tools: toolsRes.data!,
|
|
145
177
|
triggers: triggersRes.data!,
|
|
178
|
+
presets: presetsRes.data!,
|
|
146
179
|
catalog_versions: {
|
|
147
180
|
nodes: version,
|
|
148
181
|
tools: version,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
3
|
+
|
|
4
|
+
export interface MembershipResponse {
|
|
5
|
+
id: string;
|
|
6
|
+
user_id: string;
|
|
7
|
+
tenant_id: string;
|
|
8
|
+
role_id: string;
|
|
9
|
+
role_name?: string;
|
|
10
|
+
workspace_id?: string;
|
|
11
|
+
workspace_name?: string;
|
|
12
|
+
created_at: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface EnsureMembershipRequest {
|
|
16
|
+
tenant_id?: string;
|
|
17
|
+
workspace_id?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class MembershipsModule {
|
|
21
|
+
private client: RawClient;
|
|
22
|
+
|
|
23
|
+
constructor(client: RawClient) {
|
|
24
|
+
this.client = client;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private headers() {
|
|
28
|
+
return {
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Ensure the current user has a membership in a tenant (self-provisioning).
|
|
35
|
+
*/
|
|
36
|
+
async ensure(body: EnsureMembershipRequest): Promise<APIResponse<MembershipResponse>> {
|
|
37
|
+
return this.client.POST<MembershipResponse>("/v1/api/memberships/ensure", {
|
|
38
|
+
body,
|
|
39
|
+
headers: this.headers(),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -86,4 +86,65 @@ export class WorkspacesModule {
|
|
|
86
86
|
headers: this.headers(),
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get workspace quotas.
|
|
92
|
+
*/
|
|
93
|
+
async getQuotas(workspaceId: string): Promise<APIResponse<WorkspaceQuotaResponse>> {
|
|
94
|
+
return this.client.GET<WorkspaceQuotaResponse>("/v1/api/workspaces/{workspaceId}/quotas", {
|
|
95
|
+
params: { path: { workspaceId } },
|
|
96
|
+
headers: this.headers(),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get workspace usage.
|
|
102
|
+
*/
|
|
103
|
+
async getUsage(workspaceId: string, params?: { from?: string; to?: string }): Promise<APIResponse<WorkspaceUsageResponse>> {
|
|
104
|
+
return this.client.GET<WorkspaceUsageResponse>("/v1/api/workspaces/{workspaceId}/usage", {
|
|
105
|
+
params: { path: { workspaceId }, query: params },
|
|
106
|
+
headers: this.headers(),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface WorkspaceQuotaResponse {
|
|
112
|
+
workspace_id: string;
|
|
113
|
+
quotas: {
|
|
114
|
+
runs_per_month: Quota;
|
|
115
|
+
tokens_per_month: Quota;
|
|
116
|
+
agents_max: Quota;
|
|
117
|
+
storage_mb: Quota;
|
|
118
|
+
};
|
|
119
|
+
reset_at: string;
|
|
120
|
+
source: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface Quota {
|
|
124
|
+
limit: number;
|
|
125
|
+
used: number;
|
|
126
|
+
remaining: number;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface WorkspaceUsageResponse {
|
|
130
|
+
workspace_id: string;
|
|
131
|
+
period: { from: string; to: string };
|
|
132
|
+
usage: {
|
|
133
|
+
total_runs: number;
|
|
134
|
+
completed_runs: number;
|
|
135
|
+
failed_runs: number;
|
|
136
|
+
total_tokens: number;
|
|
137
|
+
input_tokens: number;
|
|
138
|
+
output_tokens: number;
|
|
139
|
+
total_duration_ms: number;
|
|
140
|
+
estimated_count: number;
|
|
141
|
+
};
|
|
142
|
+
daily_breakdown: Array<{
|
|
143
|
+
date: string;
|
|
144
|
+
runs: number;
|
|
145
|
+
tokens_in: number;
|
|
146
|
+
tokens_out: number;
|
|
147
|
+
duration_ms: number;
|
|
148
|
+
}>;
|
|
149
|
+
source: string;
|
|
89
150
|
}
|