@agent-os-sdk/client 0.9.26 → 0.9.27

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 (209) hide show
  1. package/dist/client/AgentOsClient.d.ts +141 -0
  2. package/dist/client/AgentOsClient.d.ts.map +1 -0
  3. package/{src/client/AgentOsClient.ts → dist/client/AgentOsClient.js} +61 -105
  4. package/dist/client/HttpRequestBuilder.d.ts +50 -0
  5. package/dist/client/HttpRequestBuilder.d.ts.map +1 -0
  6. package/{src/client/HttpRequestBuilder.ts → dist/client/HttpRequestBuilder.js} +9 -41
  7. package/{src/client/OperationContext.ts → dist/client/OperationContext.d.ts} +6 -9
  8. package/dist/client/OperationContext.d.ts.map +1 -0
  9. package/dist/client/OperationContext.js +13 -0
  10. package/dist/client/OperationContextProvider.d.ts +54 -0
  11. package/dist/client/OperationContextProvider.d.ts.map +1 -0
  12. package/{src/client/OperationContextProvider.ts → dist/client/OperationContextProvider.js} +17 -35
  13. package/{src/client/auth.ts → dist/client/auth.d.ts} +29 -65
  14. package/dist/client/auth.d.ts.map +1 -0
  15. package/dist/client/auth.js +38 -0
  16. package/dist/client/config.d.ts +49 -0
  17. package/dist/client/config.d.ts.map +1 -0
  18. package/{src/client/config.ts → dist/client/config.js} +5 -43
  19. package/dist/client/helpers.d.ts +63 -0
  20. package/dist/client/helpers.d.ts.map +1 -0
  21. package/{src/client/helpers.ts → dist/client/helpers.js} +9 -52
  22. package/dist/client/pagination.d.ts +105 -0
  23. package/dist/client/pagination.d.ts.map +1 -0
  24. package/{src/client/pagination.ts → dist/client/pagination.js} +15 -116
  25. package/dist/client/raw.d.ts +277 -0
  26. package/dist/client/raw.d.ts.map +1 -0
  27. package/dist/client/raw.js +337 -0
  28. package/dist/client/retry.d.ts +37 -0
  29. package/dist/client/retry.d.ts.map +1 -0
  30. package/{src/client/retry.ts → dist/client/retry.js} +13 -55
  31. package/dist/client/sanitize.d.ts +19 -0
  32. package/dist/client/sanitize.d.ts.map +1 -0
  33. package/{src/client/sanitize.ts → dist/client/sanitize.js} +4 -7
  34. package/dist/client/timeout.d.ts +26 -0
  35. package/dist/client/timeout.d.ts.map +1 -0
  36. package/{src/client/timeout.ts → dist/client/timeout.js} +10 -18
  37. package/dist/errors/factory.d.ts +22 -0
  38. package/dist/errors/factory.d.ts.map +1 -0
  39. package/{src/errors/factory.ts → dist/errors/factory.js} +18 -57
  40. package/dist/errors/index.d.ts +210 -0
  41. package/dist/errors/index.d.ts.map +1 -0
  42. package/{src/errors/index.ts → dist/errors/index.js} +74 -156
  43. package/{src/generated/client.ts → dist/generated/client.d.ts} +5 -17
  44. package/dist/generated/client.d.ts.map +1 -0
  45. package/dist/generated/client.js +15 -0
  46. package/{src/generated/index.ts → dist/generated/index.d.ts} +1 -1
  47. package/dist/generated/index.d.ts.map +1 -0
  48. package/dist/generated/index.js +1 -0
  49. package/{src/generated/openapi.ts → dist/generated/openapi.d.ts} +1 -1
  50. package/dist/generated/openapi.d.ts.map +1 -0
  51. package/dist/generated/openapi.js +5 -0
  52. package/dist/index.d.ts +69 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/{src/index.ts → dist/index.js} +13 -63
  55. package/dist/modules/a2a.d.ts +48 -0
  56. package/dist/modules/a2a.d.ts.map +1 -0
  57. package/dist/modules/a2a.js +37 -0
  58. package/dist/modules/agents.d.ts +346 -0
  59. package/dist/modules/agents.d.ts.map +1 -0
  60. package/dist/modules/agents.js +296 -0
  61. package/dist/modules/apiTokens.d.ts +62 -0
  62. package/dist/modules/apiTokens.d.ts.map +1 -0
  63. package/dist/modules/apiTokens.js +56 -0
  64. package/dist/modules/approvals.d.ts +75 -0
  65. package/dist/modules/approvals.d.ts.map +1 -0
  66. package/dist/modules/approvals.js +91 -0
  67. package/dist/modules/audit.d.ts +78 -0
  68. package/dist/modules/audit.d.ts.map +1 -0
  69. package/{src/modules/audit.ts → dist/modules/audit.js} +23 -74
  70. package/{src/modules/auth.ts → dist/modules/auth.d.ts} +6 -11
  71. package/dist/modules/auth.d.ts.map +1 -0
  72. package/dist/modules/auth.js +22 -0
  73. package/dist/modules/builder.d.ts +242 -0
  74. package/dist/modules/builder.d.ts.map +1 -0
  75. package/dist/modules/builder.js +248 -0
  76. package/dist/modules/catalog.d.ts +142 -0
  77. package/dist/modules/catalog.d.ts.map +1 -0
  78. package/dist/modules/catalog.js +136 -0
  79. package/dist/modules/chatwoot.d.ts +59 -0
  80. package/dist/modules/chatwoot.d.ts.map +1 -0
  81. package/dist/modules/chatwoot.js +200 -0
  82. package/dist/modules/checkpoints.d.ts +62 -0
  83. package/dist/modules/checkpoints.d.ts.map +1 -0
  84. package/dist/modules/checkpoints.js +48 -0
  85. package/dist/modules/contracts.d.ts +48 -0
  86. package/dist/modules/contracts.d.ts.map +1 -0
  87. package/dist/modules/contracts.js +25 -0
  88. package/dist/modules/credentials.d.ts +105 -0
  89. package/dist/modules/credentials.d.ts.map +1 -0
  90. package/dist/modules/credentials.js +135 -0
  91. package/dist/modules/crons.d.ts +73 -0
  92. package/dist/modules/crons.d.ts.map +1 -0
  93. package/dist/modules/crons.js +67 -0
  94. package/dist/modules/datasets.d.ts +80 -0
  95. package/dist/modules/datasets.d.ts.map +1 -0
  96. package/dist/modules/datasets.js +91 -0
  97. package/{src/modules/evaluation.ts → dist/modules/evaluation.d.ts} +23 -109
  98. package/dist/modules/evaluation.d.ts.map +1 -0
  99. package/dist/modules/evaluation.js +108 -0
  100. package/dist/modules/files.d.ts +89 -0
  101. package/dist/modules/files.d.ts.map +1 -0
  102. package/dist/modules/files.js +133 -0
  103. package/dist/modules/graphs.d.ts +120 -0
  104. package/dist/modules/graphs.d.ts.map +1 -0
  105. package/dist/modules/graphs.js +69 -0
  106. package/{src/modules/improvements.ts → dist/modules/improvements.d.ts} +8 -27
  107. package/dist/modules/improvements.d.ts.map +1 -0
  108. package/dist/modules/improvements.js +27 -0
  109. package/dist/modules/info.d.ts +76 -0
  110. package/dist/modules/info.d.ts.map +1 -0
  111. package/{src/modules/info.ts → dist/modules/info.js} +16 -66
  112. package/dist/modules/knowledge.d.ts +91 -0
  113. package/dist/modules/knowledge.d.ts.map +1 -0
  114. package/dist/modules/knowledge.js +80 -0
  115. package/{src/modules/me.ts → dist/modules/me.d.ts} +7 -23
  116. package/dist/modules/me.d.ts.map +1 -0
  117. package/dist/modules/me.js +28 -0
  118. package/dist/modules/members.d.ts +124 -0
  119. package/dist/modules/members.d.ts.map +1 -0
  120. package/dist/modules/members.js +142 -0
  121. package/dist/modules/memberships.d.ts +25 -0
  122. package/dist/modules/memberships.d.ts.map +1 -0
  123. package/dist/modules/memberships.js +20 -0
  124. package/{src/modules/metaAgent.ts → dist/modules/metaAgent.d.ts} +8 -44
  125. package/dist/modules/metaAgent.d.ts.map +1 -0
  126. package/dist/modules/metaAgent.js +32 -0
  127. package/dist/modules/metrics.d.ts +20 -0
  128. package/dist/modules/metrics.d.ts.map +1 -0
  129. package/{src/modules/metrics.ts → dist/modules/metrics.js} +7 -14
  130. package/dist/modules/observability.d.ts +19 -0
  131. package/dist/modules/observability.d.ts.map +1 -0
  132. package/dist/modules/observability.js +14 -0
  133. package/dist/modules/playground.d.ts +42 -0
  134. package/dist/modules/playground.d.ts.map +1 -0
  135. package/dist/modules/playground.js +48 -0
  136. package/dist/modules/presets.d.ts +32 -0
  137. package/dist/modules/presets.d.ts.map +1 -0
  138. package/dist/modules/presets.js +199 -0
  139. package/dist/modules/prompts.d.ts +87 -0
  140. package/dist/modules/prompts.d.ts.map +1 -0
  141. package/dist/modules/prompts.js +87 -0
  142. package/dist/modules/roles.d.ts +64 -0
  143. package/dist/modules/roles.d.ts.map +1 -0
  144. package/dist/modules/roles.js +79 -0
  145. package/dist/modules/runs.d.ts +451 -0
  146. package/dist/modules/runs.d.ts.map +1 -0
  147. package/{src/modules/runs.ts → dist/modules/runs.js} +96 -438
  148. package/dist/modules/store.d.ts +37 -0
  149. package/dist/modules/store.d.ts.map +1 -0
  150. package/dist/modules/store.js +48 -0
  151. package/{src/modules/templates.ts → dist/modules/templates.d.ts} +8 -32
  152. package/dist/modules/templates.d.ts.map +1 -0
  153. package/dist/modules/templates.js +26 -0
  154. package/dist/modules/tenants.d.ts +49 -0
  155. package/dist/modules/tenants.d.ts.map +1 -0
  156. package/dist/modules/tenants.js +56 -0
  157. package/dist/modules/threads.d.ts +205 -0
  158. package/dist/modules/threads.d.ts.map +1 -0
  159. package/dist/modules/threads.js +225 -0
  160. package/dist/modules/tools.d.ts +62 -0
  161. package/dist/modules/tools.d.ts.map +1 -0
  162. package/dist/modules/tools.js +45 -0
  163. package/dist/modules/traces.d.ts +89 -0
  164. package/dist/modules/traces.d.ts.map +1 -0
  165. package/dist/modules/traces.js +65 -0
  166. package/{src/modules/triggers.ts → dist/modules/triggers.d.ts} +24 -153
  167. package/dist/modules/triggers.d.ts.map +1 -0
  168. package/dist/modules/triggers.js +176 -0
  169. package/{src/modules/usage.ts → dist/modules/usage.d.ts} +14 -46
  170. package/dist/modules/usage.d.ts.map +1 -0
  171. package/dist/modules/usage.js +43 -0
  172. package/dist/modules/vectorStores.d.ts +100 -0
  173. package/dist/modules/vectorStores.d.ts.map +1 -0
  174. package/dist/modules/vectorStores.js +159 -0
  175. package/dist/modules/workspaces.d.ts +138 -0
  176. package/dist/modules/workspaces.d.ts.map +1 -0
  177. package/dist/modules/workspaces.js +121 -0
  178. package/dist/sse/client.d.ts +140 -0
  179. package/dist/sse/client.d.ts.map +1 -0
  180. package/{src/sse/client.ts → dist/sse/client.js} +24 -100
  181. package/package.json +8 -15
  182. package/src/client/raw.ts +0 -609
  183. package/src/generated/swagger.json +0 -17014
  184. package/src/modules/a2a.ts +0 -64
  185. package/src/modules/agents.ts +0 -604
  186. package/src/modules/apiTokens.ts +0 -101
  187. package/src/modules/approvals.ts +0 -151
  188. package/src/modules/catalog.ts +0 -241
  189. package/src/modules/chatwoot.ts +0 -242
  190. package/src/modules/checkpoints.ts +0 -87
  191. package/src/modules/contracts.ts +0 -80
  192. package/src/modules/credentials.ts +0 -216
  193. package/src/modules/crons.ts +0 -115
  194. package/src/modules/datasets.ts +0 -142
  195. package/src/modules/files.ts +0 -208
  196. package/src/modules/members.ts +0 -199
  197. package/src/modules/memberships.ts +0 -42
  198. package/src/modules/observability.ts +0 -28
  199. package/src/modules/playground.ts +0 -68
  200. package/src/modules/presets.ts +0 -246
  201. package/src/modules/prompts.ts +0 -147
  202. package/src/modules/roles.ts +0 -112
  203. package/src/modules/store.ts +0 -65
  204. package/src/modules/tenants.ts +0 -79
  205. package/src/modules/threads.ts +0 -343
  206. package/src/modules/tools.ts +0 -91
  207. package/src/modules/traces.ts +0 -133
  208. package/src/modules/vectorStores.ts +0 -257
  209. package/src/modules/workspaces.ts +0 -216
@@ -0,0 +1,43 @@
1
+ /**
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
6
+ */
7
+ // =============================================================================
8
+ // Module
9
+ // =============================================================================
10
+ export class UsageModule {
11
+ client;
12
+ headers;
13
+ constructor(client, headers) {
14
+ this.client = client;
15
+ this.headers = headers;
16
+ }
17
+ /**
18
+ * Get current quota status (tenant-level).
19
+ */
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
+ };
38
+ return this.client.GET("/v1/api/usage", {
39
+ params: { query },
40
+ headers: this.headers(),
41
+ });
42
+ }
43
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Vector Stores Module - Fully Typed
3
+ */
4
+ import type { RawClient, APIResponse } from "../client/raw.js";
5
+ export interface VectorStore {
6
+ id: string;
7
+ name: string;
8
+ embedding_provider: string;
9
+ embedding_model: string;
10
+ dimension: number;
11
+ credential_binding_key?: string;
12
+ file_count: number;
13
+ created_at: string;
14
+ }
15
+ export interface VectorStoreListResponse {
16
+ items: VectorStore[];
17
+ total: number;
18
+ }
19
+ export interface VectorSearchResult {
20
+ id: string;
21
+ chunk_index: number;
22
+ content_text: string;
23
+ score: number;
24
+ file_id?: string;
25
+ }
26
+ export interface VectorQueryResult {
27
+ query: string;
28
+ results: VectorSearchResult[];
29
+ total_results: number;
30
+ }
31
+ export interface VectorStoreFile {
32
+ id: string;
33
+ file_id: string;
34
+ filename: string;
35
+ status: "pending" | "processing" | "completed" | "failed";
36
+ created_at: string;
37
+ }
38
+ export interface VectorStoreFilesResponse {
39
+ items: VectorStoreFile[];
40
+ total: number;
41
+ }
42
+ export declare class VectorStoresModule {
43
+ private client;
44
+ private headers;
45
+ constructor(client: RawClient, headers: () => Record<string, string>);
46
+ /**
47
+ * List all vector stores.
48
+ */
49
+ list(params?: {
50
+ workspace_id?: string;
51
+ limit?: number;
52
+ offset?: number;
53
+ }): Promise<APIResponse<VectorStoreListResponse>>;
54
+ /**
55
+ * Get a vector store by ID.
56
+ */
57
+ get(storeId: string): Promise<APIResponse<VectorStore>>;
58
+ /**
59
+ * Create a new vector store.
60
+ */
61
+ create(body: {
62
+ name: string;
63
+ embedding_provider?: string;
64
+ embedding_model?: string;
65
+ dimension?: number;
66
+ credential_binding_key?: string;
67
+ }): Promise<APIResponse<VectorStore>>;
68
+ /**
69
+ * Delete a vector store.
70
+ */
71
+ delete(storeId: string): Promise<APIResponse<void>>;
72
+ /**
73
+ * Query a vector store for similar content.
74
+ */
75
+ query(storeId: string, body: {
76
+ query: string;
77
+ top_k?: number;
78
+ min_score?: number;
79
+ }): Promise<APIResponse<VectorQueryResult>>;
80
+ /**
81
+ * List files in a vector store.
82
+ */
83
+ listFiles(storeId: string, params?: {
84
+ skip?: number;
85
+ take?: number;
86
+ }): Promise<APIResponse<VectorStoreFilesResponse>>;
87
+ /**
88
+ * Attach a file to a vector store.
89
+ */
90
+ attachFile(storeId: string, fileId: string): Promise<APIResponse<VectorStoreFile>>;
91
+ /**
92
+ * Remove a file from a vector store.
93
+ */
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>>;
99
+ }
100
+ //# sourceMappingURL=vectorStores.d.ts.map
@@ -0,0 +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,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC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ACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAU3C;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QACtC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IAmBlD;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAiBxF;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAO7E;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;CAOhF"}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Vector Stores Module - Fully Typed
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_key: item.credential_binding_key ?? item.credentialBindingKey ?? 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
+ }
25
+ export class VectorStoresModule {
26
+ client;
27
+ headers;
28
+ constructor(client, headers) {
29
+ this.client = client;
30
+ this.headers = headers;
31
+ }
32
+ /**
33
+ * List all vector stores.
34
+ */
35
+ async list(params) {
36
+ const response = await this.client.GET("/v1/api/vector-stores", {
37
+ params: { query: params },
38
+ headers: this.headers(),
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
+ };
50
+ }
51
+ /**
52
+ * Get a vector store by ID.
53
+ */
54
+ async get(storeId) {
55
+ const response = await this.client.GET("/v1/api/vector-stores/{vectorStoreId}", {
56
+ params: { path: { vectorStoreId: storeId } },
57
+ headers: this.headers(),
58
+ });
59
+ if (!response.data) {
60
+ return response;
61
+ }
62
+ return {
63
+ ...response,
64
+ data: toVectorStore(response.data),
65
+ };
66
+ }
67
+ /**
68
+ * Create a new vector store.
69
+ */
70
+ async create(body) {
71
+ const response = await this.client.POST("/v1/api/vector-stores", {
72
+ body,
73
+ headers: this.headers(),
74
+ });
75
+ if (!response.data) {
76
+ return response;
77
+ }
78
+ return {
79
+ ...response,
80
+ data: toVectorStore(response.data),
81
+ };
82
+ }
83
+ /**
84
+ * Delete a vector store.
85
+ */
86
+ async delete(storeId) {
87
+ return this.client.DELETE("/v1/api/vector-stores/{vectorStoreId}", {
88
+ params: { path: { vectorStoreId: storeId } },
89
+ headers: this.headers(),
90
+ });
91
+ }
92
+ // ======================== Query ========================
93
+ /**
94
+ * Query a vector store for similar content.
95
+ */
96
+ async query(storeId, body) {
97
+ return this.client.POST("/v1/api/vector-stores/{vectorStoreId}/query", {
98
+ params: { path: { vectorStoreId: storeId } },
99
+ body,
100
+ headers: this.headers(),
101
+ });
102
+ }
103
+ // ======================== Files ========================
104
+ /**
105
+ * List files in a vector store.
106
+ */
107
+ async listFiles(storeId, params) {
108
+ const response = await this.client.GET("/v1/api/vector-stores/{vectorStoreId}/files", {
109
+ params: { path: { vectorStoreId: storeId }, query: params },
110
+ headers: this.headers(),
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
+ };
122
+ }
123
+ /**
124
+ * Attach a file to a vector store.
125
+ */
126
+ async attachFile(storeId, fileId) {
127
+ const response = await this.client.POST("/v1/api/vector-stores/{vectorStoreId}/files", {
128
+ params: { path: { vectorStoreId: storeId } },
129
+ body: { file_id: fileId },
130
+ headers: this.headers(),
131
+ });
132
+ if (!response.data) {
133
+ return response;
134
+ }
135
+ return {
136
+ ...response,
137
+ data: toVectorStoreFile(response.data),
138
+ };
139
+ }
140
+ /**
141
+ * Remove a file from a vector store.
142
+ */
143
+ async removeFile(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 },
156
+ headers: this.headers(),
157
+ });
158
+ }
159
+ }
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Workspaces Module - Fully Typed
3
+ */
4
+ import type { RawClient, APIResponse } from "../client/raw.js";
5
+ /** Event emitted by workspace-level SSE stream. */
6
+ export interface WorkspaceEvent {
7
+ type: string;
8
+ workspace_id: string;
9
+ run_id?: string;
10
+ agent_id?: string;
11
+ old_status?: string;
12
+ new_status?: string;
13
+ ts: number;
14
+ }
15
+ /** Options for followEvents(). */
16
+ export interface WorkspaceFollowOptions {
17
+ /** AbortSignal to kill the SSE connection. Required for cleanup. */
18
+ signal?: AbortSignal;
19
+ }
20
+ export interface Workspace {
21
+ id: string;
22
+ tenant_id: string;
23
+ name: string;
24
+ is_default: boolean;
25
+ settings?: Record<string, unknown>;
26
+ created_at: string;
27
+ updated_at: string;
28
+ }
29
+ export interface WorkspaceListResponse {
30
+ items: Workspace[];
31
+ total: number;
32
+ }
33
+ export declare class WorkspacesModule {
34
+ private client;
35
+ private getTenantId;
36
+ private headers;
37
+ constructor(client: RawClient, getTenantId: () => string, headers: () => Record<string, string>);
38
+ /**
39
+ * List all workspaces.
40
+ */
41
+ list(params?: {
42
+ limit?: number;
43
+ offset?: number;
44
+ }): Promise<APIResponse<WorkspaceListResponse>>;
45
+ /**
46
+ * Get a workspace by ID.
47
+ */
48
+ get(workspaceId: string): Promise<APIResponse<Workspace>>;
49
+ /**
50
+ * Create a new workspace.
51
+ */
52
+ create(body: {
53
+ name: string;
54
+ is_default?: boolean;
55
+ }): Promise<APIResponse<Workspace>>;
56
+ /**
57
+ * Update a workspace.
58
+ */
59
+ update(workspaceId: string, body: {
60
+ name?: string;
61
+ }): Promise<APIResponse<Workspace>>;
62
+ /**
63
+ * Delete a workspace.
64
+ */
65
+ delete(workspaceId: string): Promise<APIResponse<void>>;
66
+ /**
67
+ * Get workspace quotas.
68
+ */
69
+ getQuotas(workspaceId: string): Promise<APIResponse<WorkspaceQuotaResponse>>;
70
+ /**
71
+ * Get workspace usage.
72
+ */
73
+ getUsage(workspaceId: string, params?: {
74
+ from?: string;
75
+ to?: string;
76
+ }): Promise<APIResponse<WorkspaceUsageResponse>>;
77
+ /**
78
+ * Stream workspace events via SSE.
79
+ * Workspace identity flows via X-Workspace-Id header (same as all SDK methods).
80
+ *
81
+ * @param options - AbortSignal for cleanup (MUST be used to avoid leaking connections)
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const controller = new AbortController();
86
+ * for await (const event of client.workspaces.followEvents({ signal: controller.signal })) {
87
+ * if (event.type === 'run_status_changed') {
88
+ * console.log(`Run ${event.run_id} → ${event.new_status}`);
89
+ * }
90
+ * }
91
+ * // On cleanup:
92
+ * controller.abort();
93
+ * ```
94
+ */
95
+ followEvents(options?: WorkspaceFollowOptions): AsyncGenerator<WorkspaceEvent, void, unknown>;
96
+ }
97
+ export interface WorkspaceQuotaResponse {
98
+ workspace_id: string;
99
+ quotas: {
100
+ runs_per_month: Quota;
101
+ tokens_per_month: Quota;
102
+ agents_max: Quota;
103
+ storage_mb: Quota;
104
+ };
105
+ reset_at: string;
106
+ source: string;
107
+ }
108
+ export interface Quota {
109
+ limit: number;
110
+ used: number;
111
+ remaining: number;
112
+ }
113
+ export interface WorkspaceUsageResponse {
114
+ workspace_id: string;
115
+ period: {
116
+ from: string;
117
+ to: string;
118
+ };
119
+ usage: {
120
+ total_runs: number;
121
+ completed_runs: number;
122
+ failed_runs: number;
123
+ total_tokens: number;
124
+ input_tokens: number;
125
+ output_tokens: number;
126
+ total_duration_ms: number;
127
+ estimated_count: number;
128
+ };
129
+ daily_breakdown: Array<{
130
+ date: string;
131
+ runs: number;
132
+ tokens_in: number;
133
+ tokens_out: number;
134
+ duration_ms: number;
135
+ }>;
136
+ source: string;
137
+ }
138
+ //# sourceMappingURL=workspaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../src/modules/workspaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAC;AAO3E,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,kCAAkC;AAClC,MAAM,WAAW,sBAAsB;IACnC,oEA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ACrB,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"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Workspaces Module - Fully Typed
3
+ */
4
+ import { parseSSE } from "../sse/client.js";
5
+ export class WorkspacesModule {
6
+ client;
7
+ getTenantId;
8
+ headers;
9
+ constructor(client, getTenantId, headers) {
10
+ this.client = client;
11
+ this.getTenantId = getTenantId;
12
+ this.headers = headers;
13
+ }
14
+ /**
15
+ * List all workspaces.
16
+ */
17
+ async list(params) {
18
+ return this.client.GET("/v1/api/workspaces", {
19
+ params: { query: params },
20
+ headers: this.headers(),
21
+ });
22
+ }
23
+ /**
24
+ * Get a workspace by ID.
25
+ */
26
+ async get(workspaceId) {
27
+ return this.client.GET("/v1/api/workspaces/{id}", {
28
+ params: { path: { id: workspaceId } },
29
+ headers: this.headers(),
30
+ });
31
+ }
32
+ /**
33
+ * Create a new workspace.
34
+ */
35
+ async create(body) {
36
+ return this.client.POST("/v1/api/workspaces", {
37
+ body,
38
+ headers: this.headers(),
39
+ });
40
+ }
41
+ /**
42
+ * Update a workspace.
43
+ */
44
+ async update(workspaceId, body) {
45
+ return this.client.PUT("/v1/api/workspaces/{id}", {
46
+ params: { path: { id: workspaceId } },
47
+ body,
48
+ headers: this.headers(),
49
+ });
50
+ }
51
+ /**
52
+ * Delete a workspace.
53
+ */
54
+ async delete(workspaceId) {
55
+ return this.client.DELETE("/v1/api/workspaces/{id}", {
56
+ params: { path: { id: workspaceId } },
57
+ headers: this.headers(),
58
+ });
59
+ }
60
+ /**
61
+ * Get workspace quotas.
62
+ */
63
+ async getQuotas(workspaceId) {
64
+ return this.client.GET("/v1/api/workspaces/{workspaceId}/quotas", {
65
+ params: { path: { workspaceId } },
66
+ headers: this.headers(),
67
+ });
68
+ }
69
+ /**
70
+ * Get workspace usage.
71
+ */
72
+ async getUsage(workspaceId, params) {
73
+ return this.client.GET("/v1/api/workspaces/{workspaceId}/usage", {
74
+ params: { path: { workspaceId }, query: params },
75
+ headers: this.headers(),
76
+ });
77
+ }
78
+ // ======================== FOLLOW (Workspace SSE) ========================
79
+ /**
80
+ * Stream workspace events via SSE.
81
+ * Workspace identity flows via X-Workspace-Id header (same as all SDK methods).
82
+ *
83
+ * @param options - AbortSignal for cleanup (MUST be used to avoid leaking connections)
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const controller = new AbortController();
88
+ * for await (const event of client.workspaces.followEvents({ signal: controller.signal })) {
89
+ * if (event.type === 'run_status_changed') {
90
+ * console.log(`Run ${event.run_id} → ${event.new_status}`);
91
+ * }
92
+ * }
93
+ * // On cleanup:
94
+ * controller.abort();
95
+ * ```
96
+ */
97
+ async *followEvents(options) {
98
+ // Workspace identity flows via X-Workspace-Id header (set by this.headers()),
99
+ // consistent with all other SDK endpoints. No path param needed.
100
+ const response = await this.client.streamGet("/v1/api/workspaces/events/stream", {
101
+ headers: this.headers(),
102
+ signal: options?.signal,
103
+ });
104
+ try {
105
+ for await (const rawEvent of parseSSE(response)) {
106
+ if (rawEvent.data != null) {
107
+ yield rawEvent.data;
108
+ }
109
+ }
110
+ }
111
+ catch (err) {
112
+ // Abort is normal cleanup — not an error worth surfacing.
113
+ // Check both signal state and error name (covers proxy/wrapper edge cases).
114
+ if (options?.signal?.aborted)
115
+ return;
116
+ if (err instanceof Error && err.name === "AbortError")
117
+ return;
118
+ throw err;
119
+ }
120
+ }
121
+ }