@agent-os-sdk/client 0.2.2 → 0.3.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 +19 -53
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +59 -175
- package/dist/client/auth.d.ts +15 -27
- package/dist/client/auth.d.ts.map +1 -1
- package/dist/client/auth.js +2 -8
- package/dist/client/raw.d.ts +1 -0
- package/dist/client/raw.d.ts.map +1 -1
- package/dist/client/raw.js +4 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/approvals.d.ts +50 -39
- package/dist/modules/approvals.d.ts.map +1 -1
- package/dist/modules/approvals.js +71 -34
- package/package.json +50 -49
- package/src/client/AgentOsClient.ts +66 -184
- package/src/client/auth.ts +15 -38
- package/src/client/raw.ts +7 -1
- package/src/index.ts +2 -3
- package/src/modules/approvals.ts +106 -64
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Agent OS SDK - Main Client
|
|
3
3
|
*
|
|
4
4
|
* Fully typed API client for Agent OS platform.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* Two authentication modes:
|
|
7
|
+
* - API Token (server-to-server): aosk_* tokens with embedded claims
|
|
8
|
+
* - JWT (browser): Supabase JWT + X-Workspace-Id header
|
|
6
9
|
*
|
|
7
10
|
* @example
|
|
8
11
|
* ```ts
|
|
@@ -17,14 +20,14 @@
|
|
|
17
20
|
* baseUrl: "https://api.agentos.io",
|
|
18
21
|
* auth: {
|
|
19
22
|
* type: "jwt",
|
|
20
|
-
* getToken: () => supabase.auth.getSession().then(s => s.data.session?.access_token),
|
|
21
|
-
* getWorkspaceId: () => localStorage.getItem("agentos.workspaceId")
|
|
23
|
+
* getToken: () => supabase.auth.getSession().then(s => s.data.session?.access_token ?? ""),
|
|
24
|
+
* getWorkspaceId: () => localStorage.getItem("agentos.workspaceId") ?? ""
|
|
22
25
|
* }
|
|
23
26
|
* });
|
|
24
27
|
* ```
|
|
25
28
|
*/
|
|
26
29
|
import { type RawClient } from "./raw.js";
|
|
27
|
-
import { type AgentOsClientOptions
|
|
30
|
+
import { type AgentOsClientOptions } from "./auth.js";
|
|
28
31
|
import { AgentsModule } from "../modules/agents.js";
|
|
29
32
|
import { RunsModule } from "../modules/runs.js";
|
|
30
33
|
import { ThreadsModule } from "../modules/threads.js";
|
|
@@ -63,74 +66,41 @@ import { BudgetsModule } from "../modules/budgets.js";
|
|
|
63
66
|
import { DeploymentsModule } from "../modules/deployments.js";
|
|
64
67
|
import { IncidentsModule } from "../modules/incidents.js";
|
|
65
68
|
import { ArtifactsModule } from "../modules/artifacts.js";
|
|
66
|
-
export type { AgentOsClientOptions,
|
|
67
|
-
export { isApiTokenAuth, isJwtAuth
|
|
69
|
+
export type { AgentOsClientOptions, AuthProvider } from "./auth.js";
|
|
70
|
+
export { isApiTokenAuth, isJwtAuth } from "./auth.js";
|
|
68
71
|
export declare class AgentOsClient {
|
|
69
72
|
private readonly _client;
|
|
70
73
|
private readonly _baseUrl;
|
|
71
74
|
private readonly _auth;
|
|
72
75
|
private readonly _customHeaders;
|
|
73
|
-
private readonly _tenantId?;
|
|
74
|
-
private readonly _workspaceId?;
|
|
75
|
-
private readonly _token?;
|
|
76
|
-
private readonly _memberId?;
|
|
77
|
-
/** Agents API: CRUD, versions, graph */
|
|
78
76
|
readonly agents: AgentsModule;
|
|
79
|
-
/** Runs API: create, stream, cancel, resume, replay */
|
|
80
77
|
readonly runs: RunsModule;
|
|
81
|
-
/** Threads API: conversations, state, messages */
|
|
82
78
|
readonly threads: ThreadsModule;
|
|
83
|
-
/** Tools API: definitions, registry */
|
|
84
79
|
readonly tools: ToolsModule;
|
|
85
|
-
/** Knowledge API: vector stores, RAG */
|
|
86
80
|
readonly knowledge: KnowledgeModule;
|
|
87
|
-
/** Triggers API: webhooks, crons */
|
|
88
81
|
readonly triggers: TriggersModule;
|
|
89
|
-
/** Credentials API: BYOK secrets */
|
|
90
82
|
readonly credentials: CredentialsModule;
|
|
91
|
-
/** Builder API: Meta-agent for AI-assisted agent creation */
|
|
92
83
|
readonly builder: BuilderModule;
|
|
93
|
-
/** Members API: Tenant member management */
|
|
94
84
|
readonly members: MembersModule;
|
|
95
|
-
/** Tenants API: Tenant settings */
|
|
96
85
|
readonly tenants: TenantsModule;
|
|
97
|
-
/** Workspaces API: Workspace management */
|
|
98
86
|
readonly workspaces: WorkspacesModule;
|
|
99
|
-
/** Prompts API: Prompt Hub CMS */
|
|
100
87
|
readonly prompts: PromptsModule;
|
|
101
|
-
/** Traces API: OTEL observability */
|
|
102
88
|
readonly traces: TracesModule;
|
|
103
|
-
/** Files API: S3 file storage */
|
|
104
89
|
readonly files: FilesModule;
|
|
105
|
-
/** VectorStores API: pgvector semantic search */
|
|
106
90
|
readonly vectorStores: VectorStoresModule;
|
|
107
|
-
/** Evaluation API: Datasets & experiments */
|
|
108
91
|
readonly evaluation: EvaluationModule;
|
|
109
|
-
/** Checkpoints API: Time-travel debugging */
|
|
110
92
|
readonly checkpoints: CheckpointsModule;
|
|
111
|
-
/** Playground API: Ephemeral sandbox */
|
|
112
93
|
readonly playground: PlaygroundModule;
|
|
113
|
-
/** Crons API: Cron job scheduling */
|
|
114
94
|
readonly crons: CronsModule;
|
|
115
|
-
/** DLQ API: Dead letter queue */
|
|
116
95
|
readonly dlq: DlqModule;
|
|
117
|
-
/** Store API: Key-value storage */
|
|
118
96
|
readonly store: StoreModule;
|
|
119
|
-
/** Audit API: Audit logs */
|
|
120
97
|
readonly audit: AuditModule;
|
|
121
|
-
/** Usage API: Quotas and usage */
|
|
122
98
|
readonly usage: UsageModule;
|
|
123
|
-
/** MCP API: Model Context Protocol */
|
|
124
99
|
readonly mcp: McpModule;
|
|
125
|
-
/** A2A API: Agent-to-Agent protocol */
|
|
126
100
|
readonly a2a: A2aModule;
|
|
127
|
-
/** Me API: Current user identity */
|
|
128
101
|
readonly me: MeModule;
|
|
129
|
-
/** Info API: Server information */
|
|
130
102
|
readonly info: InfoModule;
|
|
131
|
-
/** Metrics API: Prometheus metrics */
|
|
132
103
|
readonly metrics: MetricsModule;
|
|
133
|
-
/** Graphs API: Validation and introspection */
|
|
134
104
|
readonly graphs: GraphsModule;
|
|
135
105
|
readonly handoff: HandoffModule;
|
|
136
106
|
readonly flows: FlowsModule;
|
|
@@ -151,29 +121,25 @@ export declare class AgentOsClient {
|
|
|
151
121
|
get: (agentId: string, versionId: string) => ReturnType<AgentsModule["getVersion"]>;
|
|
152
122
|
create: (agentId: string, body: Parameters<AgentsModule["createVersion"]>[1]) => ReturnType<AgentsModule["createVersion"]>;
|
|
153
123
|
};
|
|
154
|
-
constructor(options: AgentOsClientOptions
|
|
124
|
+
constructor(options: AgentOsClientOptions);
|
|
155
125
|
/**
|
|
156
|
-
* Validate auth configuration
|
|
126
|
+
* Validate auth configuration at construction time
|
|
157
127
|
*/
|
|
158
128
|
private _validateAuth;
|
|
159
129
|
/**
|
|
160
|
-
*
|
|
130
|
+
* Resolve headers for each request (async)
|
|
131
|
+
*
|
|
132
|
+
* SECURITY INVARIANTS:
|
|
133
|
+
* - JWT: Authorization + X-Workspace-Id (REQUIRED), NO X-Tenant-Id
|
|
134
|
+
* - API Token: Authorization only, NO X-Workspace-Id, NO X-Tenant-Id
|
|
161
135
|
*/
|
|
162
|
-
private
|
|
136
|
+
private _resolveHeaders;
|
|
163
137
|
/**
|
|
164
|
-
* Get headers for
|
|
138
|
+
* Get resolved headers (for debugging/testing)
|
|
165
139
|
*/
|
|
166
140
|
getHeadersAsync(): Promise<Record<string, string>>;
|
|
167
|
-
/**
|
|
168
|
-
* Get workspace ID synchronously (for modules that need it)
|
|
169
|
-
*/
|
|
170
|
-
private _getWorkspaceIdSync;
|
|
171
|
-
/** Current tenant ID (legacy) */
|
|
172
|
-
get tenantId(): string;
|
|
173
|
-
/** Current workspace ID (legacy) */
|
|
174
|
-
get workspaceId(): string;
|
|
175
141
|
/** Auth provider type */
|
|
176
|
-
get authType(): "api_token" | "jwt"
|
|
142
|
+
get authType(): "api_token" | "jwt";
|
|
177
143
|
/** Raw HTTP client (use modules instead) */
|
|
178
144
|
get raw(): RawClient;
|
|
179
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentOsClient.d.ts","sourceRoot":"","sources":["../../src/client/AgentOsClient.ts"],"names":[],"mappings":"AAAA
|
|
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,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,M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AAY,CAAC,CAAC,CAAC;QACpF,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC;KAC9H,CAAC;gBAEU,OAAO,EAAE,oBAAoB;IA6EzC;;OAEG;IACH,OAAO,CAAC,aAAa;IAYrB;;;;;;OAMG;YACW,eAAe;IA2C7B;;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"}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Agent OS SDK - Main Client
|
|
3
3
|
*
|
|
4
4
|
* Fully typed API client for Agent OS platform.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* Two authentication modes:
|
|
7
|
+
* - API Token (server-to-server): aosk_* tokens with embedded claims
|
|
8
|
+
* - JWT (browser): Supabase JWT + X-Workspace-Id header
|
|
6
9
|
*
|
|
7
10
|
* @example
|
|
8
11
|
* ```ts
|
|
@@ -17,14 +20,14 @@
|
|
|
17
20
|
* baseUrl: "https://api.agentos.io",
|
|
18
21
|
* auth: {
|
|
19
22
|
* type: "jwt",
|
|
20
|
-
* getToken: () => supabase.auth.getSession().then(s => s.data.session?.access_token),
|
|
21
|
-
* getWorkspaceId: () => localStorage.getItem("agentos.workspaceId")
|
|
23
|
+
* getToken: () => supabase.auth.getSession().then(s => s.data.session?.access_token ?? ""),
|
|
24
|
+
* getWorkspaceId: () => localStorage.getItem("agentos.workspaceId") ?? ""
|
|
22
25
|
* }
|
|
23
26
|
* });
|
|
24
27
|
* ```
|
|
25
28
|
*/
|
|
26
29
|
import { createRawClient } from "./raw.js";
|
|
27
|
-
import {
|
|
30
|
+
import { isApiTokenAuth, isJwtAuth, isBrowser, } from "./auth.js";
|
|
28
31
|
import { AgentsModule } from "../modules/agents.js";
|
|
29
32
|
import { RunsModule } from "../modules/runs.js";
|
|
30
33
|
import { ThreadsModule } from "../modules/threads.js";
|
|
@@ -36,7 +39,7 @@ import { BuilderModule } from "../modules/builder.js";
|
|
|
36
39
|
import { MembersModule } from "../modules/members.js";
|
|
37
40
|
import { TenantsModule } from "../modules/tenants.js";
|
|
38
41
|
import { WorkspacesModule } from "../modules/workspaces.js";
|
|
39
|
-
//
|
|
42
|
+
// Platform modules
|
|
40
43
|
import { PromptsModule } from "../modules/prompts.js";
|
|
41
44
|
import { TracesModule } from "../modules/traces.js";
|
|
42
45
|
import { FilesModule } from "../modules/files.js";
|
|
@@ -55,7 +58,7 @@ import { MeModule } from "../modules/me.js";
|
|
|
55
58
|
import { InfoModule } from "../modules/info.js";
|
|
56
59
|
import { MetricsModule } from "../modules/metrics.js";
|
|
57
60
|
import { GraphsModule } from "../modules/graphs.js";
|
|
58
|
-
//
|
|
61
|
+
// Future modules (mocked)
|
|
59
62
|
import { HandoffModule } from "../modules/handoff.js";
|
|
60
63
|
import { FlowsModule } from "../modules/flows.js";
|
|
61
64
|
import { CapabilitiesModule } from "../modules/capabilities.js";
|
|
@@ -65,78 +68,44 @@ import { BudgetsModule } from "../modules/budgets.js";
|
|
|
65
68
|
import { DeploymentsModule } from "../modules/deployments.js";
|
|
66
69
|
import { IncidentsModule } from "../modules/incidents.js";
|
|
67
70
|
import { ArtifactsModule } from "../modules/artifacts.js";
|
|
68
|
-
export { isApiTokenAuth, isJwtAuth
|
|
71
|
+
export { isApiTokenAuth, isJwtAuth } from "./auth.js";
|
|
69
72
|
export class AgentOsClient {
|
|
70
73
|
_client;
|
|
71
74
|
_baseUrl;
|
|
72
75
|
_auth;
|
|
73
76
|
_customHeaders;
|
|
74
|
-
// Legacy fields (for backwards compat)
|
|
75
|
-
_tenantId;
|
|
76
|
-
_workspaceId;
|
|
77
|
-
_token;
|
|
78
|
-
_memberId;
|
|
79
77
|
// Core modules
|
|
80
|
-
/** Agents API: CRUD, versions, graph */
|
|
81
78
|
agents;
|
|
82
|
-
/** Runs API: create, stream, cancel, resume, replay */
|
|
83
79
|
runs;
|
|
84
|
-
/** Threads API: conversations, state, messages */
|
|
85
80
|
threads;
|
|
86
|
-
/** Tools API: definitions, registry */
|
|
87
81
|
tools;
|
|
88
|
-
/** Knowledge API: vector stores, RAG */
|
|
89
82
|
knowledge;
|
|
90
|
-
/** Triggers API: webhooks, crons */
|
|
91
83
|
triggers;
|
|
92
|
-
/** Credentials API: BYOK secrets */
|
|
93
84
|
credentials;
|
|
94
|
-
/** Builder API: Meta-agent for AI-assisted agent creation */
|
|
95
85
|
builder;
|
|
96
|
-
/** Members API: Tenant member management */
|
|
97
86
|
members;
|
|
98
|
-
/** Tenants API: Tenant settings */
|
|
99
87
|
tenants;
|
|
100
|
-
/** Workspaces API: Workspace management */
|
|
101
88
|
workspaces;
|
|
102
|
-
//
|
|
103
|
-
/** Prompts API: Prompt Hub CMS */
|
|
89
|
+
// Platform modules
|
|
104
90
|
prompts;
|
|
105
|
-
/** Traces API: OTEL observability */
|
|
106
91
|
traces;
|
|
107
|
-
/** Files API: S3 file storage */
|
|
108
92
|
files;
|
|
109
|
-
/** VectorStores API: pgvector semantic search */
|
|
110
93
|
vectorStores;
|
|
111
|
-
/** Evaluation API: Datasets & experiments */
|
|
112
94
|
evaluation;
|
|
113
|
-
/** Checkpoints API: Time-travel debugging */
|
|
114
95
|
checkpoints;
|
|
115
|
-
/** Playground API: Ephemeral sandbox */
|
|
116
96
|
playground;
|
|
117
|
-
/** Crons API: Cron job scheduling */
|
|
118
97
|
crons;
|
|
119
|
-
/** DLQ API: Dead letter queue */
|
|
120
98
|
dlq;
|
|
121
|
-
/** Store API: Key-value storage */
|
|
122
99
|
store;
|
|
123
|
-
/** Audit API: Audit logs */
|
|
124
100
|
audit;
|
|
125
|
-
/** Usage API: Quotas and usage */
|
|
126
101
|
usage;
|
|
127
|
-
/** MCP API: Model Context Protocol */
|
|
128
102
|
mcp;
|
|
129
|
-
/** A2A API: Agent-to-Agent protocol */
|
|
130
103
|
a2a;
|
|
131
|
-
/** Me API: Current user identity */
|
|
132
104
|
me;
|
|
133
|
-
/** Info API: Server information */
|
|
134
105
|
info;
|
|
135
|
-
/** Metrics API: Prometheus metrics */
|
|
136
106
|
metrics;
|
|
137
|
-
/** Graphs API: Validation and introspection */
|
|
138
107
|
graphs;
|
|
139
|
-
//
|
|
108
|
+
// Future modules (mocked)
|
|
140
109
|
handoff;
|
|
141
110
|
flows;
|
|
142
111
|
capabilities;
|
|
@@ -146,45 +115,24 @@ export class AgentOsClient {
|
|
|
146
115
|
deployments;
|
|
147
116
|
incidents;
|
|
148
117
|
artifacts;
|
|
149
|
-
// Convenience
|
|
118
|
+
// Convenience aliases
|
|
150
119
|
experiments;
|
|
151
120
|
agentVersions;
|
|
152
121
|
constructor(options) {
|
|
153
122
|
this._baseUrl = options.baseUrl;
|
|
123
|
+
this._auth = options.auth;
|
|
154
124
|
this._customHeaders = options.headers ?? {};
|
|
155
|
-
//
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this._auth = options.auth;
|
|
159
|
-
this._validateAuth(options);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
// Legacy mode - convert to new auth if possible
|
|
163
|
-
this._tenantId = options.tenantId;
|
|
164
|
-
this._workspaceId = options.workspaceId;
|
|
165
|
-
this._token = options.token;
|
|
166
|
-
this._memberId = options.memberId;
|
|
167
|
-
// Attempt to detect auth type from token
|
|
168
|
-
if (options.token && isApiToken(options.token)) {
|
|
169
|
-
// Token looks like API token - use as api_token
|
|
170
|
-
this._auth = { type: "api_token", apiKey: options.token };
|
|
171
|
-
console.warn("[AgentOS SDK] Using legacy options with API token. " +
|
|
172
|
-
"Consider migrating to: new AgentOsClient({ auth: { type: 'api_token', apiKey: '...' } })");
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
// Legacy JWT mode - keep using headers
|
|
176
|
-
this._auth = null;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Create raw HTTP client
|
|
125
|
+
// Validate auth configuration
|
|
126
|
+
this._validateAuth(options);
|
|
127
|
+
// Create raw client with async header provider
|
|
180
128
|
this._client = createRawClient({
|
|
181
129
|
baseUrl: options.baseUrl,
|
|
182
|
-
|
|
130
|
+
headerProvider: () => this._resolveHeaders(),
|
|
183
131
|
});
|
|
184
|
-
//
|
|
185
|
-
const getHeaders = () => this.
|
|
186
|
-
const getWorkspaceId = () =>
|
|
187
|
-
const getTenantId = () =>
|
|
132
|
+
// Module header getter (sync fallback for backwards compat with module internals)
|
|
133
|
+
const getHeaders = () => this._customHeaders;
|
|
134
|
+
const getWorkspaceId = () => "";
|
|
135
|
+
const getTenantId = () => "";
|
|
188
136
|
// Initialize core modules
|
|
189
137
|
this.agents = new AgentsModule(this._client, getHeaders);
|
|
190
138
|
this.runs = new RunsModule(this._client, this._baseUrl, getHeaders);
|
|
@@ -197,7 +145,7 @@ export class AgentOsClient {
|
|
|
197
145
|
this.members = new MembersModule(this._client, getHeaders);
|
|
198
146
|
this.tenants = new TenantsModule(this._client, getHeaders);
|
|
199
147
|
this.workspaces = new WorkspacesModule(this._client, getTenantId, getHeaders);
|
|
200
|
-
// Initialize
|
|
148
|
+
// Initialize platform modules
|
|
201
149
|
this.prompts = new PromptsModule(this._client, getHeaders);
|
|
202
150
|
this.traces = new TracesModule(this._client, getHeaders);
|
|
203
151
|
this.files = new FilesModule(this._client, getHeaders);
|
|
@@ -216,7 +164,7 @@ export class AgentOsClient {
|
|
|
216
164
|
this.info = new InfoModule(this._client, getHeaders);
|
|
217
165
|
this.metrics = new MetricsModule(this._baseUrl, getHeaders);
|
|
218
166
|
this.graphs = new GraphsModule(this._client, getHeaders);
|
|
219
|
-
//
|
|
167
|
+
// Initialize future modules (mocked)
|
|
220
168
|
this.handoff = new HandoffModule(this._client, getHeaders);
|
|
221
169
|
this.flows = new FlowsModule(this._client, getHeaders);
|
|
222
170
|
this.capabilities = new CapabilitiesModule(this._client, getHeaders);
|
|
@@ -239,130 +187,66 @@ export class AgentOsClient {
|
|
|
239
187
|
};
|
|
240
188
|
}
|
|
241
189
|
/**
|
|
242
|
-
* Validate auth configuration
|
|
190
|
+
* Validate auth configuration at construction time
|
|
243
191
|
*/
|
|
244
192
|
_validateAuth(options) {
|
|
245
193
|
const { auth, allowApiTokenInBrowser } = options;
|
|
246
|
-
// Browser guard for API tokens
|
|
194
|
+
// Browser security guard for API tokens
|
|
247
195
|
if (isApiTokenAuth(auth) && isBrowser() && !allowApiTokenInBrowser) {
|
|
248
|
-
throw new Error("[AgentOS SDK] API tokens
|
|
249
|
-
"
|
|
250
|
-
"Use JWT auth for browser clients, or set allowApiTokenInBrowser: true if you understand the risks.");
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Get headers for current request (sync version for modules)
|
|
255
|
-
*/
|
|
256
|
-
_getHeaders() {
|
|
257
|
-
const headers = {
|
|
258
|
-
"Content-Type": "application/json",
|
|
259
|
-
...this._customHeaders,
|
|
260
|
-
};
|
|
261
|
-
if (this._auth) {
|
|
262
|
-
// New auth mode
|
|
263
|
-
if (isApiTokenAuth(this._auth)) {
|
|
264
|
-
// API Token: Only Authorization header
|
|
265
|
-
const apiKey = typeof this._auth.apiKey === "function"
|
|
266
|
-
? "" // Will be resolved async
|
|
267
|
-
: this._auth.apiKey;
|
|
268
|
-
if (apiKey) {
|
|
269
|
-
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
270
|
-
}
|
|
271
|
-
// NO X-Tenant-Id, NO X-Workspace-Id (backend resolves from claims)
|
|
272
|
-
}
|
|
273
|
-
else if (isJwtAuth(this._auth)) {
|
|
274
|
-
// JWT: Authorization + X-Workspace-Id
|
|
275
|
-
// Note: For sync header getter, we use empty strings as placeholders
|
|
276
|
-
// The actual values are resolved in _getHeadersAsync
|
|
277
|
-
// This is a limitation of the current module architecture
|
|
278
|
-
}
|
|
196
|
+
throw new Error("[AgentOS SDK] SECURITY: API tokens (aosk_*) are SERVER-SIDE only. " +
|
|
197
|
+
"Use JWT auth in the browser. Set allowApiTokenInBrowser: true only if you understand the risks.");
|
|
279
198
|
}
|
|
280
|
-
else {
|
|
281
|
-
// Legacy mode - use stored values
|
|
282
|
-
if (this._token) {
|
|
283
|
-
headers["Authorization"] = `Bearer ${this._token}`;
|
|
284
|
-
}
|
|
285
|
-
if (this._tenantId) {
|
|
286
|
-
headers["X-Tenant-Id"] = this._tenantId;
|
|
287
|
-
}
|
|
288
|
-
if (this._workspaceId) {
|
|
289
|
-
headers["X-Workspace-Id"] = this._workspaceId;
|
|
290
|
-
}
|
|
291
|
-
if (this._memberId) {
|
|
292
|
-
headers["X-Member-Id"] = this._memberId;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return headers;
|
|
296
199
|
}
|
|
297
200
|
/**
|
|
298
|
-
*
|
|
201
|
+
* Resolve headers for each request (async)
|
|
202
|
+
*
|
|
203
|
+
* SECURITY INVARIANTS:
|
|
204
|
+
* - JWT: Authorization + X-Workspace-Id (REQUIRED), NO X-Tenant-Id
|
|
205
|
+
* - API Token: Authorization only, NO X-Workspace-Id, NO X-Tenant-Id
|
|
299
206
|
*/
|
|
300
|
-
async
|
|
207
|
+
async _resolveHeaders() {
|
|
301
208
|
const headers = {
|
|
302
209
|
"Content-Type": "application/json",
|
|
303
210
|
...this._customHeaders,
|
|
304
211
|
};
|
|
305
|
-
if (this._auth) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
212
|
+
if (isApiTokenAuth(this._auth)) {
|
|
213
|
+
// API Token: Authorization header only
|
|
214
|
+
const apiKey = typeof this._auth.apiKey === "function"
|
|
215
|
+
? await this._auth.apiKey()
|
|
216
|
+
: this._auth.apiKey;
|
|
217
|
+
if (apiKey) {
|
|
311
218
|
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
312
|
-
// NO X-Tenant-Id, NO X-Workspace-Id
|
|
313
|
-
}
|
|
314
|
-
else if (isJwtAuth(this._auth)) {
|
|
315
|
-
// JWT
|
|
316
|
-
const [token, workspaceId] = await Promise.all([
|
|
317
|
-
this._auth.getToken(),
|
|
318
|
-
this._auth.getWorkspaceId(),
|
|
319
|
-
]);
|
|
320
|
-
if (!token) {
|
|
321
|
-
throw new Error("[AgentOS SDK] JWT token not available. User may not be authenticated.");
|
|
322
|
-
}
|
|
323
|
-
if (!workspaceId) {
|
|
324
|
-
throw new Error("[AgentOS SDK] Workspace ID not available. Please select a workspace first.");
|
|
325
|
-
}
|
|
326
|
-
headers["Authorization"] = `Bearer ${token}`;
|
|
327
|
-
headers["X-Workspace-Id"] = workspaceId;
|
|
328
|
-
// NO X-Tenant-Id (backend derives from workspace membership)
|
|
329
219
|
}
|
|
220
|
+
// NO X-Workspace-Id (embedded in token claims)
|
|
221
|
+
// NO X-Tenant-Id (embedded in token claims)
|
|
330
222
|
}
|
|
331
|
-
else {
|
|
332
|
-
//
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
if (this._workspaceId) {
|
|
340
|
-
headers["X-Workspace-Id"] = this._workspaceId;
|
|
223
|
+
else if (isJwtAuth(this._auth)) {
|
|
224
|
+
// JWT: Authorization + X-Workspace-Id
|
|
225
|
+
const [token, workspaceId] = await Promise.all([
|
|
226
|
+
Promise.resolve(this._auth.getToken()),
|
|
227
|
+
Promise.resolve(this._auth.getWorkspaceId()),
|
|
228
|
+
]);
|
|
229
|
+
if (token) {
|
|
230
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
341
231
|
}
|
|
342
|
-
|
|
343
|
-
|
|
232
|
+
// CRITICAL: Workspace ID is REQUIRED for JWT auth
|
|
233
|
+
if (!workspaceId) {
|
|
234
|
+
throw new Error("[AgentOS SDK] No active workspace selected. " +
|
|
235
|
+
"Call getWorkspaceId() must return a valid workspace ID.");
|
|
344
236
|
}
|
|
237
|
+
headers["X-Workspace-Id"] = workspaceId;
|
|
238
|
+
// NO X-Tenant-Id (backend derives from workspace membership)
|
|
345
239
|
}
|
|
346
240
|
return headers;
|
|
347
241
|
}
|
|
348
242
|
/**
|
|
349
|
-
* Get
|
|
243
|
+
* Get resolved headers (for debugging/testing)
|
|
350
244
|
*/
|
|
351
|
-
|
|
352
|
-
return this.
|
|
353
|
-
}
|
|
354
|
-
/** Current tenant ID (legacy) */
|
|
355
|
-
get tenantId() {
|
|
356
|
-
return this._tenantId ?? "";
|
|
357
|
-
}
|
|
358
|
-
/** Current workspace ID (legacy) */
|
|
359
|
-
get workspaceId() {
|
|
360
|
-
return this._workspaceId ?? "";
|
|
245
|
+
async getHeadersAsync() {
|
|
246
|
+
return this._resolveHeaders();
|
|
361
247
|
}
|
|
362
248
|
/** Auth provider type */
|
|
363
249
|
get authType() {
|
|
364
|
-
if (!this._auth)
|
|
365
|
-
return "legacy";
|
|
366
250
|
return this._auth.type;
|
|
367
251
|
}
|
|
368
252
|
/** Raw HTTP client (use modules instead) */
|
package/dist/client/auth.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth Provider Types for Agent OS SDK
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - JWT (browser): Uses Supabase JWT +
|
|
4
|
+
* Two modes only:
|
|
5
|
+
* - JWT (browser): Uses Supabase JWT + X-Workspace-Id header
|
|
6
6
|
* - API Token (server): Uses aosk_* token with embedded claims
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* API Token authentication for server-to-server integrations.
|
|
10
10
|
* Token format: aosk_live_* or aosk_test_*
|
|
11
11
|
*
|
|
12
|
+
* SECURITY: API tokens contain embedded workspace/tenant claims.
|
|
13
|
+
* The SDK sends ONLY Authorization header (no X-Workspace-Id, no X-Tenant-Id).
|
|
14
|
+
*
|
|
12
15
|
* @example
|
|
13
16
|
* ```ts
|
|
14
17
|
* const client = new AgentOsClient({
|
|
@@ -24,7 +27,11 @@ export type ApiTokenAuth = {
|
|
|
24
27
|
};
|
|
25
28
|
/**
|
|
26
29
|
* JWT authentication for browser/frontend clients.
|
|
27
|
-
* Uses Supabase JWT with
|
|
30
|
+
* Uses Supabase JWT with X-Workspace-Id header.
|
|
31
|
+
*
|
|
32
|
+
* SECURITY:
|
|
33
|
+
* - X-Workspace-Id is REQUIRED (throws if missing)
|
|
34
|
+
* - X-Tenant-Id is NEVER sent (backend derives from workspace membership)
|
|
28
35
|
*
|
|
29
36
|
* @example
|
|
30
37
|
* ```ts
|
|
@@ -42,49 +49,30 @@ export type JwtAuth = {
|
|
|
42
49
|
type: "jwt";
|
|
43
50
|
/** Function to get the JWT access token */
|
|
44
51
|
getToken: () => string | Promise<string>;
|
|
45
|
-
/** Function to get the current workspace ID */
|
|
52
|
+
/** Function to get the current workspace ID (REQUIRED) */
|
|
46
53
|
getWorkspaceId: () => string | Promise<string>;
|
|
47
54
|
};
|
|
48
55
|
/**
|
|
49
|
-
* Auth provider union type
|
|
56
|
+
* Auth provider union type - only two modes supported
|
|
50
57
|
*/
|
|
51
58
|
export type AuthProvider = ApiTokenAuth | JwtAuth;
|
|
52
59
|
/**
|
|
53
|
-
*
|
|
60
|
+
* Options for AgentOsClient - auth is REQUIRED
|
|
54
61
|
*/
|
|
55
62
|
export type AgentOsClientOptions = {
|
|
56
63
|
/** Base URL of the Agent OS Control Plane */
|
|
57
64
|
baseUrl: string;
|
|
58
|
-
/** Authentication provider */
|
|
65
|
+
/** Authentication provider (REQUIRED) */
|
|
59
66
|
auth: AuthProvider;
|
|
60
67
|
/**
|
|
61
68
|
* Allow API token in browser environment.
|
|
62
69
|
* Default: false (throws error to prevent accidental exposure)
|
|
70
|
+
* Only set to true if you understand the security implications.
|
|
63
71
|
*/
|
|
64
72
|
allowApiTokenInBrowser?: boolean;
|
|
65
73
|
/** Custom headers to add to all requests */
|
|
66
74
|
headers?: Record<string, string>;
|
|
67
75
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Legacy options (backwards compatibility)
|
|
70
|
-
* @deprecated Use AgentOsClientOptions with auth provider instead
|
|
71
|
-
*/
|
|
72
|
-
export type AgentOsClientOptionsLegacy = {
|
|
73
|
-
/** Base URL of the Agent OS API */
|
|
74
|
-
baseUrl: string;
|
|
75
|
-
/** Tenant ID @deprecated */
|
|
76
|
-
tenantId: string;
|
|
77
|
-
/** Workspace ID @deprecated */
|
|
78
|
-
workspaceId: string;
|
|
79
|
-
/** Auth token @deprecated */
|
|
80
|
-
token?: string;
|
|
81
|
-
/** Member ID @deprecated */
|
|
82
|
-
memberId?: string;
|
|
83
|
-
/** Custom headers */
|
|
84
|
-
headers?: Record<string, string>;
|
|
85
|
-
};
|
|
86
|
-
export declare function isNewAuthOptions(opts: AgentOsClientOptions | AgentOsClientOptionsLegacy): opts is AgentOsClientOptions;
|
|
87
|
-
export declare function isLegacyOptions(opts: AgentOsClientOptions | AgentOsClientOptionsLegacy): opts is AgentOsClientOptionsLegacy;
|
|
88
76
|
export declare function isApiTokenAuth(auth: AuthProvider): auth is ApiTokenAuth;
|
|
89
77
|
export declare function isJwtAuth(auth: AuthProvider): auth is JwtAuth;
|
|
90
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/client/auth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/client/auth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,WAAW,CAAA;IACjB,oDAAoD;IACpD,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;CACpD,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG;IAClB,IAAI,EAAE,KAAK,CAAA;IACX,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACxC,0DAA0D;IAC1D,cAAc,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACjD,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,OAAO,CAAA;AAMjD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,IAAI,EAAE,YAAY,CAAA;IAClB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC,CAAA;AAMD,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,IAAI,YAAY,CAEvE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,IAAI,OAAO,CAE7D;AAMD;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGjD"}
|
package/dist/client/auth.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth Provider Types for Agent OS SDK
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - JWT (browser): Uses Supabase JWT +
|
|
4
|
+
* Two modes only:
|
|
5
|
+
* - JWT (browser): Uses Supabase JWT + X-Workspace-Id header
|
|
6
6
|
* - API Token (server): Uses aosk_* token with embedded claims
|
|
7
7
|
*/
|
|
8
8
|
// ============================================================================
|
|
9
9
|
// Type Guards
|
|
10
10
|
// ============================================================================
|
|
11
|
-
export function isNewAuthOptions(opts) {
|
|
12
|
-
return "auth" in opts && opts.auth !== undefined;
|
|
13
|
-
}
|
|
14
|
-
export function isLegacyOptions(opts) {
|
|
15
|
-
return "tenantId" in opts || "workspaceId" in opts;
|
|
16
|
-
}
|
|
17
11
|
export function isApiTokenAuth(auth) {
|
|
18
12
|
return auth.type === "api_token";
|
|
19
13
|
}
|
package/dist/client/raw.d.ts
CHANGED