@komputer-ai/sdk 0.11.1 → 0.11.3

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 (211) hide show
  1. package/.openapi-generator/FILES +69 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/README.md +147 -122
  4. package/dist/apis/AgentsApi.d.ts +173 -0
  5. package/dist/apis/AgentsApi.js +383 -0
  6. package/dist/apis/ConnectorsApi.d.ts +118 -0
  7. package/dist/apis/ConnectorsApi.js +247 -0
  8. package/dist/apis/MemoriesApi.d.ts +115 -0
  9. package/dist/apis/MemoriesApi.js +252 -0
  10. package/dist/apis/OfficesApi.d.ts +98 -0
  11. package/dist/apis/OfficesApi.js +208 -0
  12. package/dist/apis/SchedulesApi.d.ts +111 -0
  13. package/dist/apis/SchedulesApi.js +252 -0
  14. package/dist/apis/SecretsApi.d.ts +98 -0
  15. package/dist/apis/SecretsApi.js +211 -0
  16. package/dist/apis/SkillsApi.d.ts +115 -0
  17. package/dist/apis/SkillsApi.js +252 -0
  18. package/dist/apis/TemplatesApi.d.ts +56 -0
  19. package/dist/apis/TemplatesApi.js +109 -0
  20. package/dist/apis/index.d.ts +8 -0
  21. package/dist/apis/index.js +26 -0
  22. package/dist/client.d.ts +175 -0
  23. package/dist/client.js +293 -0
  24. package/dist/esm/apis/AgentsApi.d.ts +173 -0
  25. package/dist/esm/apis/AgentsApi.js +379 -0
  26. package/dist/esm/apis/ConnectorsApi.d.ts +118 -0
  27. package/dist/esm/apis/ConnectorsApi.js +243 -0
  28. package/dist/esm/apis/MemoriesApi.d.ts +115 -0
  29. package/dist/esm/apis/MemoriesApi.js +248 -0
  30. package/dist/esm/apis/OfficesApi.d.ts +98 -0
  31. package/dist/esm/apis/OfficesApi.js +204 -0
  32. package/dist/esm/apis/SchedulesApi.d.ts +111 -0
  33. package/dist/esm/apis/SchedulesApi.js +248 -0
  34. package/dist/esm/apis/SecretsApi.d.ts +98 -0
  35. package/dist/esm/apis/SecretsApi.js +207 -0
  36. package/dist/esm/apis/SkillsApi.d.ts +115 -0
  37. package/dist/esm/apis/SkillsApi.js +248 -0
  38. package/dist/esm/apis/TemplatesApi.d.ts +56 -0
  39. package/dist/esm/apis/TemplatesApi.js +105 -0
  40. package/dist/esm/apis/index.d.ts +8 -0
  41. package/dist/esm/client.d.ts +175 -0
  42. package/dist/esm/client.js +289 -0
  43. package/{src/index.ts → dist/esm/index.d.ts} +0 -2
  44. package/dist/esm/index.js +6 -0
  45. package/dist/esm/models/AgentListResponse.d.ts +33 -0
  46. package/dist/esm/models/AgentListResponse.js +42 -0
  47. package/dist/esm/models/AgentResponse.d.ts +134 -0
  48. package/dist/esm/models/AgentResponse.js +75 -0
  49. package/dist/esm/models/ConnectorResponse.d.ts +104 -0
  50. package/{src/models/ConnectorResponse.ts → dist/esm/models/ConnectorResponse.js} +6 -102
  51. package/dist/esm/models/CreateAgentRequest.d.ts +104 -0
  52. package/dist/esm/models/CreateAgentRequest.js +69 -0
  53. package/dist/esm/models/CreateConnectorRequest.d.ts +92 -0
  54. package/{src/models/CreateConnectorRequest.ts → dist/esm/models/CreateConnectorRequest.js} +12 -93
  55. package/dist/esm/models/CreateMemoryRequest.d.ts +50 -0
  56. package/{src/models/CreateMemoryRequest.ts → dist/esm/models/CreateMemoryRequest.js} +10 -50
  57. package/dist/esm/models/CreateScheduleAgentSpec.d.ts +56 -0
  58. package/{src/models/CreateScheduleAgentSpec.ts → dist/esm/models/CreateScheduleAgentSpec.js} +6 -54
  59. package/dist/esm/models/CreateScheduleRequest.d.ts +81 -0
  60. package/dist/esm/models/CreateScheduleRequest.js +64 -0
  61. package/dist/esm/models/CreateSecretRequest.d.ts +46 -0
  62. package/dist/esm/models/CreateSecretRequest.js +49 -0
  63. package/dist/esm/models/CreateSkillRequest.d.ts +50 -0
  64. package/dist/esm/models/CreateSkillRequest.js +53 -0
  65. package/dist/esm/models/MemoryResponse.d.ts +68 -0
  66. package/dist/esm/models/MemoryResponse.js +53 -0
  67. package/dist/esm/models/OfficeListResponse.d.ts +33 -0
  68. package/dist/esm/models/OfficeListResponse.js +42 -0
  69. package/dist/esm/models/OfficeMemberResponse.d.ts +50 -0
  70. package/dist/esm/models/OfficeMemberResponse.js +47 -0
  71. package/dist/esm/models/OfficeResponse.d.ts +93 -0
  72. package/dist/esm/models/OfficeResponse.js +62 -0
  73. package/dist/esm/models/PatchAgentRequest.d.ts +80 -0
  74. package/{src/models/PatchAgentRequest.ts → dist/esm/models/PatchAgentRequest.js} +6 -78
  75. package/dist/esm/models/PatchMemoryRequest.d.ts +38 -0
  76. package/dist/esm/models/PatchMemoryRequest.js +43 -0
  77. package/dist/esm/models/PatchScheduleRequest.d.ts +32 -0
  78. package/dist/esm/models/PatchScheduleRequest.js +41 -0
  79. package/dist/esm/models/PatchSkillRequest.d.ts +38 -0
  80. package/{src/models/PatchSkillRequest.ts → dist/esm/models/PatchSkillRequest.js} +6 -36
  81. package/dist/esm/models/ScheduleListResponse.d.ts +33 -0
  82. package/dist/esm/models/ScheduleListResponse.js +42 -0
  83. package/dist/esm/models/ScheduleResponse.d.ts +140 -0
  84. package/dist/esm/models/ScheduleResponse.js +77 -0
  85. package/dist/esm/models/SecretListResponse.d.ts +33 -0
  86. package/dist/esm/models/SecretListResponse.js +42 -0
  87. package/dist/esm/models/SecretResponse.d.ts +74 -0
  88. package/dist/esm/models/SecretResponse.js +55 -0
  89. package/dist/esm/models/SkillResponse.d.ts +74 -0
  90. package/dist/esm/models/SkillResponse.js +55 -0
  91. package/dist/esm/models/UpdateSecretRequest.d.ts +40 -0
  92. package/{src/models/UpdateSecretRequest.ts → dist/esm/models/UpdateSecretRequest.js} +8 -37
  93. package/dist/esm/models/index.d.ts +24 -0
  94. package/dist/esm/runtime.d.ts +184 -0
  95. package/dist/esm/runtime.js +349 -0
  96. package/dist/esm/watch.d.ts +32 -0
  97. package/dist/esm/watch.js +96 -0
  98. package/dist/index.d.ts +5 -0
  99. package/dist/index.js +24 -0
  100. package/dist/models/AgentListResponse.d.ts +33 -0
  101. package/dist/models/AgentListResponse.js +49 -0
  102. package/dist/models/AgentResponse.d.ts +134 -0
  103. package/{src/models/AgentResponse.ts → dist/models/AgentResponse.js} +13 -132
  104. package/dist/models/ConnectorResponse.d.ts +104 -0
  105. package/dist/models/ConnectorResponse.js +72 -0
  106. package/dist/models/CreateAgentRequest.d.ts +104 -0
  107. package/dist/models/CreateAgentRequest.js +76 -0
  108. package/dist/models/CreateConnectorRequest.d.ts +92 -0
  109. package/dist/models/CreateConnectorRequest.js +74 -0
  110. package/dist/models/CreateMemoryRequest.d.ts +50 -0
  111. package/dist/models/CreateMemoryRequest.js +58 -0
  112. package/dist/models/CreateScheduleAgentSpec.d.ts +56 -0
  113. package/dist/models/CreateScheduleAgentSpec.js +56 -0
  114. package/dist/models/CreateScheduleRequest.d.ts +81 -0
  115. package/dist/models/CreateScheduleRequest.js +71 -0
  116. package/dist/models/CreateSecretRequest.d.ts +46 -0
  117. package/dist/models/CreateSecretRequest.js +56 -0
  118. package/dist/models/CreateSkillRequest.d.ts +50 -0
  119. package/{src/models/CreateSkillRequest.ts → dist/models/CreateSkillRequest.js} +19 -51
  120. package/dist/models/MemoryResponse.d.ts +68 -0
  121. package/{src/models/MemoryResponse.ts → dist/models/MemoryResponse.js} +13 -66
  122. package/dist/models/OfficeListResponse.d.ts +33 -0
  123. package/dist/models/OfficeListResponse.js +49 -0
  124. package/dist/models/OfficeMemberResponse.d.ts +50 -0
  125. package/{src/models/OfficeMemberResponse.ts → dist/models/OfficeMemberResponse.js} +13 -48
  126. package/dist/models/OfficeResponse.d.ts +93 -0
  127. package/dist/models/OfficeResponse.js +69 -0
  128. package/dist/models/PatchAgentRequest.d.ts +80 -0
  129. package/dist/models/PatchAgentRequest.js +64 -0
  130. package/dist/models/PatchMemoryRequest.d.ts +38 -0
  131. package/{src/models/PatchMemoryRequest.ts → dist/models/PatchMemoryRequest.js} +13 -36
  132. package/dist/models/PatchScheduleRequest.d.ts +32 -0
  133. package/{src/models/PatchScheduleRequest.ts → dist/models/PatchScheduleRequest.js} +13 -30
  134. package/dist/models/PatchSkillRequest.d.ts +38 -0
  135. package/dist/models/PatchSkillRequest.js +50 -0
  136. package/dist/models/ScheduleListResponse.d.ts +33 -0
  137. package/dist/models/ScheduleListResponse.js +49 -0
  138. package/dist/models/ScheduleResponse.d.ts +140 -0
  139. package/{src/models/ScheduleResponse.ts → dist/models/ScheduleResponse.js} +13 -138
  140. package/dist/models/SecretListResponse.d.ts +33 -0
  141. package/dist/models/SecretListResponse.js +49 -0
  142. package/dist/models/SecretResponse.d.ts +74 -0
  143. package/{src/models/SecretResponse.ts → dist/models/SecretResponse.js} +13 -72
  144. package/dist/models/SkillResponse.d.ts +74 -0
  145. package/{src/models/SkillResponse.ts → dist/models/SkillResponse.js} +13 -72
  146. package/dist/models/UpdateSecretRequest.d.ts +40 -0
  147. package/dist/models/UpdateSecretRequest.js +52 -0
  148. package/dist/models/index.d.ts +24 -0
  149. package/dist/models/index.js +42 -0
  150. package/dist/runtime.d.ts +184 -0
  151. package/dist/runtime.js +365 -0
  152. package/dist/watch.d.ts +32 -0
  153. package/dist/watch.js +100 -0
  154. package/package.json +6 -3
  155. package/.openapi-generator-ignore +0 -31
  156. package/docs/AgentListResponse.md +0 -34
  157. package/docs/AgentResponse.md +0 -68
  158. package/docs/AgentsApi.md +0 -584
  159. package/docs/ConnectorResponse.md +0 -58
  160. package/docs/ConnectorsApi.md +0 -366
  161. package/docs/CreateAgentRequest.md +0 -58
  162. package/docs/CreateConnectorRequest.md +0 -54
  163. package/docs/CreateMemoryRequest.md +0 -40
  164. package/docs/CreateScheduleAgentSpec.md +0 -42
  165. package/docs/CreateScheduleRequest.md +0 -50
  166. package/docs/CreateSecretRequest.md +0 -38
  167. package/docs/CreateSkillRequest.md +0 -40
  168. package/docs/MemoriesApi.md +0 -368
  169. package/docs/MemoryResponse.md +0 -46
  170. package/docs/OfficeListResponse.md +0 -34
  171. package/docs/OfficeMemberResponse.md +0 -40
  172. package/docs/OfficeResponse.md +0 -54
  173. package/docs/OfficesApi.md +0 -300
  174. package/docs/PatchAgentRequest.md +0 -50
  175. package/docs/PatchMemoryRequest.md +0 -36
  176. package/docs/PatchScheduleRequest.md +0 -34
  177. package/docs/PatchSkillRequest.md +0 -36
  178. package/docs/ScheduleListResponse.md +0 -34
  179. package/docs/ScheduleResponse.md +0 -70
  180. package/docs/SchedulesApi.md +0 -369
  181. package/docs/SecretListResponse.md +0 -34
  182. package/docs/SecretResponse.md +0 -48
  183. package/docs/SecretsApi.md +0 -298
  184. package/docs/SkillResponse.md +0 -48
  185. package/docs/SkillsApi.md +0 -368
  186. package/docs/TemplatesApi.md +0 -138
  187. package/docs/UpdateSecretRequest.md +0 -36
  188. package/src/apis/AgentsApi.ts +0 -485
  189. package/src/apis/ConnectorsApi.ts +0 -301
  190. package/src/apis/MemoriesApi.ts +0 -315
  191. package/src/apis/OfficesApi.ts +0 -253
  192. package/src/apis/SchedulesApi.ts +0 -318
  193. package/src/apis/SecretsApi.ts +0 -267
  194. package/src/apis/SkillsApi.ts +0 -315
  195. package/src/apis/TemplatesApi.ts +0 -109
  196. package/src/client.test.ts +0 -88
  197. package/src/client.ts +0 -212
  198. package/src/models/AgentListResponse.ts +0 -73
  199. package/src/models/CreateAgentRequest.ts +0 -163
  200. package/src/models/CreateScheduleRequest.ts +0 -140
  201. package/src/models/CreateSecretRequest.ts +0 -83
  202. package/src/models/OfficeListResponse.ts +0 -73
  203. package/src/models/OfficeResponse.ts +0 -153
  204. package/src/models/ScheduleListResponse.ts +0 -73
  205. package/src/models/SecretListResponse.ts +0 -73
  206. package/src/runtime.ts +0 -450
  207. package/src/watch.ts +0 -89
  208. package/tsconfig.esm.json +0 -7
  209. package/tsconfig.json +0 -18
  210. /package/{src/apis/index.ts → dist/esm/apis/index.js} +0 -0
  211. /package/{src/models/index.ts → dist/esm/models/index.js} +0 -0
@@ -0,0 +1,365 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * komputer.ai API
6
+ * API-first platform for running persistent Claude AI agents on Kubernetes. Designed to be driven by external systems — create agents, send tasks, and stream real-time results via REST + WebSocket.
7
+ *
8
+ * The version of the OpenAPI document: 1.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
26
+ exports.querystring = querystring;
27
+ exports.exists = exists;
28
+ exports.mapValues = mapValues;
29
+ exports.canConsumeForm = canConsumeForm;
30
+ exports.BASE_PATH = "http://localhost:8080/api/v1".replace(/\/+$/, "");
31
+ class Configuration {
32
+ constructor(configuration = {}) {
33
+ this.configuration = configuration;
34
+ }
35
+ set config(configuration) {
36
+ this.configuration = configuration;
37
+ }
38
+ get basePath() {
39
+ return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
40
+ }
41
+ get fetchApi() {
42
+ return this.configuration.fetchApi;
43
+ }
44
+ get middleware() {
45
+ return this.configuration.middleware || [];
46
+ }
47
+ get queryParamsStringify() {
48
+ return this.configuration.queryParamsStringify || querystring;
49
+ }
50
+ get username() {
51
+ return this.configuration.username;
52
+ }
53
+ get password() {
54
+ return this.configuration.password;
55
+ }
56
+ get apiKey() {
57
+ const apiKey = this.configuration.apiKey;
58
+ if (apiKey) {
59
+ return typeof apiKey === 'function' ? apiKey : () => apiKey;
60
+ }
61
+ return undefined;
62
+ }
63
+ get accessToken() {
64
+ const accessToken = this.configuration.accessToken;
65
+ if (accessToken) {
66
+ return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
67
+ }
68
+ return undefined;
69
+ }
70
+ get headers() {
71
+ return this.configuration.headers;
72
+ }
73
+ get credentials() {
74
+ return this.configuration.credentials;
75
+ }
76
+ }
77
+ exports.Configuration = Configuration;
78
+ exports.DefaultConfig = new Configuration();
79
+ /**
80
+ * This is the base class for all generated API classes.
81
+ */
82
+ class BaseAPI {
83
+ constructor(configuration = exports.DefaultConfig) {
84
+ this.configuration = configuration;
85
+ this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
86
+ let fetchParams = { url, init };
87
+ for (const middleware of this.middleware) {
88
+ if (middleware.pre) {
89
+ fetchParams = (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
90
+ }
91
+ }
92
+ let response = undefined;
93
+ try {
94
+ response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
95
+ }
96
+ catch (e) {
97
+ for (const middleware of this.middleware) {
98
+ if (middleware.onError) {
99
+ response = (yield middleware.onError({
100
+ fetch: this.fetchApi,
101
+ url: fetchParams.url,
102
+ init: fetchParams.init,
103
+ error: e,
104
+ response: response ? response.clone() : undefined,
105
+ })) || response;
106
+ }
107
+ }
108
+ if (response === undefined) {
109
+ if (e instanceof Error) {
110
+ throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
111
+ }
112
+ else {
113
+ throw e;
114
+ }
115
+ }
116
+ }
117
+ for (const middleware of this.middleware) {
118
+ if (middleware.post) {
119
+ response = (yield middleware.post({
120
+ fetch: this.fetchApi,
121
+ url: fetchParams.url,
122
+ init: fetchParams.init,
123
+ response: response.clone(),
124
+ })) || response;
125
+ }
126
+ }
127
+ return response;
128
+ });
129
+ this.middleware = configuration.middleware;
130
+ }
131
+ withMiddleware(...middlewares) {
132
+ const next = this.clone();
133
+ next.middleware = next.middleware.concat(...middlewares);
134
+ return next;
135
+ }
136
+ withPreMiddleware(...preMiddlewares) {
137
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
138
+ return this.withMiddleware(...middlewares);
139
+ }
140
+ withPostMiddleware(...postMiddlewares) {
141
+ const middlewares = postMiddlewares.map((post) => ({ post }));
142
+ return this.withMiddleware(...middlewares);
143
+ }
144
+ /**
145
+ * Check if the given MIME is a JSON MIME.
146
+ * JSON MIME examples:
147
+ * application/json
148
+ * application/json; charset=UTF8
149
+ * APPLICATION/JSON
150
+ * application/vnd.company+json
151
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
152
+ * @return True if the given MIME is JSON, false otherwise.
153
+ */
154
+ isJsonMime(mime) {
155
+ if (!mime) {
156
+ return false;
157
+ }
158
+ return BaseAPI.jsonRegex.test(mime);
159
+ }
160
+ request(context, initOverrides) {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ const { url, init } = yield this.createFetchParams(context, initOverrides);
163
+ const response = yield this.fetchApi(url, init);
164
+ if (response && (response.status >= 200 && response.status < 300)) {
165
+ return response;
166
+ }
167
+ throw new ResponseError(response, 'Response returned an error code');
168
+ });
169
+ }
170
+ createFetchParams(context, initOverrides) {
171
+ return __awaiter(this, void 0, void 0, function* () {
172
+ let url = this.configuration.basePath + context.path;
173
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
174
+ // only add the querystring to the URL if there are query parameters.
175
+ // this is done to avoid urls ending with a "?" character which buggy webservers
176
+ // do not handle correctly sometimes.
177
+ url += '?' + this.configuration.queryParamsStringify(context.query);
178
+ }
179
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
180
+ Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
181
+ const initOverrideFn = typeof initOverrides === "function"
182
+ ? initOverrides
183
+ : () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
184
+ const initParams = {
185
+ method: context.method,
186
+ headers,
187
+ body: context.body,
188
+ credentials: this.configuration.credentials,
189
+ };
190
+ const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
191
+ init: initParams,
192
+ context,
193
+ })));
194
+ let body;
195
+ if (isFormData(overriddenInit.body)
196
+ || (overriddenInit.body instanceof URLSearchParams)
197
+ || isBlob(overriddenInit.body)) {
198
+ body = overriddenInit.body;
199
+ }
200
+ else if (this.isJsonMime(headers['Content-Type'])) {
201
+ body = JSON.stringify(overriddenInit.body);
202
+ }
203
+ else {
204
+ body = overriddenInit.body;
205
+ }
206
+ const init = Object.assign(Object.assign({}, overriddenInit), { body });
207
+ return { url, init };
208
+ });
209
+ }
210
+ /**
211
+ * Create a shallow clone of `this` by constructing a new instance
212
+ * and then shallow cloning data members.
213
+ */
214
+ clone() {
215
+ const constructor = this.constructor;
216
+ const next = new constructor(this.configuration);
217
+ next.middleware = this.middleware.slice();
218
+ return next;
219
+ }
220
+ }
221
+ exports.BaseAPI = BaseAPI;
222
+ BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
223
+ ;
224
+ function isBlob(value) {
225
+ return typeof Blob !== 'undefined' && value instanceof Blob;
226
+ }
227
+ function isFormData(value) {
228
+ return typeof FormData !== "undefined" && value instanceof FormData;
229
+ }
230
+ class ResponseError extends Error {
231
+ constructor(response, msg) {
232
+ super(msg);
233
+ this.response = response;
234
+ this.name = "ResponseError";
235
+ // restore prototype chain
236
+ const actualProto = new.target.prototype;
237
+ if (Object.setPrototypeOf) {
238
+ Object.setPrototypeOf(this, actualProto);
239
+ }
240
+ }
241
+ }
242
+ exports.ResponseError = ResponseError;
243
+ class FetchError extends Error {
244
+ constructor(cause, msg) {
245
+ super(msg);
246
+ this.cause = cause;
247
+ this.name = "FetchError";
248
+ // restore prototype chain
249
+ const actualProto = new.target.prototype;
250
+ if (Object.setPrototypeOf) {
251
+ Object.setPrototypeOf(this, actualProto);
252
+ }
253
+ }
254
+ }
255
+ exports.FetchError = FetchError;
256
+ class RequiredError extends Error {
257
+ constructor(field, msg) {
258
+ super(msg);
259
+ this.field = field;
260
+ this.name = "RequiredError";
261
+ // restore prototype chain
262
+ const actualProto = new.target.prototype;
263
+ if (Object.setPrototypeOf) {
264
+ Object.setPrototypeOf(this, actualProto);
265
+ }
266
+ }
267
+ }
268
+ exports.RequiredError = RequiredError;
269
+ exports.COLLECTION_FORMATS = {
270
+ csv: ",",
271
+ ssv: " ",
272
+ tsv: "\t",
273
+ pipes: "|",
274
+ };
275
+ function querystring(params, prefix = '') {
276
+ return Object.keys(params)
277
+ .map(key => querystringSingleKey(key, params[key], prefix))
278
+ .filter(part => part.length > 0)
279
+ .join('&');
280
+ }
281
+ function querystringSingleKey(key, value, keyPrefix = '') {
282
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
283
+ if (value instanceof Array) {
284
+ const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
285
+ .join(`&${encodeURIComponent(fullKey)}=`);
286
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
287
+ }
288
+ if (value instanceof Set) {
289
+ const valueAsArray = Array.from(value);
290
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
291
+ }
292
+ if (value instanceof Date) {
293
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
294
+ }
295
+ if (value instanceof Object) {
296
+ return querystring(value, fullKey);
297
+ }
298
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
299
+ }
300
+ function exists(json, key) {
301
+ const value = json[key];
302
+ return value !== null && value !== undefined;
303
+ }
304
+ function mapValues(data, fn) {
305
+ const result = {};
306
+ for (const key of Object.keys(data)) {
307
+ result[key] = fn(data[key]);
308
+ }
309
+ return result;
310
+ }
311
+ function canConsumeForm(consumes) {
312
+ for (const consume of consumes) {
313
+ if ('multipart/form-data' === consume.contentType) {
314
+ return true;
315
+ }
316
+ }
317
+ return false;
318
+ }
319
+ class JSONApiResponse {
320
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
321
+ this.raw = raw;
322
+ this.transformer = transformer;
323
+ }
324
+ value() {
325
+ return __awaiter(this, void 0, void 0, function* () {
326
+ return this.transformer(yield this.raw.json());
327
+ });
328
+ }
329
+ }
330
+ exports.JSONApiResponse = JSONApiResponse;
331
+ class VoidApiResponse {
332
+ constructor(raw) {
333
+ this.raw = raw;
334
+ }
335
+ value() {
336
+ return __awaiter(this, void 0, void 0, function* () {
337
+ return undefined;
338
+ });
339
+ }
340
+ }
341
+ exports.VoidApiResponse = VoidApiResponse;
342
+ class BlobApiResponse {
343
+ constructor(raw) {
344
+ this.raw = raw;
345
+ }
346
+ value() {
347
+ return __awaiter(this, void 0, void 0, function* () {
348
+ return yield this.raw.blob();
349
+ });
350
+ }
351
+ ;
352
+ }
353
+ exports.BlobApiResponse = BlobApiResponse;
354
+ class TextApiResponse {
355
+ constructor(raw) {
356
+ this.raw = raw;
357
+ }
358
+ value() {
359
+ return __awaiter(this, void 0, void 0, function* () {
360
+ return yield this.raw.text();
361
+ });
362
+ }
363
+ ;
364
+ }
365
+ exports.TextApiResponse = TextApiResponse;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * WebSocket streaming for agents — hand-written, preserved across regeneration.
3
+ */
4
+ export interface AgentEvent {
5
+ agentName: string;
6
+ type: string;
7
+ timestamp: string;
8
+ payload: Record<string, any>;
9
+ }
10
+ /**
11
+ * Async iterable stream of agent events over WebSocket.
12
+ * Yields pre-fetched history events first, then live WebSocket events,
13
+ * deduplicating by timestamp+type.
14
+ *
15
+ * @example
16
+ * for await (const event of client.watchAgent("my-agent")) {
17
+ * if (event.type === "text") console.log(event.payload.content);
18
+ * if (event.type === "task_completed") break;
19
+ * }
20
+ */
21
+ export declare class AgentEventStream implements AsyncIterable<AgentEvent> {
22
+ private ws;
23
+ private agentName;
24
+ private queue;
25
+ private resolve;
26
+ private done;
27
+ private seen;
28
+ constructor(wsUrl: string, agentName: string, historyEvents?: AgentEvent[]);
29
+ private dedupKey;
30
+ [Symbol.asyncIterator](): AsyncIterator<AgentEvent>;
31
+ close(): void;
32
+ }
package/dist/watch.js ADDED
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ /**
3
+ * WebSocket streaming for agents — hand-written, preserved across regeneration.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AgentEventStream = void 0;
7
+ /**
8
+ * Async iterable stream of agent events over WebSocket.
9
+ * Yields pre-fetched history events first, then live WebSocket events,
10
+ * deduplicating by timestamp+type.
11
+ *
12
+ * @example
13
+ * for await (const event of client.watchAgent("my-agent")) {
14
+ * if (event.type === "text") console.log(event.payload.content);
15
+ * if (event.type === "task_completed") break;
16
+ * }
17
+ */
18
+ class AgentEventStream {
19
+ constructor(wsUrl, agentName, historyEvents) {
20
+ this.queue = [];
21
+ this.resolve = null;
22
+ this.done = false;
23
+ this.seen = new Set();
24
+ this.agentName = agentName;
25
+ // Seed dedup set and queue with history events.
26
+ if (historyEvents) {
27
+ for (const e of historyEvents) {
28
+ const key = this.dedupKey(e);
29
+ this.seen.add(key);
30
+ this.queue.push(e);
31
+ }
32
+ }
33
+ this.ws = new WebSocket(`${wsUrl}/api/v1/agents/${agentName}/ws`);
34
+ this.ws.onmessage = (event) => {
35
+ const data = JSON.parse(event.data);
36
+ const agentEvent = {
37
+ agentName: data.agentName || this.agentName,
38
+ type: data.type || "",
39
+ timestamp: data.timestamp || "",
40
+ payload: data.payload || {},
41
+ };
42
+ const key = this.dedupKey(agentEvent);
43
+ if (this.seen.has(key))
44
+ return;
45
+ this.seen.add(key);
46
+ if (this.resolve) {
47
+ const r = this.resolve;
48
+ this.resolve = null;
49
+ r({ value: agentEvent, done: false });
50
+ }
51
+ else {
52
+ this.queue.push(agentEvent);
53
+ }
54
+ };
55
+ this.ws.onclose = () => {
56
+ this.done = true;
57
+ if (this.resolve) {
58
+ const r = this.resolve;
59
+ this.resolve = null;
60
+ r({ value: undefined, done: true });
61
+ }
62
+ };
63
+ this.ws.onerror = () => {
64
+ this.done = true;
65
+ if (this.resolve) {
66
+ const r = this.resolve;
67
+ this.resolve = null;
68
+ r({ value: undefined, done: true });
69
+ }
70
+ };
71
+ }
72
+ dedupKey(e) {
73
+ const normType = e.type === "task_started" ? "user_message" : e.type;
74
+ return `${e.timestamp}:${normType}`;
75
+ }
76
+ [Symbol.asyncIterator]() {
77
+ return {
78
+ next: () => {
79
+ if (this.queue.length > 0) {
80
+ return Promise.resolve({ value: this.queue.shift(), done: false });
81
+ }
82
+ if (this.done) {
83
+ return Promise.resolve({ value: undefined, done: true });
84
+ }
85
+ return new Promise((resolve) => {
86
+ this.resolve = resolve;
87
+ });
88
+ },
89
+ return: () => {
90
+ this.close();
91
+ return Promise.resolve({ value: undefined, done: true });
92
+ },
93
+ };
94
+ }
95
+ close() {
96
+ this.done = true;
97
+ this.ws.close();
98
+ }
99
+ }
100
+ exports.AgentEventStream = AgentEventStream;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@komputer-ai/sdk",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "TypeScript SDK for the komputer.ai platform",
5
5
  "author": "kontroloop-ai",
6
6
  "license": "MIT",
@@ -18,10 +18,13 @@
18
18
  "sideEffects": false,
19
19
  "scripts": {
20
20
  "build": "tsc && tsc -p tsconfig.esm.json",
21
- "prepare": "npm run build"
21
+ "test": "vitest run src/client.test.ts",
22
+ "test:integration": "vitest run src/integration.test.ts"
22
23
  },
23
24
  "devDependencies": {
25
+ "@types/ws": "^8.18.1",
24
26
  "typescript": "^4.0 || ^5.0",
25
- "vitest": "^4.1.4"
27
+ "vitest": "^4.1.4",
28
+ "ws": "^8.20.0"
26
29
  }
27
30
  }
@@ -1,31 +0,0 @@
1
- # OpenAPI Generator Ignore
2
- # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
-
4
- # Use this file to prevent files from being overwritten by the generator.
5
- # The patterns follow closely to .gitignore or .dockerignore.
6
-
7
- # As an example, the C# client generator defines ApiClient.cs.
8
- # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
- #ApiClient.cs
10
-
11
- # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
- #foo/*/qux
13
- # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
-
15
- # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
- #foo/**/qux
17
- # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
-
19
- # You can also negate patterns with an exclamation (!).
20
- # For example, you can ignore all files in a docs folder with the file extension .md:
21
- #docs/*.md
22
- # Then explicitly reverse the ignore rule for a single file:
23
- #!docs/README.md
24
-
25
- # Preserve hand-written and customized files
26
- src/watch.ts
27
- src/client.ts
28
- src/**/*.test.ts
29
- tsconfig.json
30
- tsconfig.esm.json
31
- package.json
@@ -1,34 +0,0 @@
1
-
2
- # AgentListResponse
3
-
4
-
5
- ## Properties
6
-
7
- Name | Type
8
- ------------ | -------------
9
- `agents` | [Array&lt;AgentResponse&gt;](AgentResponse.md)
10
-
11
- ## Example
12
-
13
- ```typescript
14
- import type { AgentListResponse } from 'komputer-ai'
15
-
16
- // TODO: Update the object below with actual values
17
- const example = {
18
- "agents": null,
19
- } satisfies AgentListResponse
20
-
21
- console.log(example)
22
-
23
- // Convert the instance to a JSON string
24
- const exampleJSON: string = JSON.stringify(example)
25
- console.log(exampleJSON)
26
-
27
- // Parse the JSON string back to an object
28
- const exampleParsed = JSON.parse(exampleJSON) as AgentListResponse
29
- console.log(exampleParsed)
30
- ```
31
-
32
- [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
33
-
34
-
@@ -1,68 +0,0 @@
1
-
2
- # AgentResponse
3
-
4
-
5
- ## Properties
6
-
7
- Name | Type
8
- ------------ | -------------
9
- `connectors` | Array&lt;string&gt;
10
- `createdAt` | string
11
- `instructions` | string
12
- `lastTaskCostUSD` | string
13
- `lastTaskMessage` | string
14
- `lifecycle` | string
15
- `memories` | Array&lt;string&gt;
16
- `model` | string
17
- `modelContextWindow` | number
18
- `name` | string
19
- `namespace` | string
20
- `secrets` | Array&lt;string&gt;
21
- `skills` | Array&lt;string&gt;
22
- `status` | string
23
- `systemPrompt` | string
24
- `taskStatus` | string
25
- `totalCostUSD` | string
26
- `totalTokens` | number
27
-
28
- ## Example
29
-
30
- ```typescript
31
- import type { AgentResponse } from 'komputer-ai'
32
-
33
- // TODO: Update the object below with actual values
34
- const example = {
35
- "connectors": null,
36
- "createdAt": null,
37
- "instructions": null,
38
- "lastTaskCostUSD": null,
39
- "lastTaskMessage": null,
40
- "lifecycle": null,
41
- "memories": null,
42
- "model": null,
43
- "modelContextWindow": null,
44
- "name": null,
45
- "namespace": null,
46
- "secrets": null,
47
- "skills": null,
48
- "status": null,
49
- "systemPrompt": null,
50
- "taskStatus": null,
51
- "totalCostUSD": null,
52
- "totalTokens": null,
53
- } satisfies AgentResponse
54
-
55
- console.log(example)
56
-
57
- // Convert the instance to a JSON string
58
- const exampleJSON: string = JSON.stringify(example)
59
- console.log(exampleJSON)
60
-
61
- // Parse the JSON string back to an object
62
- const exampleParsed = JSON.parse(exampleJSON) as AgentResponse
63
- console.log(exampleParsed)
64
- ```
65
-
66
- [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
67
-
68
-