@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,184 @@
1
+ /**
2
+ * komputer.ai API
3
+ * 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.
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ export declare const BASE_PATH: string;
13
+ export interface ConfigurationParameters {
14
+ basePath?: string;
15
+ fetchApi?: FetchAPI;
16
+ middleware?: Middleware[];
17
+ queryParamsStringify?: (params: HTTPQuery) => string;
18
+ username?: string;
19
+ password?: string;
20
+ apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>);
21
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>);
22
+ headers?: HTTPHeaders;
23
+ credentials?: RequestCredentials;
24
+ }
25
+ export declare class Configuration {
26
+ private configuration;
27
+ constructor(configuration?: ConfigurationParameters);
28
+ set config(configuration: Configuration);
29
+ get basePath(): string;
30
+ get fetchApi(): FetchAPI | undefined;
31
+ get middleware(): Middleware[];
32
+ get queryParamsStringify(): (params: HTTPQuery) => string;
33
+ get username(): string | undefined;
34
+ get password(): string | undefined;
35
+ get apiKey(): ((name: string) => string | Promise<string>) | undefined;
36
+ get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
37
+ get headers(): HTTPHeaders | undefined;
38
+ get credentials(): RequestCredentials | undefined;
39
+ }
40
+ export declare const DefaultConfig: Configuration;
41
+ /**
42
+ * This is the base class for all generated API classes.
43
+ */
44
+ export declare class BaseAPI {
45
+ protected configuration: Configuration;
46
+ private static readonly jsonRegex;
47
+ private middleware;
48
+ constructor(configuration?: Configuration);
49
+ withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
50
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
51
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
52
+ /**
53
+ * Check if the given MIME is a JSON MIME.
54
+ * JSON MIME examples:
55
+ * application/json
56
+ * application/json; charset=UTF8
57
+ * APPLICATION/JSON
58
+ * application/vnd.company+json
59
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
60
+ * @return True if the given MIME is JSON, false otherwise.
61
+ */
62
+ protected isJsonMime(mime: string | null | undefined): boolean;
63
+ protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
64
+ private createFetchParams;
65
+ private fetchApi;
66
+ /**
67
+ * Create a shallow clone of `this` by constructing a new instance
68
+ * and then shallow cloning data members.
69
+ */
70
+ private clone;
71
+ }
72
+ export declare class ResponseError extends Error {
73
+ response: Response;
74
+ name: "ResponseError";
75
+ constructor(response: Response, msg?: string);
76
+ }
77
+ export declare class FetchError extends Error {
78
+ cause: Error;
79
+ name: "FetchError";
80
+ constructor(cause: Error, msg?: string);
81
+ }
82
+ export declare class RequiredError extends Error {
83
+ field: string;
84
+ name: "RequiredError";
85
+ constructor(field: string, msg?: string);
86
+ }
87
+ export declare const COLLECTION_FORMATS: {
88
+ csv: string;
89
+ ssv: string;
90
+ tsv: string;
91
+ pipes: string;
92
+ };
93
+ export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
94
+ export type Json = any;
95
+ export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
96
+ export type HTTPHeaders = {
97
+ [key: string]: string;
98
+ };
99
+ export type HTTPQuery = {
100
+ [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
101
+ };
102
+ export type HTTPBody = Json | FormData | URLSearchParams;
103
+ export type HTTPRequestInit = {
104
+ headers?: HTTPHeaders;
105
+ method: HTTPMethod;
106
+ credentials?: RequestCredentials;
107
+ body?: HTTPBody;
108
+ };
109
+ export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
110
+ export type InitOverrideFunction = (requestContext: {
111
+ init: HTTPRequestInit;
112
+ context: RequestOpts;
113
+ }) => Promise<RequestInit>;
114
+ export interface FetchParams {
115
+ url: string;
116
+ init: RequestInit;
117
+ }
118
+ export interface RequestOpts {
119
+ path: string;
120
+ method: HTTPMethod;
121
+ headers: HTTPHeaders;
122
+ query?: HTTPQuery;
123
+ body?: HTTPBody;
124
+ }
125
+ export declare function querystring(params: HTTPQuery, prefix?: string): string;
126
+ export declare function exists(json: any, key: string): boolean;
127
+ export declare function mapValues(data: any, fn: (item: any) => any): {
128
+ [key: string]: any;
129
+ };
130
+ export declare function canConsumeForm(consumes: Consume[]): boolean;
131
+ export interface Consume {
132
+ contentType: string;
133
+ }
134
+ export interface RequestContext {
135
+ fetch: FetchAPI;
136
+ url: string;
137
+ init: RequestInit;
138
+ }
139
+ export interface ResponseContext {
140
+ fetch: FetchAPI;
141
+ url: string;
142
+ init: RequestInit;
143
+ response: Response;
144
+ }
145
+ export interface ErrorContext {
146
+ fetch: FetchAPI;
147
+ url: string;
148
+ init: RequestInit;
149
+ error: unknown;
150
+ response?: Response;
151
+ }
152
+ export interface Middleware {
153
+ pre?(context: RequestContext): Promise<FetchParams | void>;
154
+ post?(context: ResponseContext): Promise<Response | void>;
155
+ onError?(context: ErrorContext): Promise<Response | void>;
156
+ }
157
+ export interface ApiResponse<T> {
158
+ raw: Response;
159
+ value(): Promise<T>;
160
+ }
161
+ export interface ResponseTransformer<T> {
162
+ (json: any): T;
163
+ }
164
+ export declare class JSONApiResponse<T> {
165
+ raw: Response;
166
+ private transformer;
167
+ constructor(raw: Response, transformer?: ResponseTransformer<T>);
168
+ value(): Promise<T>;
169
+ }
170
+ export declare class VoidApiResponse {
171
+ raw: Response;
172
+ constructor(raw: Response);
173
+ value(): Promise<void>;
174
+ }
175
+ export declare class BlobApiResponse {
176
+ raw: Response;
177
+ constructor(raw: Response);
178
+ value(): Promise<Blob>;
179
+ }
180
+ export declare class TextApiResponse {
181
+ raw: Response;
182
+ constructor(raw: Response);
183
+ value(): Promise<string>;
184
+ }
@@ -0,0 +1,349 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * komputer.ai API
5
+ * 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.
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ export const BASE_PATH = "http://localhost:8080/api/v1".replace(/\/+$/, "");
24
+ export class Configuration {
25
+ constructor(configuration = {}) {
26
+ this.configuration = configuration;
27
+ }
28
+ set config(configuration) {
29
+ this.configuration = configuration;
30
+ }
31
+ get basePath() {
32
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
33
+ }
34
+ get fetchApi() {
35
+ return this.configuration.fetchApi;
36
+ }
37
+ get middleware() {
38
+ return this.configuration.middleware || [];
39
+ }
40
+ get queryParamsStringify() {
41
+ return this.configuration.queryParamsStringify || querystring;
42
+ }
43
+ get username() {
44
+ return this.configuration.username;
45
+ }
46
+ get password() {
47
+ return this.configuration.password;
48
+ }
49
+ get apiKey() {
50
+ const apiKey = this.configuration.apiKey;
51
+ if (apiKey) {
52
+ return typeof apiKey === 'function' ? apiKey : () => apiKey;
53
+ }
54
+ return undefined;
55
+ }
56
+ get accessToken() {
57
+ const accessToken = this.configuration.accessToken;
58
+ if (accessToken) {
59
+ return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
60
+ }
61
+ return undefined;
62
+ }
63
+ get headers() {
64
+ return this.configuration.headers;
65
+ }
66
+ get credentials() {
67
+ return this.configuration.credentials;
68
+ }
69
+ }
70
+ export const DefaultConfig = new Configuration();
71
+ /**
72
+ * This is the base class for all generated API classes.
73
+ */
74
+ export class BaseAPI {
75
+ constructor(configuration = DefaultConfig) {
76
+ this.configuration = configuration;
77
+ this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
78
+ let fetchParams = { url, init };
79
+ for (const middleware of this.middleware) {
80
+ if (middleware.pre) {
81
+ fetchParams = (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
82
+ }
83
+ }
84
+ let response = undefined;
85
+ try {
86
+ response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
87
+ }
88
+ catch (e) {
89
+ for (const middleware of this.middleware) {
90
+ if (middleware.onError) {
91
+ response = (yield middleware.onError({
92
+ fetch: this.fetchApi,
93
+ url: fetchParams.url,
94
+ init: fetchParams.init,
95
+ error: e,
96
+ response: response ? response.clone() : undefined,
97
+ })) || response;
98
+ }
99
+ }
100
+ if (response === undefined) {
101
+ if (e instanceof Error) {
102
+ throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
103
+ }
104
+ else {
105
+ throw e;
106
+ }
107
+ }
108
+ }
109
+ for (const middleware of this.middleware) {
110
+ if (middleware.post) {
111
+ response = (yield middleware.post({
112
+ fetch: this.fetchApi,
113
+ url: fetchParams.url,
114
+ init: fetchParams.init,
115
+ response: response.clone(),
116
+ })) || response;
117
+ }
118
+ }
119
+ return response;
120
+ });
121
+ this.middleware = configuration.middleware;
122
+ }
123
+ withMiddleware(...middlewares) {
124
+ const next = this.clone();
125
+ next.middleware = next.middleware.concat(...middlewares);
126
+ return next;
127
+ }
128
+ withPreMiddleware(...preMiddlewares) {
129
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
130
+ return this.withMiddleware(...middlewares);
131
+ }
132
+ withPostMiddleware(...postMiddlewares) {
133
+ const middlewares = postMiddlewares.map((post) => ({ post }));
134
+ return this.withMiddleware(...middlewares);
135
+ }
136
+ /**
137
+ * Check if the given MIME is a JSON MIME.
138
+ * JSON MIME examples:
139
+ * application/json
140
+ * application/json; charset=UTF8
141
+ * APPLICATION/JSON
142
+ * application/vnd.company+json
143
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
144
+ * @return True if the given MIME is JSON, false otherwise.
145
+ */
146
+ isJsonMime(mime) {
147
+ if (!mime) {
148
+ return false;
149
+ }
150
+ return BaseAPI.jsonRegex.test(mime);
151
+ }
152
+ request(context, initOverrides) {
153
+ return __awaiter(this, void 0, void 0, function* () {
154
+ const { url, init } = yield this.createFetchParams(context, initOverrides);
155
+ const response = yield this.fetchApi(url, init);
156
+ if (response && (response.status >= 200 && response.status < 300)) {
157
+ return response;
158
+ }
159
+ throw new ResponseError(response, 'Response returned an error code');
160
+ });
161
+ }
162
+ createFetchParams(context, initOverrides) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ let url = this.configuration.basePath + context.path;
165
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
166
+ // only add the querystring to the URL if there are query parameters.
167
+ // this is done to avoid urls ending with a "?" character which buggy webservers
168
+ // do not handle correctly sometimes.
169
+ url += '?' + this.configuration.queryParamsStringify(context.query);
170
+ }
171
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
172
+ Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
173
+ const initOverrideFn = typeof initOverrides === "function"
174
+ ? initOverrides
175
+ : () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
176
+ const initParams = {
177
+ method: context.method,
178
+ headers,
179
+ body: context.body,
180
+ credentials: this.configuration.credentials,
181
+ };
182
+ const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
183
+ init: initParams,
184
+ context,
185
+ })));
186
+ let body;
187
+ if (isFormData(overriddenInit.body)
188
+ || (overriddenInit.body instanceof URLSearchParams)
189
+ || isBlob(overriddenInit.body)) {
190
+ body = overriddenInit.body;
191
+ }
192
+ else if (this.isJsonMime(headers['Content-Type'])) {
193
+ body = JSON.stringify(overriddenInit.body);
194
+ }
195
+ else {
196
+ body = overriddenInit.body;
197
+ }
198
+ const init = Object.assign(Object.assign({}, overriddenInit), { body });
199
+ return { url, init };
200
+ });
201
+ }
202
+ /**
203
+ * Create a shallow clone of `this` by constructing a new instance
204
+ * and then shallow cloning data members.
205
+ */
206
+ clone() {
207
+ const constructor = this.constructor;
208
+ const next = new constructor(this.configuration);
209
+ next.middleware = this.middleware.slice();
210
+ return next;
211
+ }
212
+ }
213
+ BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
214
+ ;
215
+ function isBlob(value) {
216
+ return typeof Blob !== 'undefined' && value instanceof Blob;
217
+ }
218
+ function isFormData(value) {
219
+ return typeof FormData !== "undefined" && value instanceof FormData;
220
+ }
221
+ export class ResponseError extends Error {
222
+ constructor(response, msg) {
223
+ super(msg);
224
+ this.response = response;
225
+ this.name = "ResponseError";
226
+ // restore prototype chain
227
+ const actualProto = new.target.prototype;
228
+ if (Object.setPrototypeOf) {
229
+ Object.setPrototypeOf(this, actualProto);
230
+ }
231
+ }
232
+ }
233
+ export class FetchError extends Error {
234
+ constructor(cause, msg) {
235
+ super(msg);
236
+ this.cause = cause;
237
+ this.name = "FetchError";
238
+ // restore prototype chain
239
+ const actualProto = new.target.prototype;
240
+ if (Object.setPrototypeOf) {
241
+ Object.setPrototypeOf(this, actualProto);
242
+ }
243
+ }
244
+ }
245
+ export class RequiredError extends Error {
246
+ constructor(field, msg) {
247
+ super(msg);
248
+ this.field = field;
249
+ this.name = "RequiredError";
250
+ // restore prototype chain
251
+ const actualProto = new.target.prototype;
252
+ if (Object.setPrototypeOf) {
253
+ Object.setPrototypeOf(this, actualProto);
254
+ }
255
+ }
256
+ }
257
+ export const COLLECTION_FORMATS = {
258
+ csv: ",",
259
+ ssv: " ",
260
+ tsv: "\t",
261
+ pipes: "|",
262
+ };
263
+ export function querystring(params, prefix = '') {
264
+ return Object.keys(params)
265
+ .map(key => querystringSingleKey(key, params[key], prefix))
266
+ .filter(part => part.length > 0)
267
+ .join('&');
268
+ }
269
+ function querystringSingleKey(key, value, keyPrefix = '') {
270
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
271
+ if (value instanceof Array) {
272
+ const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
273
+ .join(`&${encodeURIComponent(fullKey)}=`);
274
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
275
+ }
276
+ if (value instanceof Set) {
277
+ const valueAsArray = Array.from(value);
278
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
279
+ }
280
+ if (value instanceof Date) {
281
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
282
+ }
283
+ if (value instanceof Object) {
284
+ return querystring(value, fullKey);
285
+ }
286
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
287
+ }
288
+ export function exists(json, key) {
289
+ const value = json[key];
290
+ return value !== null && value !== undefined;
291
+ }
292
+ export function mapValues(data, fn) {
293
+ const result = {};
294
+ for (const key of Object.keys(data)) {
295
+ result[key] = fn(data[key]);
296
+ }
297
+ return result;
298
+ }
299
+ export function canConsumeForm(consumes) {
300
+ for (const consume of consumes) {
301
+ if ('multipart/form-data' === consume.contentType) {
302
+ return true;
303
+ }
304
+ }
305
+ return false;
306
+ }
307
+ export class JSONApiResponse {
308
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
309
+ this.raw = raw;
310
+ this.transformer = transformer;
311
+ }
312
+ value() {
313
+ return __awaiter(this, void 0, void 0, function* () {
314
+ return this.transformer(yield this.raw.json());
315
+ });
316
+ }
317
+ }
318
+ export class VoidApiResponse {
319
+ constructor(raw) {
320
+ this.raw = raw;
321
+ }
322
+ value() {
323
+ return __awaiter(this, void 0, void 0, function* () {
324
+ return undefined;
325
+ });
326
+ }
327
+ }
328
+ export class BlobApiResponse {
329
+ constructor(raw) {
330
+ this.raw = raw;
331
+ }
332
+ value() {
333
+ return __awaiter(this, void 0, void 0, function* () {
334
+ return yield this.raw.blob();
335
+ });
336
+ }
337
+ ;
338
+ }
339
+ export class TextApiResponse {
340
+ constructor(raw) {
341
+ this.raw = raw;
342
+ }
343
+ value() {
344
+ return __awaiter(this, void 0, void 0, function* () {
345
+ return yield this.raw.text();
346
+ });
347
+ }
348
+ ;
349
+ }
@@ -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
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * WebSocket streaming for agents — hand-written, preserved across regeneration.
3
+ */
4
+ /**
5
+ * Async iterable stream of agent events over WebSocket.
6
+ * Yields pre-fetched history events first, then live WebSocket events,
7
+ * deduplicating by timestamp+type.
8
+ *
9
+ * @example
10
+ * for await (const event of client.watchAgent("my-agent")) {
11
+ * if (event.type === "text") console.log(event.payload.content);
12
+ * if (event.type === "task_completed") break;
13
+ * }
14
+ */
15
+ export class AgentEventStream {
16
+ constructor(wsUrl, agentName, historyEvents) {
17
+ this.queue = [];
18
+ this.resolve = null;
19
+ this.done = false;
20
+ this.seen = new Set();
21
+ this.agentName = agentName;
22
+ // Seed dedup set and queue with history events.
23
+ if (historyEvents) {
24
+ for (const e of historyEvents) {
25
+ const key = this.dedupKey(e);
26
+ this.seen.add(key);
27
+ this.queue.push(e);
28
+ }
29
+ }
30
+ this.ws = new WebSocket(`${wsUrl}/api/v1/agents/${agentName}/ws`);
31
+ this.ws.onmessage = (event) => {
32
+ const data = JSON.parse(event.data);
33
+ const agentEvent = {
34
+ agentName: data.agentName || this.agentName,
35
+ type: data.type || "",
36
+ timestamp: data.timestamp || "",
37
+ payload: data.payload || {},
38
+ };
39
+ const key = this.dedupKey(agentEvent);
40
+ if (this.seen.has(key))
41
+ return;
42
+ this.seen.add(key);
43
+ if (this.resolve) {
44
+ const r = this.resolve;
45
+ this.resolve = null;
46
+ r({ value: agentEvent, done: false });
47
+ }
48
+ else {
49
+ this.queue.push(agentEvent);
50
+ }
51
+ };
52
+ this.ws.onclose = () => {
53
+ this.done = true;
54
+ if (this.resolve) {
55
+ const r = this.resolve;
56
+ this.resolve = null;
57
+ r({ value: undefined, done: true });
58
+ }
59
+ };
60
+ this.ws.onerror = () => {
61
+ this.done = true;
62
+ if (this.resolve) {
63
+ const r = this.resolve;
64
+ this.resolve = null;
65
+ r({ value: undefined, done: true });
66
+ }
67
+ };
68
+ }
69
+ dedupKey(e) {
70
+ const normType = e.type === "task_started" ? "user_message" : e.type;
71
+ return `${e.timestamp}:${normType}`;
72
+ }
73
+ [Symbol.asyncIterator]() {
74
+ return {
75
+ next: () => {
76
+ if (this.queue.length > 0) {
77
+ return Promise.resolve({ value: this.queue.shift(), done: false });
78
+ }
79
+ if (this.done) {
80
+ return Promise.resolve({ value: undefined, done: true });
81
+ }
82
+ return new Promise((resolve) => {
83
+ this.resolve = resolve;
84
+ });
85
+ },
86
+ return: () => {
87
+ this.close();
88
+ return Promise.resolve({ value: undefined, done: true });
89
+ },
90
+ };
91
+ }
92
+ close() {
93
+ this.done = true;
94
+ this.ws.close();
95
+ }
96
+ }
@@ -0,0 +1,5 @@
1
+ export * from './runtime';
2
+ export * from './apis/index';
3
+ export * from './models/index';
4
+ export { KomputerClient } from './client';
5
+ export type { AgentEvent } from './watch';
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.KomputerClient = void 0;
18
+ /* tslint:disable */
19
+ /* eslint-disable */
20
+ __exportStar(require("./runtime"), exports);
21
+ __exportStar(require("./apis/index"), exports);
22
+ __exportStar(require("./models/index"), exports);
23
+ var client_1 = require("./client");
24
+ Object.defineProperty(exports, "KomputerClient", { enumerable: true, get: function () { return client_1.KomputerClient; } });