@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,54 @@
1
+ /**
2
+ * OperationContextProvider — Flow lifecycle management
3
+ *
4
+ * Provider defines the lifecycle of a flow context.
5
+ * Implementations can use AsyncLocalStorage or manual context passing.
6
+ *
7
+ * @see sdk-upgrade.md Section 1.2
8
+ */
9
+ import type { OperationContext } from "./OperationContext.js";
10
+ /**
11
+ * Interface for context providers
12
+ */
13
+ export interface OperationContextProvider {
14
+ get(): OperationContext | undefined;
15
+ }
16
+ /**
17
+ * Default provider that always returns undefined.
18
+ * Used when no flow context is established.
19
+ */
20
+ export declare class DefaultContextProvider implements OperationContextProvider {
21
+ get(): OperationContext | undefined;
22
+ }
23
+ /**
24
+ * AsyncLocalStorage-based provider for Node.js environments.
25
+ * Automatically propagates context through async call chains.
26
+ *
27
+ * Note: This class requires Node.js async_hooks module.
28
+ * Import and use only in Node.js environments.
29
+ */
30
+ export declare class AsyncLocalStorageContextProvider implements OperationContextProvider {
31
+ private readonly storage;
32
+ constructor();
33
+ get(): OperationContext | undefined;
34
+ /**
35
+ * Run a function within a context.
36
+ * The context is automatically available to all async operations within.
37
+ */
38
+ run<T>(context: OperationContext, fn: () => T): T;
39
+ /**
40
+ * Run an async function within a context.
41
+ */
42
+ runAsync<T>(context: OperationContext, fn: () => Promise<T>): Promise<T>;
43
+ }
44
+ /**
45
+ * Manual provider for environments without AsyncLocalStorage.
46
+ * Context must be explicitly set and cleared.
47
+ */
48
+ export declare class ManualContextProvider implements OperationContextProvider {
49
+ private context;
50
+ get(): OperationContext | undefined;
51
+ set(context: OperationContext): void;
52
+ clear(): void;
53
+ }
54
+ //# sourceMappingURL=OperationContextProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationContextProvider.d.ts","sourceRoot":"","sources":["../../src/client/OperationContextProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,GAAG,IAAI,gBAAgB,GAAG,SAAS,CAAC;CACvC;AAED;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,wBAAwB;IACnE,GAAG,IAAI,gBAAgB,GAAG,SAAS;CAGtC;AAED;;;;;;GAMG;AACH,qBAAa,gCAAiC,YAAW,wBAAwB;IAE7E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAM;;IAa9B,GAAG,IAAI,gBAAgB,GAAG,SAAS;IAInC;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAIjD;;OAEG;IACH,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAG3E;AAED;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,wBAAwB;IAClE,OAAO,CAAC,OAAO,CAA+B;IAE9C,GAAG,IAAI,gBAAgB,GAAG,SAAS;IAInC,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAIpC,KAAK,IAAI,IAAI;CAGhB"}
@@ -1,89 +1,71 @@
1
1
  /**
2
2
  * OperationContextProvider — Flow lifecycle management
3
- *
3
+ *
4
4
  * Provider defines the lifecycle of a flow context.
5
5
  * Implementations can use AsyncLocalStorage or manual context passing.
6
- *
6
+ *
7
7
  * @see sdk-upgrade.md Section 1.2
8
8
  */
9
-
10
- import type { OperationContext } from "./OperationContext.js";
11
-
12
- /**
13
- * Interface for context providers
14
- */
15
- export interface OperationContextProvider {
16
- get(): OperationContext | undefined;
17
- }
18
-
19
9
  /**
20
10
  * Default provider that always returns undefined.
21
11
  * Used when no flow context is established.
22
12
  */
23
- export class DefaultContextProvider implements OperationContextProvider {
24
- get(): OperationContext | undefined {
13
+ export class DefaultContextProvider {
14
+ get() {
25
15
  return undefined;
26
16
  }
27
17
  }
28
-
29
18
  /**
30
19
  * AsyncLocalStorage-based provider for Node.js environments.
31
20
  * Automatically propagates context through async call chains.
32
- *
21
+ *
33
22
  * Note: This class requires Node.js async_hooks module.
34
23
  * Import and use only in Node.js environments.
35
24
  */
36
- export class AsyncLocalStorageContextProvider implements OperationContextProvider {
25
+ export class AsyncLocalStorageContextProvider {
37
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- private readonly storage: any;
39
-
27
+ storage;
40
28
  constructor() {
41
29
  // Dynamic import to avoid browser errors
42
30
  try {
43
31
  // eslint-disable-next-line @typescript-eslint/no-require-imports
44
32
  const asyncHooks = require("async_hooks");
45
33
  this.storage = new asyncHooks.AsyncLocalStorage();
46
- } catch {
34
+ }
35
+ catch {
47
36
  throw new Error("AsyncLocalStorage requires Node.js environment");
48
37
  }
49
38
  }
50
-
51
- get(): OperationContext | undefined {
39
+ get() {
52
40
  return this.storage?.getStore();
53
41
  }
54
-
55
42
  /**
56
43
  * Run a function within a context.
57
44
  * The context is automatically available to all async operations within.
58
45
  */
59
- run<T>(context: OperationContext, fn: () => T): T {
46
+ run(context, fn) {
60
47
  return this.storage.run(context, fn);
61
48
  }
62
-
63
49
  /**
64
50
  * Run an async function within a context.
65
51
  */
66
- runAsync<T>(context: OperationContext, fn: () => Promise<T>): Promise<T> {
52
+ runAsync(context, fn) {
67
53
  return this.storage.run(context, fn);
68
54
  }
69
55
  }
70
-
71
56
  /**
72
57
  * Manual provider for environments without AsyncLocalStorage.
73
58
  * Context must be explicitly set and cleared.
74
59
  */
75
- export class ManualContextProvider implements OperationContextProvider {
76
- private context: OperationContext | undefined;
77
-
78
- get(): OperationContext | undefined {
60
+ export class ManualContextProvider {
61
+ context;
62
+ get() {
79
63
  return this.context;
80
64
  }
81
-
82
- set(context: OperationContext): void {
65
+ set(context) {
83
66
  this.context = context;
84
67
  }
85
-
86
- clear(): void {
68
+ clear() {
87
69
  this.context = undefined;
88
70
  }
89
71
  }
@@ -1,26 +1,20 @@
1
1
  /**
2
2
  * Auth Provider Types for Agent OS SDK
3
- *
3
+ *
4
4
  * Two modes only:
5
5
  * - JWT (browser): Uses Supabase JWT + X-Workspace-Id header
6
6
  * - API Token (server): Uses aosk_* token with embedded claims
7
7
  */
8
-
9
8
  import type { NetworkConfig } from "./config.js";
10
9
  import type { SDKHooks } from "./raw.js";
11
10
  import type { OperationContextProvider } from "./OperationContextProvider.js";
12
-
13
- // ============================================================================
14
- // Auth Provider Types
15
- // ============================================================================
16
-
17
11
  /**
18
12
  * API Token authentication for server-to-server integrations.
19
13
  * Token format: aosk_live_* or aosk_test_*
20
- *
14
+ *
21
15
  * SECURITY: API tokens contain embedded workspace/tenant claims.
22
16
  * The SDK sends ONLY Authorization header (no X-Workspace-Id, no X-Tenant-Id).
23
- *
17
+ *
24
18
  * @example
25
19
  * ```ts
26
20
  * const client = new AgentOsClient({
@@ -30,19 +24,18 @@ import type { OperationContextProvider } from "./OperationContextProvider.js";
30
24
  * ```
31
25
  */
32
26
  export type ApiTokenAuth = {
33
- type: "api_token"
27
+ type: "api_token";
34
28
  /** API key (aosk_*) or function that returns one */
35
- apiKey: string | (() => string | Promise<string>)
36
- }
37
-
29
+ apiKey: string | (() => string | Promise<string>);
30
+ };
38
31
  /**
39
32
  * JWT authentication for browser/frontend clients.
40
33
  * Uses Supabase JWT with X-Workspace-Id header.
41
- *
42
- * SECURITY:
34
+ *
35
+ * SECURITY:
43
36
  * - X-Workspace-Id is REQUIRED (throws if missing)
44
37
  * - X-Tenant-Id is NEVER sent (backend derives from workspace membership)
45
- *
38
+ *
46
39
  * @example
47
40
  * ```ts
48
41
  * const client = new AgentOsClient({
@@ -56,81 +49,52 @@ export type ApiTokenAuth = {
56
49
  * ```
57
50
  */
58
51
  export type JwtAuth = {
59
- type: "jwt"
52
+ type: "jwt";
60
53
  /** Function to get the JWT access token */
61
- getToken: () => string | Promise<string>
54
+ getToken: () => string | Promise<string>;
62
55
  /** Function to get the current workspace ID (REQUIRED) */
63
- getWorkspaceId: () => string | Promise<string>
64
- }
65
-
56
+ getWorkspaceId: () => string | Promise<string>;
57
+ };
66
58
  /**
67
59
  * Auth provider union type - only two modes supported
68
60
  */
69
- export type AuthProvider = ApiTokenAuth | JwtAuth
70
-
71
- // ============================================================================
72
- // Client Options
73
- // ============================================================================
74
-
61
+ export type AuthProvider = ApiTokenAuth | JwtAuth;
75
62
  /**
76
63
  * Options for AgentOsClient - auth is REQUIRED
77
64
  */
78
65
  export type AgentOsClientOptions = {
79
66
  /** Base URL of the Agent OS Control Plane */
80
- baseUrl: string
67
+ baseUrl: string;
81
68
  /** Authentication provider (REQUIRED) */
82
- auth: AuthProvider
83
- /**
69
+ auth: AuthProvider;
70
+ /**
84
71
  * Allow API token in browser environment.
85
72
  * Default: false (throws error to prevent accidental exposure)
86
73
  * Only set to true if you understand the security implications.
87
74
  */
88
- allowApiTokenInBrowser?: boolean
75
+ allowApiTokenInBrowser?: boolean;
89
76
  /** Network policy (timeouts/retries). */
90
- network?: Partial<NetworkConfig>
77
+ network?: Partial<NetworkConfig>;
91
78
  /** Optional request lifecycle hooks for observability */
92
- hooks?: SDKHooks
79
+ hooks?: SDKHooks;
93
80
  /** Optional flow context provider (ALS/manual) for sticky correlation per operation. */
94
81
  /** Recommended for long-lived server clients to avoid process-wide sticky fallback correlation. */
95
- contextProvider?: OperationContextProvider
82
+ contextProvider?: OperationContextProvider;
96
83
  /** Custom headers to add to all requests */
97
- headers?: Record<string, string>
98
- }
99
-
100
- // ============================================================================
101
- // Type Guards
102
- // ============================================================================
103
-
104
- export function isApiTokenAuth(auth: AuthProvider): auth is ApiTokenAuth {
105
- return auth.type === "api_token"
106
- }
107
-
108
- export function isJwtAuth(auth: AuthProvider): auth is JwtAuth {
109
- return auth.type === "jwt"
110
- }
111
-
112
- // ============================================================================
113
- // Helpers
114
- // ============================================================================
115
-
84
+ headers?: Record<string, string>;
85
+ };
86
+ export declare function isApiTokenAuth(auth: AuthProvider): auth is ApiTokenAuth;
87
+ export declare function isJwtAuth(auth: AuthProvider): auth is JwtAuth;
116
88
  /**
117
89
  * Detect browser environment
118
90
  */
119
- export function isBrowser(): boolean {
120
- return typeof window !== "undefined" && typeof document !== "undefined"
121
- }
122
-
91
+ export declare function isBrowser(): boolean;
123
92
  /**
124
93
  * Check if token looks like an API token (aosk_*)
125
94
  */
126
- export function isApiToken(token: string): boolean {
127
- return token.startsWith("aosk_")
128
- }
129
-
95
+ export declare function isApiToken(token: string): boolean;
130
96
  /**
131
97
  * Check if token looks like a JWT (three base64 segments)
132
98
  */
133
- export function isJwtToken(token: string): boolean {
134
- const parts = token.split(".")
135
- return parts.length === 3 && parts.every(p => p.length > 0)
136
- }
99
+ export declare function isJwtToken(token: string): boolean;
100
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/client/auth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAM9E;;;;;;;;;;;;;;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,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAChC,yDAAyD;IACzD,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,wFAAwF;IACxF,mGAAmG;IACnG,eAAe,CAAC,EAAE,wBAAwB,CAAA;IAC1C,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"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Auth Provider Types for Agent OS SDK
3
+ *
4
+ * Two modes only:
5
+ * - JWT (browser): Uses Supabase JWT + X-Workspace-Id header
6
+ * - API Token (server): Uses aosk_* token with embedded claims
7
+ */
8
+ // ============================================================================
9
+ // Type Guards
10
+ // ============================================================================
11
+ export function isApiTokenAuth(auth) {
12
+ return auth.type === "api_token";
13
+ }
14
+ export function isJwtAuth(auth) {
15
+ return auth.type === "jwt";
16
+ }
17
+ // ============================================================================
18
+ // Helpers
19
+ // ============================================================================
20
+ /**
21
+ * Detect browser environment
22
+ */
23
+ export function isBrowser() {
24
+ return typeof window !== "undefined" && typeof document !== "undefined";
25
+ }
26
+ /**
27
+ * Check if token looks like an API token (aosk_*)
28
+ */
29
+ export function isApiToken(token) {
30
+ return token.startsWith("aosk_");
31
+ }
32
+ /**
33
+ * Check if token looks like a JWT (three base64 segments)
34
+ */
35
+ export function isJwtToken(token) {
36
+ const parts = token.split(".");
37
+ return parts.length === 3 && parts.every(p => p.length > 0);
38
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Agent OS SDK - Network Configuration
3
+ *
4
+ * Centralized configuration for timeouts, retries, and network policies.
5
+ */
6
+ /**
7
+ * Retry configuration for network requests.
8
+ */
9
+ export interface RetryConfig {
10
+ /** Maximum retry attempts (default: 3) */
11
+ maxRetries: number;
12
+ /** Base delay between retries in ms (default: 1000) */
13
+ baseDelayMs: number;
14
+ /** Maximum delay between retries in ms (default: 30000) */
15
+ maxDelayMs: number;
16
+ /** Jitter factor to prevent thundering herd (0-1, default: 0.2) */
17
+ jitterFactor: number;
18
+ /** HTTP status codes that trigger retry (default: [408, 429, 500, 502, 503, 504]) */
19
+ retryableStatuses: number[];
20
+ }
21
+ /**
22
+ * Full network configuration for the SDK client.
23
+ */
24
+ export interface NetworkConfig {
25
+ /** Timeout per request attempt in milliseconds (default: 30000) */
26
+ timeoutMs: number;
27
+ /** Retry configuration */
28
+ retry: RetryConfig;
29
+ }
30
+ /**
31
+ * Default network configuration.
32
+ * Balanced for most use cases - 30s timeout, 3 retries with exponential backoff.
33
+ */
34
+ export declare const DEFAULT_NETWORK_CONFIG: NetworkConfig;
35
+ /**
36
+ * Aggressive configuration for interactive UIs.
37
+ * Shorter timeouts, fewer retries.
38
+ */
39
+ export declare const INTERACTIVE_NETWORK_CONFIG: NetworkConfig;
40
+ /**
41
+ * Patient configuration for background jobs.
42
+ * Longer timeouts, more retries.
43
+ */
44
+ export declare const BACKGROUND_NETWORK_CONFIG: NetworkConfig;
45
+ /**
46
+ * Merges user config with defaults.
47
+ */
48
+ export declare function mergeNetworkConfig(userConfig?: Partial<NetworkConfig>): NetworkConfig;
49
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/client/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IAEnB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IAEpB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IAEnB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;IAErB,qFAAqF;IACrF,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAElB,0BAA0B;IAC1B,KAAK,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,aASpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,aASxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,aASvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAC9B,UAAU,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACpC,aAAa,CAYf"}
@@ -1,45 +1,13 @@
1
1
  /**
2
2
  * Agent OS SDK - Network Configuration
3
- *
3
+ *
4
4
  * Centralized configuration for timeouts, retries, and network policies.
5
5
  */
6
-
7
- /**
8
- * Retry configuration for network requests.
9
- */
10
- export interface RetryConfig {
11
- /** Maximum retry attempts (default: 3) */
12
- maxRetries: number;
13
-
14
- /** Base delay between retries in ms (default: 1000) */
15
- baseDelayMs: number;
16
-
17
- /** Maximum delay between retries in ms (default: 30000) */
18
- maxDelayMs: number;
19
-
20
- /** Jitter factor to prevent thundering herd (0-1, default: 0.2) */
21
- jitterFactor: number;
22
-
23
- /** HTTP status codes that trigger retry (default: [408, 429, 500, 502, 503, 504]) */
24
- retryableStatuses: number[];
25
- }
26
-
27
- /**
28
- * Full network configuration for the SDK client.
29
- */
30
- export interface NetworkConfig {
31
- /** Timeout per request attempt in milliseconds (default: 30000) */
32
- timeoutMs: number;
33
-
34
- /** Retry configuration */
35
- retry: RetryConfig;
36
- }
37
-
38
6
  /**
39
7
  * Default network configuration.
40
8
  * Balanced for most use cases - 30s timeout, 3 retries with exponential backoff.
41
9
  */
42
- export const DEFAULT_NETWORK_CONFIG: NetworkConfig = {
10
+ export const DEFAULT_NETWORK_CONFIG = {
43
11
  timeoutMs: 30_000,
44
12
  retry: {
45
13
  maxRetries: 3,
@@ -49,12 +17,11 @@ export const DEFAULT_NETWORK_CONFIG: NetworkConfig = {
49
17
  retryableStatuses: [408, 429, 500, 502, 503, 504],
50
18
  },
51
19
  };
52
-
53
20
  /**
54
21
  * Aggressive configuration for interactive UIs.
55
22
  * Shorter timeouts, fewer retries.
56
23
  */
57
- export const INTERACTIVE_NETWORK_CONFIG: NetworkConfig = {
24
+ export const INTERACTIVE_NETWORK_CONFIG = {
58
25
  timeoutMs: 10_000,
59
26
  retry: {
60
27
  maxRetries: 1,
@@ -64,12 +31,11 @@ export const INTERACTIVE_NETWORK_CONFIG: NetworkConfig = {
64
31
  retryableStatuses: [429, 503, 504],
65
32
  },
66
33
  };
67
-
68
34
  /**
69
35
  * Patient configuration for background jobs.
70
36
  * Longer timeouts, more retries.
71
37
  */
72
- export const BACKGROUND_NETWORK_CONFIG: NetworkConfig = {
38
+ export const BACKGROUND_NETWORK_CONFIG = {
73
39
  timeoutMs: 120_000,
74
40
  retry: {
75
41
  maxRetries: 5,
@@ -79,17 +45,13 @@ export const BACKGROUND_NETWORK_CONFIG: NetworkConfig = {
79
45
  retryableStatuses: [408, 429, 500, 502, 503, 504],
80
46
  },
81
47
  };
82
-
83
48
  /**
84
49
  * Merges user config with defaults.
85
50
  */
86
- export function mergeNetworkConfig(
87
- userConfig?: Partial<NetworkConfig>
88
- ): NetworkConfig {
51
+ export function mergeNetworkConfig(userConfig) {
89
52
  if (!userConfig) {
90
53
  return DEFAULT_NETWORK_CONFIG;
91
54
  }
92
-
93
55
  return {
94
56
  timeoutMs: userConfig.timeoutMs ?? DEFAULT_NETWORK_CONFIG.timeoutMs,
95
57
  retry: {
@@ -0,0 +1,63 @@
1
+ /**
2
+ * SDK Helper Types and Functions
3
+ *
4
+ * Provides utilities for working with API responses.
5
+ */
6
+ import type { APIResponse } from "./raw.js";
7
+ /**
8
+ * Standard pagination parameters used across all list endpoints.
9
+ * Extends Record to be compatible with query parameter types.
10
+ */
11
+ export interface PaginationParams extends Record<string, unknown> {
12
+ /** Maximum number of items to return (default: 20) */
13
+ limit?: number;
14
+ /** Number of items to skip (default: 0) */
15
+ offset?: number;
16
+ }
17
+ /**
18
+ * Paginated list response wrapper.
19
+ */
20
+ export interface PaginatedResponse<T> {
21
+ items: T[];
22
+ total: number;
23
+ }
24
+ /**
25
+ * SDK-specific error class with structured error data.
26
+ */
27
+ export declare class SDKError extends Error {
28
+ readonly code: string;
29
+ readonly status: number;
30
+ readonly details?: unknown;
31
+ constructor(response: APIResponse<unknown>);
32
+ }
33
+ /**
34
+ * Unwraps an APIResponse, returning the data directly or throwing on error.
35
+ * Use this when you want the cleaner "throws on error" pattern.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * // Instead of:
40
+ * const { data, error } = await client.agents.list();
41
+ * if (error) throw new Error(error.message);
42
+ *
43
+ * // Use:
44
+ * const agents = await unwrap(client.agents.list());
45
+ * ```
46
+ */
47
+ export declare function unwrap<T>(promise: Promise<APIResponse<T>>): Promise<T>;
48
+ /**
49
+ * Type helper for unwrapped responses.
50
+ */
51
+ export type Unwrapped<T> = T extends APIResponse<infer U> ? U : never;
52
+ export type Result<T, E = SDKError> = {
53
+ success: true;
54
+ data: T;
55
+ } | {
56
+ success: false;
57
+ error: E;
58
+ };
59
+ /**
60
+ * Converts an APIResponse to a Result type for pattern matching.
61
+ */
62
+ export declare function toResult<T>(promise: Promise<APIResponse<T>>): Promise<Result<T>>;
63
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/client/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM5C;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAChC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACjB;AAMD;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEf,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC;CAQ7C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM5E;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAMtE,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,IAC5B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAEnC;;GAEG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAMtF"}