@agent-os-sdk/client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +71 -0
  2. package/dist/client/AgentOsClient.d.ts +161 -0
  3. package/dist/client/AgentOsClient.d.ts.map +1 -0
  4. package/dist/client/AgentOsClient.js +217 -0
  5. package/dist/client/helpers.d.ts +63 -0
  6. package/dist/client/helpers.d.ts.map +1 -0
  7. package/dist/client/helpers.js +55 -0
  8. package/dist/client/raw.d.ts +138 -0
  9. package/dist/client/raw.d.ts.map +1 -0
  10. package/dist/client/raw.js +97 -0
  11. package/dist/generated/index.d.ts +2 -0
  12. package/dist/generated/index.d.ts.map +1 -0
  13. package/dist/generated/index.js +1 -0
  14. package/dist/generated/openapi.d.ts +6810 -0
  15. package/dist/generated/openapi.d.ts.map +1 -0
  16. package/dist/generated/openapi.js +5 -0
  17. package/dist/index.d.ts +72 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +86 -0
  20. package/dist/modules/a2a.d.ts +48 -0
  21. package/dist/modules/a2a.d.ts.map +1 -0
  22. package/dist/modules/a2a.js +37 -0
  23. package/dist/modules/agents.d.ts +137 -0
  24. package/dist/modules/agents.d.ts.map +1 -0
  25. package/dist/modules/agents.js +154 -0
  26. package/dist/modules/audit.d.ts +55 -0
  27. package/dist/modules/audit.d.ts.map +1 -0
  28. package/dist/modules/audit.js +38 -0
  29. package/dist/modules/builder.d.ts +65 -0
  30. package/dist/modules/builder.d.ts.map +1 -0
  31. package/dist/modules/builder.js +119 -0
  32. package/dist/modules/checkpoints.d.ts +53 -0
  33. package/dist/modules/checkpoints.d.ts.map +1 -0
  34. package/dist/modules/checkpoints.js +39 -0
  35. package/dist/modules/credentials.d.ts +89 -0
  36. package/dist/modules/credentials.d.ts.map +1 -0
  37. package/dist/modules/credentials.js +79 -0
  38. package/dist/modules/crons.d.ts +72 -0
  39. package/dist/modules/crons.d.ts.map +1 -0
  40. package/dist/modules/crons.js +66 -0
  41. package/dist/modules/dlq.d.ts +60 -0
  42. package/dist/modules/dlq.d.ts.map +1 -0
  43. package/dist/modules/dlq.js +56 -0
  44. package/dist/modules/evaluation.d.ts +119 -0
  45. package/dist/modules/evaluation.d.ts.map +1 -0
  46. package/dist/modules/evaluation.js +96 -0
  47. package/dist/modules/files.d.ts +68 -0
  48. package/dist/modules/files.d.ts.map +1 -0
  49. package/dist/modules/files.js +66 -0
  50. package/dist/modules/graphs.d.ts +51 -0
  51. package/dist/modules/graphs.d.ts.map +1 -0
  52. package/dist/modules/graphs.js +29 -0
  53. package/dist/modules/info.d.ts +27 -0
  54. package/dist/modules/info.d.ts.map +1 -0
  55. package/dist/modules/info.js +27 -0
  56. package/dist/modules/knowledge.d.ts +91 -0
  57. package/dist/modules/knowledge.d.ts.map +1 -0
  58. package/dist/modules/knowledge.js +80 -0
  59. package/dist/modules/mcp.d.ts +39 -0
  60. package/dist/modules/mcp.d.ts.map +1 -0
  61. package/dist/modules/mcp.js +38 -0
  62. package/dist/modules/me.d.ts +27 -0
  63. package/dist/modules/me.d.ts.map +1 -0
  64. package/dist/modules/me.js +19 -0
  65. package/dist/modules/members.d.ts +77 -0
  66. package/dist/modules/members.d.ts.map +1 -0
  67. package/dist/modules/members.js +77 -0
  68. package/dist/modules/metrics.d.ts +16 -0
  69. package/dist/modules/metrics.d.ts.map +1 -0
  70. package/dist/modules/metrics.js +24 -0
  71. package/dist/modules/playground.d.ts +42 -0
  72. package/dist/modules/playground.d.ts.map +1 -0
  73. package/dist/modules/playground.js +48 -0
  74. package/dist/modules/prompts.d.ts +87 -0
  75. package/dist/modules/prompts.d.ts.map +1 -0
  76. package/dist/modules/prompts.js +87 -0
  77. package/dist/modules/runs.d.ts +181 -0
  78. package/dist/modules/runs.d.ts.map +1 -0
  79. package/dist/modules/runs.js +187 -0
  80. package/dist/modules/store.d.ts +37 -0
  81. package/dist/modules/store.d.ts.map +1 -0
  82. package/dist/modules/store.js +48 -0
  83. package/dist/modules/tenants.d.ts +42 -0
  84. package/dist/modules/tenants.d.ts.map +1 -0
  85. package/dist/modules/tenants.js +45 -0
  86. package/dist/modules/threads.d.ts +181 -0
  87. package/dist/modules/threads.d.ts.map +1 -0
  88. package/dist/modules/threads.js +178 -0
  89. package/dist/modules/tools.d.ts +44 -0
  90. package/dist/modules/tools.d.ts.map +1 -0
  91. package/dist/modules/tools.js +39 -0
  92. package/dist/modules/traces.d.ts +79 -0
  93. package/dist/modules/traces.d.ts.map +1 -0
  94. package/dist/modules/traces.js +56 -0
  95. package/dist/modules/triggers.d.ts +71 -0
  96. package/dist/modules/triggers.d.ts.map +1 -0
  97. package/dist/modules/triggers.js +67 -0
  98. package/dist/modules/usage.d.ts +26 -0
  99. package/dist/modules/usage.d.ts.map +1 -0
  100. package/dist/modules/usage.js +19 -0
  101. package/dist/modules/vectorStores.d.ts +97 -0
  102. package/dist/modules/vectorStores.d.ts.map +1 -0
  103. package/dist/modules/vectorStores.js +87 -0
  104. package/dist/modules/workspaces.d.ts +52 -0
  105. package/dist/modules/workspaces.d.ts.map +1 -0
  106. package/dist/modules/workspaces.js +59 -0
  107. package/dist/sse/client.d.ts +62 -0
  108. package/dist/sse/client.d.ts.map +1 -0
  109. package/dist/sse/client.js +66 -0
  110. package/package.json +50 -0
  111. package/src/client/AgentOsClient.ts +269 -0
  112. package/src/client/helpers.ts +98 -0
  113. package/src/client/raw.ts +241 -0
  114. package/src/generated/index.ts +2 -0
  115. package/src/generated/openapi.ts +6810 -0
  116. package/src/generated/swagger.json +8549 -0
  117. package/src/index.ts +161 -0
  118. package/src/modules/a2a.ts +64 -0
  119. package/src/modules/agents.ts +229 -0
  120. package/src/modules/audit.ts +74 -0
  121. package/src/modules/builder.ts +166 -0
  122. package/src/modules/checkpoints.ts +78 -0
  123. package/src/modules/credentials.ts +144 -0
  124. package/src/modules/crons.ts +114 -0
  125. package/src/modules/dlq.ts +93 -0
  126. package/src/modules/evaluation.ts +189 -0
  127. package/src/modules/files.ts +112 -0
  128. package/src/modules/graphs.ts +50 -0
  129. package/src/modules/info.ts +35 -0
  130. package/src/modules/knowledge.ts +147 -0
  131. package/src/modules/mcp.ts +59 -0
  132. package/src/modules/me.ts +32 -0
  133. package/src/modules/members.ts +117 -0
  134. package/src/modules/metrics.ts +27 -0
  135. package/src/modules/playground.ts +68 -0
  136. package/src/modules/prompts.ts +147 -0
  137. package/src/modules/runs.ts +277 -0
  138. package/src/modules/store.ts +65 -0
  139. package/src/modules/tenants.ts +67 -0
  140. package/src/modules/threads.ts +287 -0
  141. package/src/modules/tools.ts +65 -0
  142. package/src/modules/traces.ts +117 -0
  143. package/src/modules/triggers.ts +113 -0
  144. package/src/modules/usage.ts +32 -0
  145. package/src/modules/vectorStores.ts +160 -0
  146. package/src/modules/workspaces.ts +89 -0
  147. package/src/sse/client.ts +100 -0
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Vector Stores Module - Fully Typed
3
+ */
4
+
5
+ import type { RawClient, APIResponse, components } from "../client/raw.js";
6
+
7
+ type VectorStoreResponse = components["schemas"]["VectorStoreResponse"];
8
+ type VectorQueryResponse = components["schemas"]["VectorQueryResponse"];
9
+ type VectorStoreFileResponse = components["schemas"]["VectorStoreFileResponse"];
10
+
11
+ export interface VectorStore {
12
+ id: string;
13
+ name: string;
14
+ workspace_id: string;
15
+ embedding_provider: string;
16
+ embedding_model: string;
17
+ dimension: number;
18
+ credential_binding_alias?: string;
19
+ file_count: number;
20
+ created_at: string;
21
+ }
22
+
23
+ export interface VectorStoreListResponse {
24
+ items: VectorStore[];
25
+ total: number;
26
+ }
27
+
28
+ export interface VectorSearchResult {
29
+ id: string;
30
+ chunk_index: number;
31
+ content_text: string;
32
+ score: number;
33
+ file_id?: string;
34
+ }
35
+
36
+ export interface VectorQueryResult {
37
+ query: string;
38
+ results: VectorSearchResult[];
39
+ total_results: number;
40
+ }
41
+
42
+ export interface VectorStoreFile {
43
+ id: string;
44
+ file_id: string;
45
+ filename: string;
46
+ status: "pending" | "processing" | "completed" | "failed";
47
+ created_at: string;
48
+ }
49
+
50
+ export interface VectorStoreFilesResponse {
51
+ items: VectorStoreFile[];
52
+ total: number;
53
+ }
54
+
55
+ export class VectorStoresModule {
56
+ constructor(private client: RawClient, private headers: () => Record<string, string>) { }
57
+
58
+ /**
59
+ * List all vector stores.
60
+ */
61
+ async list(params?: {
62
+ workspace_id?: string;
63
+ limit?: number;
64
+ offset?: number;
65
+ }): Promise<APIResponse<VectorStoreListResponse>> {
66
+ return this.client.GET<VectorStoreListResponse>("/v1/api/vector-stores", {
67
+ params: { query: params },
68
+ headers: this.headers(),
69
+ });
70
+ }
71
+
72
+ /**
73
+ * Get a vector store by ID.
74
+ */
75
+ async get(storeId: string): Promise<APIResponse<VectorStore>> {
76
+ return this.client.GET<VectorStore>("/v1/api/vector-stores/{id}", {
77
+ params: { path: { id: storeId } },
78
+ headers: this.headers(),
79
+ });
80
+ }
81
+
82
+ /**
83
+ * Create a new vector store.
84
+ */
85
+ async create(body: {
86
+ name: string;
87
+ embedding_provider?: string;
88
+ embedding_model?: string;
89
+ dimension?: number;
90
+ credential_binding_alias?: string;
91
+ }): Promise<APIResponse<VectorStore>> {
92
+ return this.client.POST<VectorStore>("/v1/api/vector-stores", {
93
+ body,
94
+ headers: this.headers(),
95
+ });
96
+ }
97
+
98
+ /**
99
+ * Delete a vector store.
100
+ */
101
+ async delete(storeId: string): Promise<APIResponse<void>> {
102
+ return this.client.DELETE<void>("/v1/api/vector-stores/{id}", {
103
+ params: { path: { id: storeId } },
104
+ headers: this.headers(),
105
+ });
106
+ }
107
+
108
+ // ======================== Query ========================
109
+
110
+ /**
111
+ * Query a vector store for similar content.
112
+ */
113
+ async query(storeId: string, body: {
114
+ query: string;
115
+ top_k?: number;
116
+ min_score?: number;
117
+ }): Promise<APIResponse<VectorQueryResult>> {
118
+ return this.client.POST<VectorQueryResult>("/v1/api/vector-stores/{id}/query", {
119
+ params: { path: { id: storeId } },
120
+ body,
121
+ headers: this.headers(),
122
+ });
123
+ }
124
+
125
+ // ======================== Files ========================
126
+
127
+ /**
128
+ * List files in a vector store.
129
+ */
130
+ async listFiles(storeId: string, params?: {
131
+ limit?: number;
132
+ offset?: number;
133
+ }): Promise<APIResponse<VectorStoreFilesResponse>> {
134
+ return this.client.GET<VectorStoreFilesResponse>("/v1/api/vector-stores/{id}/files", {
135
+ params: { path: { id: storeId }, query: params },
136
+ headers: this.headers(),
137
+ });
138
+ }
139
+
140
+ /**
141
+ * Attach a file to a vector store.
142
+ */
143
+ async attachFile(storeId: string, fileId: string): Promise<APIResponse<VectorStoreFile>> {
144
+ return this.client.POST<VectorStoreFile>("/v1/api/vector-stores/{id}/files", {
145
+ params: { path: { id: storeId } },
146
+ body: { file_id: fileId },
147
+ headers: this.headers(),
148
+ });
149
+ }
150
+
151
+ /**
152
+ * Remove a file from a vector store.
153
+ */
154
+ async removeFile(storeId: string, fileId: string): Promise<APIResponse<void>> {
155
+ return this.client.DELETE<void>("/v1/api/vector-stores/{id}/files/{fileId}", {
156
+ params: { path: { id: storeId, fileId } },
157
+ headers: this.headers(),
158
+ });
159
+ }
160
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Workspaces Module - Fully Typed
3
+ */
4
+
5
+ import type { RawClient, APIResponse, components } from "../client/raw.js";
6
+
7
+ type UpdateWorkspaceRequest = components["schemas"]["UpdateWorkspaceRequest"];
8
+
9
+ export interface Workspace {
10
+ id: string;
11
+ tenant_id: string;
12
+ name: string;
13
+ is_default: boolean;
14
+ settings?: Record<string, unknown>;
15
+ created_at: string;
16
+ updated_at: string;
17
+ }
18
+
19
+ export interface WorkspaceListResponse {
20
+ items: Workspace[];
21
+ total: number;
22
+ }
23
+
24
+ export class WorkspacesModule {
25
+ constructor(
26
+ private client: RawClient,
27
+ private getTenantId: () => string,
28
+ private headers: () => Record<string, string>
29
+ ) { }
30
+
31
+ /**
32
+ * List all workspaces.
33
+ */
34
+ async list(params?: {
35
+ limit?: number;
36
+ offset?: number;
37
+ }): Promise<APIResponse<WorkspaceListResponse>> {
38
+ return this.client.GET<WorkspaceListResponse>("/v1/api/workspaces", {
39
+ params: { query: params },
40
+ headers: this.headers(),
41
+ });
42
+ }
43
+
44
+ /**
45
+ * Get a workspace by ID.
46
+ */
47
+ async get(workspaceId: string): Promise<APIResponse<Workspace>> {
48
+ return this.client.GET<Workspace>("/v1/api/workspaces/{id}", {
49
+ params: { path: { id: workspaceId } },
50
+ headers: this.headers(),
51
+ });
52
+ }
53
+
54
+ /**
55
+ * Create a new workspace.
56
+ */
57
+ async create(body: {
58
+ name: string;
59
+ is_default?: boolean;
60
+ }): Promise<APIResponse<Workspace>> {
61
+ return this.client.POST<Workspace>("/v1/api/workspaces", {
62
+ body,
63
+ headers: this.headers(),
64
+ });
65
+ }
66
+
67
+ /**
68
+ * Update a workspace.
69
+ */
70
+ async update(workspaceId: string, body: {
71
+ name?: string;
72
+ }): Promise<APIResponse<Workspace>> {
73
+ return this.client.PUT<Workspace>("/v1/api/workspaces/{id}", {
74
+ params: { path: { id: workspaceId } },
75
+ body,
76
+ headers: this.headers(),
77
+ });
78
+ }
79
+
80
+ /**
81
+ * Delete a workspace.
82
+ */
83
+ async delete(workspaceId: string): Promise<APIResponse<void>> {
84
+ return this.client.DELETE<void>("/v1/api/workspaces/{id}", {
85
+ params: { path: { id: workspaceId } },
86
+ headers: this.headers(),
87
+ });
88
+ }
89
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Agent OS SDK - SSE Client
3
+ *
4
+ * Typed Server-Sent Events client for streaming endpoints.
5
+ */
6
+
7
+ export type SSEEvent<T = unknown> = {
8
+ id?: string;
9
+ event: string;
10
+ data: T;
11
+ retry?: number;
12
+ };
13
+
14
+ export type SSEOptions = {
15
+ headers?: Record<string, string>;
16
+ onOpen?: () => void;
17
+ onError?: (error: Error) => void;
18
+ signal?: AbortSignal;
19
+ };
20
+
21
+ /**
22
+ * Creates a typed SSE stream from a URL.
23
+ */
24
+ export async function* streamSSE<T>(
25
+ url: string,
26
+ options: SSEOptions = {}
27
+ ): AsyncGenerator<SSEEvent<T>> {
28
+ const response = await fetch(url, {
29
+ method: "GET",
30
+ headers: {
31
+ Accept: "text/event-stream",
32
+ ...options.headers,
33
+ },
34
+ signal: options.signal,
35
+ });
36
+
37
+ if (!response.ok) {
38
+ throw new Error(`SSE connection failed: ${response.status}`);
39
+ }
40
+
41
+ if (!response.body) {
42
+ throw new Error("No response body");
43
+ }
44
+
45
+ options.onOpen?.();
46
+
47
+ const reader = response.body.getReader();
48
+ const decoder = new TextDecoder();
49
+ let buffer = "";
50
+
51
+ try {
52
+ while (true) {
53
+ const { done, value } = await reader.read();
54
+ if (done) break;
55
+
56
+ buffer += decoder.decode(value, { stream: true });
57
+ const lines = buffer.split("\n");
58
+ buffer = lines.pop() ?? "";
59
+
60
+ let currentEvent: Partial<SSEEvent<T>> = { event: "message" };
61
+
62
+ for (const line of lines) {
63
+ if (line.startsWith("event:")) {
64
+ currentEvent.event = line.slice(6).trim();
65
+ } else if (line.startsWith("data:")) {
66
+ const dataStr = line.slice(5).trim();
67
+ try {
68
+ currentEvent.data = JSON.parse(dataStr) as T;
69
+ } catch {
70
+ currentEvent.data = dataStr as T;
71
+ }
72
+ } else if (line.startsWith("id:")) {
73
+ currentEvent.id = line.slice(3).trim();
74
+ } else if (line.startsWith("retry:")) {
75
+ currentEvent.retry = parseInt(line.slice(6).trim(), 10);
76
+ } else if (line === "" && currentEvent.data !== undefined) {
77
+ yield currentEvent as SSEEvent<T>;
78
+ currentEvent = { event: "message" };
79
+ }
80
+ }
81
+ }
82
+ } finally {
83
+ reader.releaseLock();
84
+ }
85
+ }
86
+
87
+ /**
88
+ * SSE Event types for Run streaming
89
+ */
90
+ export type RunStreamEvent =
91
+ | { type: "run_started"; run_id: string; status: string }
92
+ | { type: "node_started"; node_name: string; timestamp: string }
93
+ | { type: "node_completed"; node_name: string; output: unknown }
94
+ | { type: "tool_call"; tool_name: string; args: unknown }
95
+ | { type: "tool_result"; tool_name: string; result: unknown }
96
+ | { type: "checkpoint"; checkpoint_id: string; step_name: string }
97
+ | { type: "waiting_for_human"; prompt: string }
98
+ | { type: "run_completed"; output: unknown }
99
+ | { type: "run_failed"; error: unknown }
100
+ | { type: "heartbeat"; timestamp: string };