@agent-os-sdk/client 0.9.8 → 0.9.10

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.
Files changed (77) hide show
  1. package/dist/client/AgentOsClient.d.ts +6 -2
  2. package/dist/client/AgentOsClient.d.ts.map +1 -1
  3. package/dist/client/AgentOsClient.js +10 -3
  4. package/dist/client/HttpRequestBuilder.d.ts +1 -0
  5. package/dist/client/HttpRequestBuilder.d.ts.map +1 -1
  6. package/dist/client/HttpRequestBuilder.js +6 -2
  7. package/dist/client/auth.d.ts +4 -0
  8. package/dist/client/auth.d.ts.map +1 -1
  9. package/dist/client/raw.d.ts +12 -0
  10. package/dist/client/raw.d.ts.map +1 -1
  11. package/dist/client/raw.js +67 -3
  12. package/dist/generated/openapi.d.ts +115 -186
  13. package/dist/generated/openapi.d.ts.map +1 -1
  14. package/dist/index.d.ts +4 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +4 -0
  17. package/dist/modules/agents.d.ts +30 -0
  18. package/dist/modules/agents.d.ts.map +1 -1
  19. package/dist/modules/agents.js +25 -1
  20. package/dist/modules/builder.d.ts +0 -4
  21. package/dist/modules/builder.d.ts.map +1 -1
  22. package/dist/modules/credentials.d.ts +4 -1
  23. package/dist/modules/credentials.d.ts.map +1 -1
  24. package/dist/modules/credentials.js +36 -1
  25. package/dist/modules/datasets.d.ts +80 -0
  26. package/dist/modules/datasets.d.ts.map +1 -0
  27. package/dist/modules/datasets.js +91 -0
  28. package/dist/modules/files.d.ts +34 -13
  29. package/dist/modules/files.d.ts.map +1 -1
  30. package/dist/modules/files.js +86 -19
  31. package/dist/modules/graphs.d.ts +1 -1
  32. package/dist/modules/graphs.d.ts.map +1 -1
  33. package/dist/modules/members.d.ts +0 -6
  34. package/dist/modules/members.d.ts.map +1 -1
  35. package/dist/modules/members.js +0 -6
  36. package/dist/modules/observability.d.ts +19 -0
  37. package/dist/modules/observability.d.ts.map +1 -0
  38. package/dist/modules/observability.js +14 -0
  39. package/dist/modules/roles.d.ts +64 -0
  40. package/dist/modules/roles.d.ts.map +1 -0
  41. package/dist/modules/roles.js +79 -0
  42. package/dist/modules/runs.d.ts +2 -0
  43. package/dist/modules/runs.d.ts.map +1 -1
  44. package/dist/modules/runs.js +2 -2
  45. package/dist/modules/threads.js +2 -2
  46. package/dist/modules/triggers.d.ts +51 -5
  47. package/dist/modules/triggers.d.ts.map +1 -1
  48. package/dist/modules/triggers.js +39 -0
  49. package/dist/modules/usage.d.ts +68 -9
  50. package/dist/modules/usage.d.ts.map +1 -1
  51. package/dist/modules/usage.js +27 -3
  52. package/dist/modules/vectorStores.d.ts +6 -3
  53. package/dist/modules/vectorStores.d.ts.map +1 -1
  54. package/dist/modules/vectorStores.js +86 -14
  55. package/package.json +1 -1
  56. package/src/client/AgentOsClient.ts +10 -3
  57. package/src/client/HttpRequestBuilder.ts +7 -2
  58. package/src/client/auth.ts +4 -0
  59. package/src/client/raw.ts +91 -4
  60. package/src/generated/openapi.ts +115 -186
  61. package/src/generated/swagger.json +96 -180
  62. package/src/index.ts +4 -1
  63. package/src/modules/agents.ts +56 -2
  64. package/src/modules/builder.ts +0 -7
  65. package/src/modules/credentials.ts +44 -2
  66. package/src/modules/datasets.ts +142 -0
  67. package/src/modules/files.ts +125 -29
  68. package/src/modules/graphs.ts +1 -1
  69. package/src/modules/members.ts +0 -7
  70. package/src/modules/observability.ts +28 -0
  71. package/src/modules/roles.ts +112 -0
  72. package/src/modules/runs.ts +4 -2
  73. package/src/modules/threads.ts +2 -2
  74. package/src/modules/triggers.ts +87 -6
  75. package/src/modules/usage.ts +94 -9
  76. package/src/modules/vectorStores.ts +115 -18
  77. package/src/modules/knowledge.ts +0 -147
@@ -1,26 +1,85 @@
1
1
  /**
2
- * Usage Module - Fully Typed
2
+ * Usage Module — Tenant-level usage metrics and quotas.
3
+ *
4
+ * Endpoints: GET /v1/api/quotas, GET /v1/api/usage
5
+ * Source: runtime.cost_events aggregation
3
6
  */
4
7
  import type { RawClient, APIResponse } from "../client/raw.js";
5
- export interface UsageQuota {
6
- resource: string;
8
+ export interface QuotaItem {
7
9
  limit: number;
8
10
  used: number;
9
11
  remaining: number;
10
12
  }
13
+ export interface QuotasResponse {
14
+ tenant_id: string;
15
+ workspace_id?: string;
16
+ quotas: {
17
+ runs_per_month: QuotaItem;
18
+ tokens_per_month: QuotaItem;
19
+ agents_max: QuotaItem;
20
+ storage_mb: QuotaItem;
21
+ };
22
+ reset_at: string;
23
+ source: string;
24
+ }
25
+ export interface UsageAggregated {
26
+ total_runs: number;
27
+ completed_runs: number;
28
+ failed_runs: number;
29
+ llm_events: number;
30
+ total_tokens: number;
31
+ input_tokens: number;
32
+ output_tokens: number;
33
+ total_duration_ms: number;
34
+ estimated_count: number;
35
+ }
36
+ export interface DailyBreakdownItem {
37
+ date: string;
38
+ runs: number;
39
+ llm_events: number;
40
+ tokens_in: number;
41
+ tokens_out: number;
42
+ duration_ms: number;
43
+ }
44
+ export interface ProviderBreakdownItem {
45
+ provider: string;
46
+ runs: number;
47
+ llm_events: number;
48
+ tokens: number;
49
+ }
11
50
  export interface UsageResponse {
12
- workspace_id: string;
13
- period_start: string;
14
- period_end: string;
15
- quotas: UsageQuota[];
51
+ tenant_id: string;
52
+ workspace_id?: string;
53
+ period: {
54
+ from: string;
55
+ to: string;
56
+ };
57
+ usage: UsageAggregated;
58
+ daily_breakdown: DailyBreakdownItem[];
59
+ provider_breakdown: ProviderBreakdownItem[];
60
+ source: string;
16
61
  }
17
62
  export declare class UsageModule {
18
63
  private client;
19
64
  private headers;
20
65
  constructor(client: RawClient, headers: () => Record<string, string>);
21
66
  /**
22
- * Get current usage and quotas.
67
+ * Get current quota status (tenant-level).
68
+ */
69
+ getQuotas(params?: {
70
+ workspaceId?: string;
71
+ /** @deprecated Use workspaceId */
72
+ workspace_id?: string;
73
+ }): Promise<APIResponse<QuotasResponse>>;
74
+ /**
75
+ * Get usage metrics with real data from runtime.cost_events.
23
76
  */
24
- get(): Promise<APIResponse<UsageResponse>>;
77
+ getUsage(params?: {
78
+ workspaceId?: string;
79
+ /** @deprecated Use workspaceId */
80
+ workspace_id?: string;
81
+ from?: string;
82
+ to?: string;
83
+ }): Promise<APIResponse<UsageResponse>>;
25
84
  }
26
85
  //# sourceMappingURL=usage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/modules/usage.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,qBAAa,WAAW;IACR,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,aAAa,CAAC,CAAC;CAKnD"}
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/modules/usage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/D,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,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M,EAAE,MAAM,CAAC;CAClB;AAMD,qBAAa,WAAW;IACR,OAAO,CAAC,MAAM;IAAa,OAAO,CAAC,OAAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEpF;;OAEG;IACG,SAAS,CAAC,MAAM,CAAC,EAAE;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,kCAAkC;QAClC,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAWxC;;OAEG;IACG,QAAQ,CAAC,MAAM,CAAC,EAAE;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,kCAAkC;QAClC,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;CAY1C"}
@@ -1,6 +1,12 @@
1
1
  /**
2
- * Usage Module - Fully Typed
2
+ * Usage Module — Tenant-level usage metrics and quotas.
3
+ *
4
+ * Endpoints: GET /v1/api/quotas, GET /v1/api/usage
5
+ * Source: runtime.cost_events aggregation
3
6
  */
7
+ // =============================================================================
8
+ // Module
9
+ // =============================================================================
4
10
  export class UsageModule {
5
11
  client;
6
12
  headers;
@@ -9,10 +15,28 @@ export class UsageModule {
9
15
  this.headers = headers;
10
16
  }
11
17
  /**
12
- * Get current usage and quotas.
18
+ * Get current quota status (tenant-level).
13
19
  */
14
- async get() {
20
+ async getQuotas(params) {
21
+ const query = {
22
+ workspaceId: params?.workspaceId ?? params?.workspace_id,
23
+ };
24
+ return this.client.GET("/v1/api/quotas", {
25
+ params: { query },
26
+ headers: this.headers(),
27
+ });
28
+ }
29
+ /**
30
+ * Get usage metrics with real data from runtime.cost_events.
31
+ */
32
+ async getUsage(params) {
33
+ const query = {
34
+ workspaceId: params?.workspaceId ?? params?.workspace_id,
35
+ from: params?.from,
36
+ to: params?.to,
37
+ };
15
38
  return this.client.GET("/v1/api/usage", {
39
+ params: { query },
16
40
  headers: this.headers(),
17
41
  });
18
42
  }
@@ -5,7 +5,6 @@ import type { RawClient, APIResponse } from "../client/raw.js";
5
5
  export interface VectorStore {
6
6
  id: string;
7
7
  name: string;
8
- workspace_id: string;
9
8
  embedding_provider: string;
10
9
  embedding_model: string;
11
10
  dimension: number;
@@ -82,8 +81,8 @@ export declare class VectorStoresModule {
82
81
  * List files in a vector store.
83
82
  */
84
83
  listFiles(storeId: string, params?: {
85
- limit?: number;
86
- offset?: number;
84
+ skip?: number;
85
+ take?: number;
87
86
  }): Promise<APIResponse<VectorStoreFilesResponse>>;
88
87
  /**
89
88
  * Attach a file to a vector store.
@@ -93,5 +92,9 @@ export declare class VectorStoresModule {
93
92
  * Remove a file from a vector store.
94
93
  */
95
94
  removeFile(storeId: string, fileId: string): Promise<APIResponse<void>>;
95
+ /**
96
+ * Bind a vector store to an agent.
97
+ */
98
+ bindAgent(storeId: string, agentId: string): Promise<APIResponse<void>>;
96
99
  }
97
100
  //# sourceMappingURL=vectorStores.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vectorStores.d.ts","sourceRoot":"","sources":["../../src/modules/vectorStores.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAC;AAM3E,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,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;IAO7E;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;CAOhF"}
@@ -1,6 +1,27 @@
1
1
  /**
2
2
  * Vector Stores Module - Fully Typed
3
3
  */
4
+ function toVectorStore(item) {
5
+ return {
6
+ id: item.id ?? "",
7
+ name: item.name ?? "",
8
+ embedding_provider: item.embedding_provider ?? item.embeddingProvider ?? "",
9
+ embedding_model: item.embedding_model ?? item.embeddingModel ?? "",
10
+ dimension: item.dimension ?? 0,
11
+ credential_binding_alias: item.credential_binding_alias ?? item.credentialBindingAlias ?? undefined,
12
+ file_count: item.file_count ?? item.fileCount ?? 0,
13
+ created_at: item.created_at ?? item.createdAt ?? "",
14
+ };
15
+ }
16
+ function toVectorStoreFile(item) {
17
+ return {
18
+ id: item.id ?? "",
19
+ file_id: item.file_id ?? item.fileId ?? "",
20
+ filename: item.filename ?? "",
21
+ status: (item.status ?? "pending"),
22
+ created_at: item.created_at ?? item.createdAt ?? "",
23
+ };
24
+ }
4
25
  export class VectorStoresModule {
5
26
  client;
6
27
  headers;
@@ -12,35 +33,59 @@ export class VectorStoresModule {
12
33
  * List all vector stores.
13
34
  */
14
35
  async list(params) {
15
- return this.client.GET("/v1/api/vector-stores", {
36
+ const response = await this.client.GET("/v1/api/vector-stores", {
16
37
  params: { query: params },
17
38
  headers: this.headers(),
18
39
  });
40
+ const items = Array.isArray(response.data)
41
+ ? response.data.map((item) => toVectorStore(item))
42
+ : [];
43
+ return {
44
+ ...response,
45
+ data: {
46
+ items,
47
+ total: items.length,
48
+ },
49
+ };
19
50
  }
20
51
  /**
21
52
  * Get a vector store by ID.
22
53
  */
23
54
  async get(storeId) {
24
- return this.client.GET("/v1/api/vector-stores/{id}", {
25
- params: { path: { id: storeId } },
55
+ const response = await this.client.GET("/v1/api/vector-stores/{vectorStoreId}", {
56
+ params: { path: { vectorStoreId: storeId } },
26
57
  headers: this.headers(),
27
58
  });
59
+ if (!response.data) {
60
+ return response;
61
+ }
62
+ return {
63
+ ...response,
64
+ data: toVectorStore(response.data),
65
+ };
28
66
  }
29
67
  /**
30
68
  * Create a new vector store.
31
69
  */
32
70
  async create(body) {
33
- return this.client.POST("/v1/api/vector-stores", {
71
+ const response = await this.client.POST("/v1/api/vector-stores", {
34
72
  body,
35
73
  headers: this.headers(),
36
74
  });
75
+ if (!response.data) {
76
+ return response;
77
+ }
78
+ return {
79
+ ...response,
80
+ data: toVectorStore(response.data),
81
+ };
37
82
  }
38
83
  /**
39
84
  * Delete a vector store.
40
85
  */
41
86
  async delete(storeId) {
42
- return this.client.DELETE("/v1/api/vector-stores/{id}", {
43
- params: { path: { id: storeId } },
87
+ return this.client.DELETE("/v1/api/vector-stores/{vectorStoreId}", {
88
+ params: { path: { vectorStoreId: storeId } },
44
89
  headers: this.headers(),
45
90
  });
46
91
  }
@@ -49,8 +94,8 @@ export class VectorStoresModule {
49
94
  * Query a vector store for similar content.
50
95
  */
51
96
  async query(storeId, body) {
52
- return this.client.POST("/v1/api/vector-stores/{id}/query", {
53
- params: { path: { id: storeId } },
97
+ return this.client.POST("/v1/api/vector-stores/{vectorStoreId}/query", {
98
+ params: { path: { vectorStoreId: storeId } },
54
99
  body,
55
100
  headers: this.headers(),
56
101
  });
@@ -60,27 +105,54 @@ export class VectorStoresModule {
60
105
  * List files in a vector store.
61
106
  */
62
107
  async listFiles(storeId, params) {
63
- return this.client.GET("/v1/api/vector-stores/{id}/files", {
64
- params: { path: { id: storeId }, query: params },
108
+ const response = await this.client.GET("/v1/api/vector-stores/{vectorStoreId}/files", {
109
+ params: { path: { vectorStoreId: storeId }, query: params },
65
110
  headers: this.headers(),
66
111
  });
112
+ const items = Array.isArray(response.data)
113
+ ? response.data.map((item) => toVectorStoreFile(item))
114
+ : [];
115
+ return {
116
+ ...response,
117
+ data: {
118
+ items,
119
+ total: items.length,
120
+ },
121
+ };
67
122
  }
68
123
  /**
69
124
  * Attach a file to a vector store.
70
125
  */
71
126
  async attachFile(storeId, fileId) {
72
- return this.client.POST("/v1/api/vector-stores/{id}/files", {
73
- params: { path: { id: storeId } },
127
+ const response = await this.client.POST("/v1/api/vector-stores/{vectorStoreId}/files", {
128
+ params: { path: { vectorStoreId: storeId } },
74
129
  body: { file_id: fileId },
75
130
  headers: this.headers(),
76
131
  });
132
+ if (!response.data) {
133
+ return response;
134
+ }
135
+ return {
136
+ ...response,
137
+ data: toVectorStoreFile(response.data),
138
+ };
77
139
  }
78
140
  /**
79
141
  * Remove a file from a vector store.
80
142
  */
81
143
  async removeFile(storeId, fileId) {
82
- return this.client.DELETE("/v1/api/vector-stores/{id}/files/{fileId}", {
83
- params: { path: { id: storeId, fileId } },
144
+ return this.client.DELETE("/v1/api/vector-stores/{vectorStoreId}/files/{fileId}", {
145
+ params: { path: { vectorStoreId: storeId, fileId } },
146
+ headers: this.headers(),
147
+ });
148
+ }
149
+ /**
150
+ * Bind a vector store to an agent.
151
+ */
152
+ async bindAgent(storeId, agentId) {
153
+ return this.client.POST("/v1/api/vector-stores/{vectorStoreId}/bind-agent", {
154
+ params: { path: { vectorStoreId: storeId } },
155
+ body: { agent_id: agentId },
84
156
  headers: this.headers(),
85
157
  });
86
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-os-sdk/client",
3
- "version": "0.9.8",
3
+ "version": "0.9.10",
4
4
  "description": "Official TypeScript SDK for Agent OS platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,7 +40,8 @@ import { AgentsModule } from "../modules/agents.js";
40
40
  import { BuilderModule } from "../modules/builder.js";
41
41
  import { ChatwootModule } from "../modules/chatwoot.js";
42
42
  import { CredentialsModule } from "../modules/credentials.js";
43
- import { KnowledgeModule } from "../modules/knowledge.js";
43
+ import { DatasetsModule } from "../modules/datasets.js";
44
+ import { RolesModule } from "../modules/roles.js";
44
45
  import { MembersModule } from "../modules/members.js";
45
46
  import { RunsModule } from "../modules/runs.js";
46
47
  import { TenantsModule } from "../modules/tenants.js";
@@ -65,6 +66,7 @@ import { InfoModule } from "../modules/info.js";
65
66
  import { MeModule } from "../modules/me.js";
66
67
  import { MembershipsModule } from "../modules/memberships.js";
67
68
  import { MetricsModule } from "../modules/metrics.js";
69
+ import { ObservabilityModule } from "../modules/observability.js";
68
70
  import { PlaygroundModule } from "../modules/playground.js";
69
71
  import { PresetsModule } from "../modules/presets.js";
70
72
  import { PromptsModule } from "../modules/prompts.js";
@@ -88,7 +90,8 @@ export class AgentOsClient {
88
90
  readonly runs: RunsModule;
89
91
  readonly threads: ThreadsModule;
90
92
  readonly tools: ToolsModule;
91
- readonly knowledge: KnowledgeModule;
93
+ readonly datasets: DatasetsModule;
94
+ readonly roles: RolesModule;
92
95
  readonly triggers: TriggersModule;
93
96
  readonly credentials: CredentialsModule;
94
97
  readonly builder: BuilderModule;
@@ -117,6 +120,7 @@ export class AgentOsClient {
117
120
  readonly catalog: CatalogModule;
118
121
  readonly approvals: ApprovalsModule;
119
122
  readonly auth: AuthModule;
123
+ readonly observability: ObservabilityModule;
120
124
 
121
125
  // Convenience aliases
122
126
  readonly experiments: {
@@ -143,6 +147,7 @@ export class AgentOsClient {
143
147
  this._client = createRawClient({
144
148
  baseUrl: options.baseUrl,
145
149
  headerProvider: () => this._resolveHeaders(),
150
+ contextProvider: options.contextProvider,
146
151
  network: options.network,
147
152
  hooks: options.hooks,
148
153
  });
@@ -157,7 +162,8 @@ export class AgentOsClient {
157
162
  this.runs = new RunsModule(this._client);
158
163
  this.threads = new ThreadsModule(this._client, getHeaders);
159
164
  this.tools = new ToolsModule(this._client, getHeaders);
160
- this.knowledge = new KnowledgeModule(this._client, getWorkspaceId, getHeaders);
165
+ this.datasets = new DatasetsModule(this._client, getHeaders);
166
+ this.roles = new RolesModule(this._client, getHeaders);
161
167
  this.triggers = new TriggersModule(this._client, getHeaders);
162
168
  this.credentials = new CredentialsModule(this._client, getWorkspaceId, getHeaders);
163
169
  this.builder = new BuilderModule(this._client);
@@ -186,6 +192,7 @@ export class AgentOsClient {
186
192
  this.catalog = new CatalogModule(this._client);
187
193
  this.approvals = new ApprovalsModule(this._client, getHeaders);
188
194
  this.auth = new AuthModule(this._client, getHeaders);
195
+ this.observability = new ObservabilityModule(this._client, getHeaders);
189
196
 
190
197
  // Initialize convenience aliases
191
198
  this.experiments = {
@@ -23,6 +23,11 @@ declare const __SDK_VERSION__: string | undefined;
23
23
  const SDK_VERSION = typeof __SDK_VERSION__ !== "undefined" ? __SDK_VERSION__ : "0.7.12-dev";
24
24
  const CORRELATION_ID_PATTERN = /^[A-Za-z0-9._:-]{8,128}$/;
25
25
 
26
+ export function sanitizeValidCorrelationId(raw?: string): string | null {
27
+ const candidate = sanitizeHeader((raw ?? "").trim());
28
+ return CORRELATION_ID_PATTERN.test(candidate) ? candidate : null;
29
+ }
30
+
26
31
  /**
27
32
  * Options for building request headers
28
33
  */
@@ -81,8 +86,8 @@ export class HttpRequestBuilder {
81
86
  }
82
87
 
83
88
  private resolveCorrelationId(raw?: string): string {
84
- const candidate = sanitizeHeader((raw ?? "").trim());
85
- if (CORRELATION_ID_PATTERN.test(candidate)) {
89
+ const candidate = sanitizeValidCorrelationId(raw);
90
+ if (candidate) {
86
91
  return candidate;
87
92
  }
88
93
 
@@ -8,6 +8,7 @@
8
8
 
9
9
  import type { NetworkConfig } from "./config.js";
10
10
  import type { SDKHooks } from "./raw.js";
11
+ import type { OperationContextProvider } from "./OperationContextProvider.js";
11
12
 
12
13
  // ============================================================================
13
14
  // Auth Provider Types
@@ -89,6 +90,9 @@ export type AgentOsClientOptions = {
89
90
  network?: Partial<NetworkConfig>
90
91
  /** Optional request lifecycle hooks for observability */
91
92
  hooks?: SDKHooks
93
+ /** Optional flow context provider (ALS/manual) for sticky correlation per operation. */
94
+ /** Recommended for long-lived server clients to avoid process-wide sticky fallback correlation. */
95
+ contextProvider?: OperationContextProvider
92
96
  /** Custom headers to add to all requests */
93
97
  headers?: Record<string, string>
94
98
  }
package/src/client/raw.ts CHANGED
@@ -9,8 +9,9 @@ import createClient, { type Client } from "openapi-fetch";
9
9
  import type { components, paths } from "../generated/openapi.js";
10
10
  import { createErrorFromResponse } from "../errors/factory.js";
11
11
  import { AgentOsError, NetworkError, TimeoutError } from "../errors/index.js";
12
- import { httpRequestBuilder } from "./HttpRequestBuilder.js";
12
+ import { httpRequestBuilder, sanitizeValidCorrelationId } from "./HttpRequestBuilder.js";
13
13
  import type { OperationContext } from "./OperationContext.js";
14
+ import type { OperationContextProvider } from "./OperationContextProvider.js";
14
15
  import { mergeNetworkConfig, type NetworkConfig } from "./config.js";
15
16
  import { withRetry } from "./retry.js";
16
17
  import { withTimeout } from "./timeout.js";
@@ -22,6 +23,8 @@ export type ClientOptions = {
22
23
  baseUrl: string;
23
24
  headers?: Record<string, string>;
24
25
  headerProvider?: () => Promise<Record<string, string>>;
26
+ /** Optional flow context provider (ALS/manual). */
27
+ contextProvider?: OperationContextProvider;
25
28
  /** Network behavior (timeouts/retries). Defaults to DEFAULT_NETWORK_CONFIG. */
26
29
  network?: Partial<NetworkConfig>;
27
30
  /** Hooks for observability (OTEL, Sentry, etc.) */
@@ -39,6 +42,8 @@ export interface SDKHooks {
39
42
  onResponse?: (context: HookResponseContext) => void | Promise<void>;
40
43
  /** Called on any error (network, timeout, HTTP error) */
41
44
  onError?: (context: HookErrorContext) => void | Promise<void>;
45
+ /** Optional logger bridge used by SDK internal warnings. */
46
+ logger?: { warn?: (message: string) => void };
42
47
  }
43
48
 
44
49
  export interface HookRequestContext {
@@ -106,8 +111,67 @@ export function createTypedClient(options: ClientOptions): TypedClient {
106
111
  * Wraps openapi-fetch to provide the old interface while maintaining types.
107
112
  */
108
113
  export function createRawClient(options: ClientOptions) {
109
- const { baseUrl, headers: defaultHeaders = {}, headerProvider } = options;
114
+ const { baseUrl, headers: defaultHeaders = {}, headerProvider, contextProvider } = options;
110
115
  const networkConfig = mergeNetworkConfig(options.network);
116
+ const warn = (message: string): void => {
117
+ const hookWarn = options.hooks?.logger?.warn;
118
+ if (typeof hookWarn === "function") {
119
+ hookWarn(message);
120
+ return;
121
+ }
122
+ if (typeof console !== "undefined" && typeof console.warn === "function") {
123
+ console.warn(message);
124
+ }
125
+ };
126
+ // Sticky fallback context for clients that don't provide per-operation context.
127
+ const fallbackContext: OperationContext = Object.freeze({
128
+ correlationId: crypto.randomUUID(),
129
+ });
130
+ let warnedStickyFallbackContext = false;
131
+ let warnedInvalidContextCorrelation = false;
132
+ const resolveEffectiveContext = (optsContext?: OperationContext): OperationContext => {
133
+ const providerContext = contextProvider?.get();
134
+ const usingStickyFallback = !optsContext && !providerContext;
135
+ if (usingStickyFallback && !contextProvider && !warnedStickyFallbackContext) {
136
+ warnedStickyFallbackContext = true;
137
+ warn(
138
+ "[AgentOS SDK] Using sticky fallback correlation context per client instance. " +
139
+ "For long-lived server clients, configure contextProvider (ALS/manual) to scope correlation per request."
140
+ );
141
+ }
142
+
143
+ const effectiveContext = optsContext ?? providerContext ?? fallbackContext;
144
+ const correlationProvidedByCaller =
145
+ effectiveContext !== fallbackContext
146
+ && typeof effectiveContext?.correlationId === "string";
147
+
148
+ if (correlationProvidedByCaller) {
149
+ const validCorrelation = sanitizeValidCorrelationId(effectiveContext.correlationId);
150
+ if (!validCorrelation) {
151
+ if (!warnedInvalidContextCorrelation) {
152
+ warnedInvalidContextCorrelation = true;
153
+ warn(
154
+ "[AgentOS SDK] Invalid correlationId in operation context ignored; generated fallback correlation id. " +
155
+ "Provide a valid correlationId (8-128 chars: A-Za-z0-9._:-)."
156
+ );
157
+ }
158
+ // Caller provided invalid flow id: use per-request fallback (not sticky fallback context).
159
+ return {
160
+ ...effectiveContext,
161
+ correlationId: crypto.randomUUID(),
162
+ };
163
+ }
164
+
165
+ if (validCorrelation !== effectiveContext.correlationId) {
166
+ return {
167
+ ...effectiveContext,
168
+ correlationId: validCorrelation,
169
+ };
170
+ }
171
+ }
172
+
173
+ return effectiveContext;
174
+ };
111
175
  type ErrorPayload = { code?: string; message?: string; details?: unknown } & Record<string, unknown>;
112
176
  type HttpAgentOsError = AgentOsError & {
113
177
  response?: Response;
@@ -173,9 +237,11 @@ export function createRawClient(options: ClientOptions) {
173
237
  headers["Content-Type"] = "application/json";
174
238
  }
175
239
 
240
+ const effectiveContext = resolveEffectiveContext(opts?.context);
241
+
176
242
  // Build standard headers via HttpRequestBuilder (single source of truth)
177
243
  const builderHeaders = httpRequestBuilder.build({
178
- context: opts?.context,
244
+ context: effectiveContext,
179
245
  idempotencyKey: opts?.idempotencyKey,
180
246
  requireFlow: opts?.requireFlow,
181
247
  });
@@ -357,7 +423,12 @@ export function createRawClient(options: ClientOptions) {
357
423
  */
358
424
  streamGet: async (
359
425
  path: string,
360
- opts?: { params?: { path?: Record<string, string>; query?: Record<string, unknown> }; headers?: Record<string, string> }
426
+ opts?: {
427
+ params?: { path?: Record<string, string>; query?: Record<string, unknown> };
428
+ headers?: Record<string, string>;
429
+ context?: OperationContext;
430
+ requireFlow?: boolean;
431
+ }
361
432
  ): Promise<Response> => {
362
433
  let url = path;
363
434
  if (opts?.params?.path) {
@@ -377,9 +448,15 @@ export function createRawClient(options: ClientOptions) {
377
448
  }
378
449
  const fullUrl = `${baseUrl}${url}`;
379
450
  const dynamicHeaders = headerProvider ? await headerProvider() : {};
451
+ const effectiveContext = resolveEffectiveContext(opts?.context);
452
+ const builderHeaders = httpRequestBuilder.build({
453
+ context: effectiveContext,
454
+ requireFlow: opts?.requireFlow,
455
+ });
380
456
  const headers: Record<string, string> = {
381
457
  ...defaultHeaders,
382
458
  ...dynamicHeaders,
459
+ ...builderHeaders,
383
460
  Accept: "text/event-stream",
384
461
  ...opts?.headers,
385
462
  };
@@ -397,6 +474,9 @@ export function createRawClient(options: ClientOptions) {
397
474
  body?: unknown;
398
475
  headers?: Record<string, string>;
399
476
  signal?: AbortSignal;
477
+ context?: OperationContext;
478
+ idempotencyKey?: string;
479
+ requireFlow?: boolean;
400
480
  }
401
481
  ): Promise<Response> => {
402
482
  let url = path;
@@ -407,9 +487,16 @@ export function createRawClient(options: ClientOptions) {
407
487
  }
408
488
  const fullUrl = `${baseUrl}${url}`;
409
489
  const dynamicHeaders = headerProvider ? await headerProvider() : {};
490
+ const effectiveContext = resolveEffectiveContext(opts?.context);
491
+ const builderHeaders = httpRequestBuilder.build({
492
+ context: effectiveContext,
493
+ idempotencyKey: opts?.idempotencyKey,
494
+ requireFlow: opts?.requireFlow,
495
+ });
410
496
  const headers: Record<string, string> = {
411
497
  ...defaultHeaders,
412
498
  ...dynamicHeaders,
499
+ ...builderHeaders,
413
500
  "Content-Type": "application/json",
414
501
  Accept: "text/event-stream",
415
502
  ...opts?.headers,