@agent-os-sdk/client 0.8.2 → 0.9.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/dist/client/AgentOsClient.d.ts +2 -0
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +3 -0
- package/dist/index.d.ts +19 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -5
- package/dist/modules/auth.d.ts +28 -0
- package/dist/modules/auth.d.ts.map +1 -0
- package/dist/modules/auth.js +22 -0
- package/dist/modules/me.d.ts +33 -2
- package/dist/modules/me.d.ts.map +1 -1
- package/dist/modules/me.js +11 -2
- package/package.json +50 -51
- package/src/client/AgentOsClient.ts +3 -0
- package/src/index.ts +32 -34
- package/src/modules/auth.ts +33 -0
- package/src/modules/me.ts +44 -2
|
@@ -40,6 +40,7 @@ import { ToolsModule } from "../modules/tools.js";
|
|
|
40
40
|
import { TriggersModule } from "../modules/triggers.js";
|
|
41
41
|
import { WorkspacesModule } from "../modules/workspaces.js";
|
|
42
42
|
import { A2aModule } from "../modules/a2a.js";
|
|
43
|
+
import { AuthModule } from "../modules/auth.js";
|
|
43
44
|
import { ApiTokensModule } from "../modules/apiTokens.js";
|
|
44
45
|
import { ApprovalsModule } from "../modules/approvals.js";
|
|
45
46
|
import { AuditModule } from "../modules/audit.js";
|
|
@@ -100,6 +101,7 @@ export declare class AgentOsClient {
|
|
|
100
101
|
readonly graphs: GraphsModule;
|
|
101
102
|
readonly catalog: CatalogModule;
|
|
102
103
|
readonly approvals: ApprovalsModule;
|
|
104
|
+
readonly auth: AuthModule;
|
|
103
105
|
readonly experiments: {
|
|
104
106
|
list: EvaluationModule["listExperiments"];
|
|
105
107
|
get: EvaluationModule["getExperiment"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentOsClient.d.ts","sourceRoot":"","sources":["../../src/client/AgentOsClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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Q,CAAC,WAAW,EAAE;QAClB,IAAI,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QAC1C,GAAG,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACvC,MAAM,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;KAChD,CAAC;IAEF,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,WAAW,EAAE,iBAAiB,CAAC;IAC/C,SAAgB,OAAO,EAAE,aAAa,CAAC;gBAI3B,OAAO,EAAE,oBAAoB;IAoEzC;;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"}
|
|
@@ -41,6 +41,7 @@ import { TriggersModule } from "../modules/triggers.js";
|
|
|
41
41
|
import { WorkspacesModule } from "../modules/workspaces.js";
|
|
42
42
|
// Platform modules
|
|
43
43
|
import { A2aModule } from "../modules/a2a.js";
|
|
44
|
+
import { AuthModule } from "../modules/auth.js";
|
|
44
45
|
import { ApiTokensModule } from "../modules/apiTokens.js";
|
|
45
46
|
import { ApprovalsModule } from "../modules/approvals.js";
|
|
46
47
|
import { AuditModule } from "../modules/audit.js";
|
|
@@ -103,6 +104,7 @@ export class AgentOsClient {
|
|
|
103
104
|
graphs;
|
|
104
105
|
catalog;
|
|
105
106
|
approvals;
|
|
107
|
+
auth;
|
|
106
108
|
// Convenience aliases
|
|
107
109
|
experiments;
|
|
108
110
|
apiTokens;
|
|
@@ -156,6 +158,7 @@ export class AgentOsClient {
|
|
|
156
158
|
this.graphs = new GraphsModule(this._client, getHeaders);
|
|
157
159
|
this.catalog = new CatalogModule(this._client);
|
|
158
160
|
this.approvals = new ApprovalsModule(this._client, getHeaders);
|
|
161
|
+
this.auth = new AuthModule(this._client, getHeaders);
|
|
159
162
|
// Initialize convenience aliases
|
|
160
163
|
this.experiments = {
|
|
161
164
|
list: this.evaluation.listExperiments.bind(this.evaluation),
|
package/dist/index.d.ts
CHANGED
|
@@ -28,21 +28,31 @@
|
|
|
28
28
|
* const { data } = await client.graphs.commit({...});
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export { createClient, type AgentOsClient as GeneratedClient, type
|
|
32
|
-
export type {
|
|
31
|
+
export { createClient, type ClientOptions, type AgentOsClient as GeneratedClient, type Schema } from "./generated/client.js";
|
|
32
|
+
export type { components, paths } from "./generated/openapi.js";
|
|
33
33
|
export { AgentOsClient } from "./client/AgentOsClient.js";
|
|
34
34
|
export type { AgentOsClientOptions, AuthProvider } from "./client/auth.js";
|
|
35
|
-
export { AgentOsError,
|
|
36
|
-
export
|
|
35
|
+
export { AgentOsError, ConflictError, ForbiddenError, NetworkError, NotFoundError, RateLimitError, ServerError, TimeoutError, UnauthorizedError, ValidationError, isAuthError, isRetryableError } from "./errors/index.js";
|
|
36
|
+
export { HttpRequestBuilder, httpRequestBuilder } from "./client/HttpRequestBuilder.js";
|
|
37
37
|
export { createOperationContext } from "./client/OperationContext.js";
|
|
38
|
+
export type { OperationContext } from "./client/OperationContext.js";
|
|
39
|
+
export { AsyncLocalStorageContextProvider, DefaultContextProvider, ManualContextProvider } from "./client/OperationContextProvider.js";
|
|
38
40
|
export type { OperationContextProvider } from "./client/OperationContextProvider.js";
|
|
39
|
-
export { DefaultContextProvider, AsyncLocalStorageContextProvider, ManualContextProvider, } from "./client/OperationContextProvider.js";
|
|
40
|
-
export { HttpRequestBuilder, httpRequestBuilder } from "./client/HttpRequestBuilder.js";
|
|
41
41
|
export { sanitizeHeader, sanitizeHeaders } from "./client/sanitize.js";
|
|
42
|
+
export { BACKGROUND_NETWORK_CONFIG, DEFAULT_NETWORK_CONFIG, INTERACTIVE_NETWORK_CONFIG, type NetworkConfig } from "./client/config.js";
|
|
43
|
+
export { collectAll, getFirst, paginate, type CursorPaginatedResponse, type OffsetPaginatedResponse, type PaginateOptions, type PaginatedResponse, type PaginationParams } from "./client/pagination.js";
|
|
42
44
|
export { withRetry } from "./client/retry.js";
|
|
43
45
|
export { withTimeout } from "./client/timeout.js";
|
|
44
|
-
export { DEFAULT_NETWORK_CONFIG, INTERACTIVE_NETWORK_CONFIG, BACKGROUND_NETWORK_CONFIG, type NetworkConfig, } from "./client/config.js";
|
|
45
|
-
export { paginate, collectAll, getFirst, type PaginatedResponse, type PaginationParams, type OffsetPaginatedResponse, type CursorPaginatedResponse, type PaginateOptions, } from "./client/pagination.js";
|
|
46
|
-
export type { SSEEvent, SSEOptions } from "./sse/client.js";
|
|
47
46
|
export type { APIResponse } from "./client/raw.js";
|
|
47
|
+
export type { SSEEvent, SSEOptions } from "./sse/client.js";
|
|
48
|
+
export * from "./modules/agents.js";
|
|
49
|
+
export * from "./modules/auth.js";
|
|
50
|
+
export * from "./modules/credentials.js";
|
|
51
|
+
export * from "./modules/me.js";
|
|
52
|
+
export * from "./modules/members.js";
|
|
53
|
+
export * from "./modules/presets.js";
|
|
54
|
+
export * from "./modules/prompts.js";
|
|
55
|
+
export * from "./modules/runs.js";
|
|
56
|
+
export * from "./modules/triggers.js";
|
|
57
|
+
export * from "./modules/workspaces.js";
|
|
48
58
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAOH,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAOH,OAAO,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,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM5D,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -40,15 +40,31 @@ export { AgentOsClient } from "./client/AgentOsClient.js";
|
|
|
40
40
|
// ============================================================
|
|
41
41
|
// Errors
|
|
42
42
|
// ============================================================
|
|
43
|
-
export { AgentOsError,
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
export { AgentOsError, ConflictError, ForbiddenError, NetworkError, NotFoundError, RateLimitError, ServerError, TimeoutError, UnauthorizedError, ValidationError, isAuthError, isRetryableError } from "./errors/index.js";
|
|
44
|
+
// ============================================================
|
|
45
|
+
// Auth Hardening (Pedra Sólida)
|
|
46
|
+
// ============================================================
|
|
46
47
|
export { HttpRequestBuilder, httpRequestBuilder } from "./client/HttpRequestBuilder.js";
|
|
48
|
+
export { createOperationContext } from "./client/OperationContext.js";
|
|
49
|
+
export { AsyncLocalStorageContextProvider, DefaultContextProvider, ManualContextProvider } from "./client/OperationContextProvider.js";
|
|
47
50
|
export { sanitizeHeader, sanitizeHeaders } from "./client/sanitize.js";
|
|
48
51
|
// ============================================================
|
|
49
52
|
// Utilities
|
|
50
53
|
// ============================================================
|
|
54
|
+
export { BACKGROUND_NETWORK_CONFIG, DEFAULT_NETWORK_CONFIG, INTERACTIVE_NETWORK_CONFIG } from "./client/config.js";
|
|
55
|
+
export { collectAll, getFirst, paginate } from "./client/pagination.js";
|
|
51
56
|
export { withRetry } from "./client/retry.js";
|
|
52
57
|
export { withTimeout } from "./client/timeout.js";
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
// ============================================================
|
|
59
|
+
// Modules
|
|
60
|
+
// ============================================================
|
|
61
|
+
export * from "./modules/agents.js";
|
|
62
|
+
export * from "./modules/auth.js";
|
|
63
|
+
export * from "./modules/credentials.js";
|
|
64
|
+
export * from "./modules/me.js";
|
|
65
|
+
export * from "./modules/members.js";
|
|
66
|
+
export * from "./modules/presets.js";
|
|
67
|
+
export * from "./modules/prompts.js";
|
|
68
|
+
export * from "./modules/runs.js";
|
|
69
|
+
export * from "./modules/triggers.js";
|
|
70
|
+
export * from "./modules/workspaces.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Module - Bootstrap & Identity
|
|
3
|
+
*/
|
|
4
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
5
|
+
export interface BootstrapResponse {
|
|
6
|
+
status: "existing" | "created";
|
|
7
|
+
tenant_id: string;
|
|
8
|
+
tenant_name?: string;
|
|
9
|
+
tenant_slug?: string;
|
|
10
|
+
workspace_id?: string;
|
|
11
|
+
workspace_name?: string;
|
|
12
|
+
workspace_slug?: string;
|
|
13
|
+
member_id: string;
|
|
14
|
+
role_name?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class AuthModule {
|
|
17
|
+
private client;
|
|
18
|
+
private headers;
|
|
19
|
+
constructor(client: RawClient, headers: () => Record<string, string>);
|
|
20
|
+
/**
|
|
21
|
+
* Bootstrap the authenticated user with a default tenant, workspace, and roles.
|
|
22
|
+
* Idempotent: returns existing resources if already provisioned.
|
|
23
|
+
*
|
|
24
|
+
* @returns 200 if already bootstrapped, 201 if newly created.
|
|
25
|
+
*/
|
|
26
|
+
bootstrap(): Promise<APIResponse<BootstrapResponse>>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/modules/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,UAAU;IACP,OAAO,CAAC,MAAM;IAAa,OAAO,CAAC,OAAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEpF;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;CAK7D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Module - Bootstrap & Identity
|
|
3
|
+
*/
|
|
4
|
+
export class AuthModule {
|
|
5
|
+
client;
|
|
6
|
+
headers;
|
|
7
|
+
constructor(client, headers) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
this.headers = headers;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Bootstrap the authenticated user with a default tenant, workspace, and roles.
|
|
13
|
+
* Idempotent: returns existing resources if already provisioned.
|
|
14
|
+
*
|
|
15
|
+
* @returns 200 if already bootstrapped, 201 if newly created.
|
|
16
|
+
*/
|
|
17
|
+
async bootstrap() {
|
|
18
|
+
return this.client.POST("/v1/api/auth/bootstrap", {
|
|
19
|
+
headers: this.headers(),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
package/dist/modules/me.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Me Module -
|
|
2
|
+
* Me Module - Identity & Context
|
|
3
3
|
*/
|
|
4
4
|
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
5
5
|
export interface MeResponse {
|
|
@@ -15,13 +15,44 @@ export interface MeResponse {
|
|
|
15
15
|
role: string;
|
|
16
16
|
}[];
|
|
17
17
|
}
|
|
18
|
+
export interface UserContextResponse {
|
|
19
|
+
user: {
|
|
20
|
+
id: string;
|
|
21
|
+
email: string;
|
|
22
|
+
};
|
|
23
|
+
memberships: MembershipContext[];
|
|
24
|
+
}
|
|
25
|
+
export interface MembershipContext {
|
|
26
|
+
member_id: string;
|
|
27
|
+
tenant: {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
slug: string;
|
|
31
|
+
};
|
|
32
|
+
role: {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
is_system: boolean;
|
|
36
|
+
permissions: string[];
|
|
37
|
+
};
|
|
38
|
+
workspaces: {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
slug: string;
|
|
42
|
+
}[];
|
|
43
|
+
}
|
|
18
44
|
export declare class MeModule {
|
|
19
45
|
private client;
|
|
20
46
|
private headers;
|
|
21
47
|
constructor(client: RawClient, headers: () => Record<string, string>);
|
|
22
48
|
/**
|
|
23
|
-
* Get current user information.
|
|
49
|
+
* Get current user information (lightweight, backward compatible).
|
|
24
50
|
*/
|
|
25
51
|
get(): Promise<APIResponse<MeResponse>>;
|
|
52
|
+
/**
|
|
53
|
+
* Get full user context: all tenants, workspaces, roles, and permissions.
|
|
54
|
+
* This is the canonical endpoint for populating frontend layouts.
|
|
55
|
+
*/
|
|
56
|
+
getContext(): Promise<APIResponse<UserContextResponse>>;
|
|
26
57
|
}
|
|
27
58
|
//# sourceMappingURL=me.d.ts.map
|
package/dist/modules/me.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/modules/me.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/modules/me.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/D,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE;QACT,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACP;AAID,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE;QACF,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,WAAW,EAAE,iBAAiB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,EAAE;QACF,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,OAAO,CAAC;QACnB,WAAW,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IACF,UAAU,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACP;AAED,qBAAa,QAAQ;IACL,OAAO,CAAC,MAAM;IAAa,OAAO,CAAC,OAAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEpF;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAM7C;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;CAKhE"}
|
package/dist/modules/me.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Me Module -
|
|
2
|
+
* Me Module - Identity & Context
|
|
3
3
|
*/
|
|
4
4
|
export class MeModule {
|
|
5
5
|
client;
|
|
@@ -9,11 +9,20 @@ export class MeModule {
|
|
|
9
9
|
this.headers = headers;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Get current user information.
|
|
12
|
+
* Get current user information (lightweight, backward compatible).
|
|
13
13
|
*/
|
|
14
14
|
async get() {
|
|
15
15
|
return this.client.GET("/v1/api/me", {
|
|
16
16
|
headers: this.headers(),
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Get full user context: all tenants, workspaces, roles, and permissions.
|
|
21
|
+
* This is the canonical endpoint for populating frontend layouts.
|
|
22
|
+
*/
|
|
23
|
+
async getContext() {
|
|
24
|
+
return this.client.GET("/v1/api/me/context", {
|
|
25
|
+
headers: this.headers(),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
19
28
|
}
|
package/package.json
CHANGED
|
@@ -1,53 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
]
|
|
2
|
+
"name": "@agent-os-sdk/client",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Official TypeScript SDK for Agent OS platform",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"agent-os",
|
|
17
|
+
"sdk",
|
|
18
|
+
"ai",
|
|
19
|
+
"agents",
|
|
20
|
+
"typescript"
|
|
21
|
+
],
|
|
22
|
+
"author": "Agent OS Team",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/yuri12344/agent-os.git"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"openapi-fetch": "^0.13.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^25.2.1",
|
|
36
|
+
"openapi-typescript": "^7.4.0",
|
|
37
|
+
"tsx": "^4.19.0",
|
|
38
|
+
"typescript": "^5.5.0",
|
|
39
|
+
"vitest": "^4.0.18"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"src"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"generate": "tsx scripts/generate.ts",
|
|
47
|
+
"build": "tsc",
|
|
48
|
+
"dev": "tsc --watch",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"typecheck": "tsc --noEmit"
|
|
51
|
+
}
|
|
53
52
|
}
|
|
@@ -50,6 +50,7 @@ import { WorkspacesModule } from "../modules/workspaces.js";
|
|
|
50
50
|
|
|
51
51
|
// Platform modules
|
|
52
52
|
import { A2aModule } from "../modules/a2a.js";
|
|
53
|
+
import { AuthModule } from "../modules/auth.js";
|
|
53
54
|
import { ApiTokensModule } from "../modules/apiTokens.js";
|
|
54
55
|
import { ApprovalsModule } from "../modules/approvals.js";
|
|
55
56
|
import { AuditModule } from "../modules/audit.js";
|
|
@@ -117,6 +118,7 @@ export class AgentOsClient {
|
|
|
117
118
|
readonly graphs: GraphsModule;
|
|
118
119
|
readonly catalog: CatalogModule;
|
|
119
120
|
readonly approvals: ApprovalsModule;
|
|
121
|
+
readonly auth: AuthModule;
|
|
120
122
|
|
|
121
123
|
// Convenience aliases
|
|
122
124
|
readonly experiments: {
|
|
@@ -184,6 +186,7 @@ export class AgentOsClient {
|
|
|
184
186
|
this.graphs = new GraphsModule(this._client, getHeaders);
|
|
185
187
|
this.catalog = new CatalogModule(this._client);
|
|
186
188
|
this.approvals = new ApprovalsModule(this._client, getHeaders);
|
|
189
|
+
this.auth = new AuthModule(this._client, getHeaders);
|
|
187
190
|
|
|
188
191
|
// Initialize convenience aliases
|
|
189
192
|
this.experiments = {
|
package/src/index.ts
CHANGED
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
// ============================================================
|
|
35
35
|
|
|
36
36
|
// Client + types - ALL schemas available via Schema<"Name">
|
|
37
|
-
export { createClient, type AgentOsClient as GeneratedClient, type
|
|
38
|
-
export type {
|
|
37
|
+
export { createClient, type ClientOptions, type AgentOsClient as GeneratedClient, type Schema } from "./generated/client.js";
|
|
38
|
+
export type { components, paths } from "./generated/openapi.js";
|
|
39
39
|
|
|
40
40
|
// ============================================================
|
|
41
41
|
// CUSTOM CLIENT (AgentOsClient with modules)
|
|
@@ -49,61 +49,59 @@ export type { AgentOsClientOptions, AuthProvider } from "./client/auth.js";
|
|
|
49
49
|
// ============================================================
|
|
50
50
|
|
|
51
51
|
export {
|
|
52
|
-
AgentOsError,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
ValidationError,
|
|
56
|
-
UnauthorizedError,
|
|
57
|
-
ForbiddenError,
|
|
58
|
-
NotFoundError,
|
|
59
|
-
ConflictError,
|
|
60
|
-
RateLimitError,
|
|
61
|
-
ServerError,
|
|
62
|
-
isAuthError,
|
|
63
|
-
isRetryableError,
|
|
52
|
+
AgentOsError, ConflictError, ForbiddenError, NetworkError, NotFoundError, RateLimitError,
|
|
53
|
+
ServerError, TimeoutError, UnauthorizedError, ValidationError, isAuthError,
|
|
54
|
+
isRetryableError
|
|
64
55
|
} from "./errors/index.js";
|
|
65
56
|
|
|
66
57
|
// ============================================================
|
|
67
58
|
// Auth Hardening (Pedra Sólida)
|
|
68
59
|
// ============================================================
|
|
69
60
|
|
|
70
|
-
export
|
|
61
|
+
export { HttpRequestBuilder, httpRequestBuilder } from "./client/HttpRequestBuilder.js";
|
|
71
62
|
export { createOperationContext } from "./client/OperationContext.js";
|
|
72
|
-
export type {
|
|
63
|
+
export type { OperationContext } from "./client/OperationContext.js";
|
|
73
64
|
export {
|
|
74
|
-
DefaultContextProvider,
|
|
75
|
-
AsyncLocalStorageContextProvider,
|
|
76
|
-
ManualContextProvider,
|
|
65
|
+
AsyncLocalStorageContextProvider, DefaultContextProvider, ManualContextProvider
|
|
77
66
|
} from "./client/OperationContextProvider.js";
|
|
78
|
-
export {
|
|
67
|
+
export type { OperationContextProvider } from "./client/OperationContextProvider.js";
|
|
79
68
|
export { sanitizeHeader, sanitizeHeaders } from "./client/sanitize.js";
|
|
80
69
|
|
|
81
70
|
// ============================================================
|
|
82
71
|
// Utilities
|
|
83
72
|
// ============================================================
|
|
84
73
|
|
|
85
|
-
export { withRetry } from "./client/retry.js";
|
|
86
|
-
export { withTimeout } from "./client/timeout.js";
|
|
87
74
|
export {
|
|
88
|
-
DEFAULT_NETWORK_CONFIG,
|
|
89
|
-
INTERACTIVE_NETWORK_CONFIG,
|
|
90
|
-
BACKGROUND_NETWORK_CONFIG,
|
|
91
|
-
type NetworkConfig,
|
|
75
|
+
BACKGROUND_NETWORK_CONFIG, DEFAULT_NETWORK_CONFIG,
|
|
76
|
+
INTERACTIVE_NETWORK_CONFIG, type NetworkConfig
|
|
92
77
|
} from "./client/config.js";
|
|
93
78
|
export {
|
|
94
|
-
paginate,
|
|
95
79
|
collectAll,
|
|
96
|
-
getFirst,
|
|
97
|
-
type
|
|
98
|
-
type PaginationParams,
|
|
99
|
-
type OffsetPaginatedResponse,
|
|
100
|
-
type CursorPaginatedResponse,
|
|
101
|
-
type PaginateOptions,
|
|
80
|
+
getFirst, paginate, type CursorPaginatedResponse, type OffsetPaginatedResponse, type PaginateOptions, type PaginatedResponse,
|
|
81
|
+
type PaginationParams
|
|
102
82
|
} from "./client/pagination.js";
|
|
83
|
+
export { withRetry } from "./client/retry.js";
|
|
84
|
+
export { withTimeout } from "./client/timeout.js";
|
|
103
85
|
|
|
104
86
|
// ============================================================
|
|
105
87
|
// SSE
|
|
106
88
|
// ============================================================
|
|
107
89
|
|
|
108
|
-
export type { SSEEvent, SSEOptions } from "./sse/client.js";
|
|
109
90
|
export type { APIResponse } from "./client/raw.js";
|
|
91
|
+
export type { SSEEvent, SSEOptions } from "./sse/client.js";
|
|
92
|
+
|
|
93
|
+
// ============================================================
|
|
94
|
+
// Modules
|
|
95
|
+
// ============================================================
|
|
96
|
+
|
|
97
|
+
export * from "./modules/agents.js";
|
|
98
|
+
export * from "./modules/auth.js";
|
|
99
|
+
export * from "./modules/credentials.js";
|
|
100
|
+
export * from "./modules/me.js";
|
|
101
|
+
export * from "./modules/members.js";
|
|
102
|
+
export * from "./modules/presets.js";
|
|
103
|
+
export * from "./modules/prompts.js";
|
|
104
|
+
export * from "./modules/runs.js";
|
|
105
|
+
export * from "./modules/triggers.js";
|
|
106
|
+
export * from "./modules/workspaces.js";
|
|
107
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Module - Bootstrap & Identity
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
6
|
+
|
|
7
|
+
export interface BootstrapResponse {
|
|
8
|
+
status: "existing" | "created";
|
|
9
|
+
tenant_id: string;
|
|
10
|
+
tenant_name?: string;
|
|
11
|
+
tenant_slug?: string;
|
|
12
|
+
workspace_id?: string;
|
|
13
|
+
workspace_name?: string;
|
|
14
|
+
workspace_slug?: string;
|
|
15
|
+
member_id: string;
|
|
16
|
+
role_name?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class AuthModule {
|
|
20
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Bootstrap the authenticated user with a default tenant, workspace, and roles.
|
|
24
|
+
* Idempotent: returns existing resources if already provisioned.
|
|
25
|
+
*
|
|
26
|
+
* @returns 200 if already bootstrapped, 201 if newly created.
|
|
27
|
+
*/
|
|
28
|
+
async bootstrap(): Promise<APIResponse<BootstrapResponse>> {
|
|
29
|
+
return this.client.POST<BootstrapResponse>("/v1/api/auth/bootstrap", {
|
|
30
|
+
headers: this.headers(),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/modules/me.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Me Module -
|
|
2
|
+
* Me Module - Identity & Context
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
6
6
|
|
|
7
|
+
// ── Lightweight identity (GET /me) ──────────────────────────────
|
|
8
|
+
|
|
7
9
|
export interface MeResponse {
|
|
8
10
|
user_id: string;
|
|
9
11
|
email: string;
|
|
@@ -18,15 +20,55 @@ export interface MeResponse {
|
|
|
18
20
|
}[];
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
// ── Full context (GET /me/context) ──────────────────────────────
|
|
24
|
+
|
|
25
|
+
export interface UserContextResponse {
|
|
26
|
+
user: {
|
|
27
|
+
id: string;
|
|
28
|
+
email: string;
|
|
29
|
+
};
|
|
30
|
+
memberships: MembershipContext[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface MembershipContext {
|
|
34
|
+
member_id: string;
|
|
35
|
+
tenant: {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
slug: string;
|
|
39
|
+
};
|
|
40
|
+
role: {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
is_system: boolean;
|
|
44
|
+
permissions: string[];
|
|
45
|
+
};
|
|
46
|
+
workspaces: {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
slug: string;
|
|
50
|
+
}[];
|
|
51
|
+
}
|
|
52
|
+
|
|
21
53
|
export class MeModule {
|
|
22
54
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
23
55
|
|
|
24
56
|
/**
|
|
25
|
-
* Get current user information.
|
|
57
|
+
* Get current user information (lightweight, backward compatible).
|
|
26
58
|
*/
|
|
27
59
|
async get(): Promise<APIResponse<MeResponse>> {
|
|
28
60
|
return this.client.GET<MeResponse>("/v1/api/me", {
|
|
29
61
|
headers: this.headers(),
|
|
30
62
|
});
|
|
31
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get full user context: all tenants, workspaces, roles, and permissions.
|
|
67
|
+
* This is the canonical endpoint for populating frontend layouts.
|
|
68
|
+
*/
|
|
69
|
+
async getContext(): Promise<APIResponse<UserContextResponse>> {
|
|
70
|
+
return this.client.GET<UserContextResponse>("/v1/api/me/context", {
|
|
71
|
+
headers: this.headers(),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
32
74
|
}
|