@onkernel/sdk 0.2.0 → 0.4.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 (54) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +21 -14
  3. package/client.d.mts +2 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/apps/apps.d.mts +2 -2
  11. package/resources/apps/apps.d.mts.map +1 -1
  12. package/resources/apps/apps.d.ts +2 -2
  13. package/resources/apps/apps.d.ts.map +1 -1
  14. package/resources/apps/apps.js.map +1 -1
  15. package/resources/apps/apps.mjs.map +1 -1
  16. package/resources/apps/index.d.mts +1 -1
  17. package/resources/apps/index.d.mts.map +1 -1
  18. package/resources/apps/index.d.ts +1 -1
  19. package/resources/apps/index.d.ts.map +1 -1
  20. package/resources/apps/index.js.map +1 -1
  21. package/resources/apps/index.mjs.map +1 -1
  22. package/resources/apps/invocations.d.mts +69 -2
  23. package/resources/apps/invocations.d.mts.map +1 -1
  24. package/resources/apps/invocations.d.ts +69 -2
  25. package/resources/apps/invocations.d.ts.map +1 -1
  26. package/resources/apps/invocations.js +15 -1
  27. package/resources/apps/invocations.js.map +1 -1
  28. package/resources/apps/invocations.mjs +15 -1
  29. package/resources/apps/invocations.mjs.map +1 -1
  30. package/resources/browsers.d.mts +83 -3
  31. package/resources/browsers.d.mts.map +1 -1
  32. package/resources/browsers.d.ts +83 -3
  33. package/resources/browsers.d.ts.map +1 -1
  34. package/resources/browsers.js +48 -2
  35. package/resources/browsers.js.map +1 -1
  36. package/resources/browsers.mjs +48 -2
  37. package/resources/browsers.mjs.map +1 -1
  38. package/resources/index.d.mts +1 -1
  39. package/resources/index.d.mts.map +1 -1
  40. package/resources/index.d.ts +1 -1
  41. package/resources/index.d.ts.map +1 -1
  42. package/resources/index.js.map +1 -1
  43. package/resources/index.mjs.map +1 -1
  44. package/src/client.ts +6 -0
  45. package/src/resources/apps/apps.ts +4 -0
  46. package/src/resources/apps/index.ts +2 -0
  47. package/src/resources/apps/invocations.ts +89 -1
  48. package/src/resources/browsers.ts +113 -2
  49. package/src/resources/index.ts +3 -0
  50. package/src/version.ts +1 -1
  51. package/version.d.mts +1 -1
  52. package/version.d.ts +1 -1
  53. package/version.js +1 -1
  54. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -23,6 +23,9 @@ import { FinalRequestOptions, RequestOptions } from './internal/request-options'
23
23
  import {
24
24
  BrowserCreateParams,
25
25
  BrowserCreateResponse,
26
+ BrowserDeleteParams,
27
+ BrowserListResponse,
28
+ BrowserPersistence,
26
29
  BrowserRetrieveResponse,
27
30
  Browsers,
28
31
  } from './resources/browsers';
@@ -744,8 +747,11 @@ export declare namespace Kernel {
744
747
 
745
748
  export {
746
749
  Browsers as Browsers,
750
+ type BrowserPersistence as BrowserPersistence,
747
751
  type BrowserCreateResponse as BrowserCreateResponse,
748
752
  type BrowserRetrieveResponse as BrowserRetrieveResponse,
753
+ type BrowserListResponse as BrowserListResponse,
749
754
  type BrowserCreateParams as BrowserCreateParams,
755
+ type BrowserDeleteParams as BrowserDeleteParams,
750
756
  };
751
757
  }
@@ -13,6 +13,8 @@ import {
13
13
  InvocationCreateParams,
14
14
  InvocationCreateResponse,
15
15
  InvocationRetrieveResponse,
16
+ InvocationUpdateParams,
17
+ InvocationUpdateResponse,
16
18
  Invocations,
17
19
  } from './invocations';
18
20
  import { APIPromise } from '../../core/api-promise';
@@ -99,6 +101,8 @@ export declare namespace Apps {
99
101
  Invocations as Invocations,
100
102
  type InvocationCreateResponse as InvocationCreateResponse,
101
103
  type InvocationRetrieveResponse as InvocationRetrieveResponse,
104
+ type InvocationUpdateResponse as InvocationUpdateResponse,
102
105
  type InvocationCreateParams as InvocationCreateParams,
106
+ type InvocationUpdateParams as InvocationUpdateParams,
103
107
  };
104
108
  }
@@ -11,5 +11,7 @@ export {
11
11
  Invocations,
12
12
  type InvocationCreateResponse,
13
13
  type InvocationRetrieveResponse,
14
+ type InvocationUpdateResponse,
14
15
  type InvocationCreateParams,
16
+ type InvocationUpdateParams,
15
17
  } from './invocations';
@@ -28,13 +28,32 @@ export class Invocations extends APIResource {
28
28
  * @example
29
29
  * ```ts
30
30
  * const invocation = await client.apps.invocations.retrieve(
31
- * 'ckqwer3o20000jb9s7abcdef',
31
+ * 'rr33xuugxj9h0bkf1rdt2bet',
32
32
  * );
33
33
  * ```
34
34
  */
35
35
  retrieve(id: string, options?: RequestOptions): APIPromise<InvocationRetrieveResponse> {
36
36
  return this._client.get(path`/invocations/${id}`, options);
37
37
  }
38
+
39
+ /**
40
+ * Update invocation status or output
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const invocation = await client.apps.invocations.update(
45
+ * 'id',
46
+ * { status: 'succeeded' },
47
+ * );
48
+ * ```
49
+ */
50
+ update(
51
+ id: string,
52
+ body: InvocationUpdateParams,
53
+ options?: RequestOptions,
54
+ ): APIPromise<InvocationUpdateResponse> {
55
+ return this._client.patch(path`/invocations/${id}`, { body, ...options });
56
+ }
38
57
  }
39
58
 
40
59
  export interface InvocationCreateResponse {
@@ -109,6 +128,55 @@ export interface InvocationRetrieveResponse {
109
128
  status_reason?: string;
110
129
  }
111
130
 
131
+ export interface InvocationUpdateResponse {
132
+ /**
133
+ * ID of the invocation
134
+ */
135
+ id: string;
136
+
137
+ /**
138
+ * Name of the action invoked
139
+ */
140
+ action_name: string;
141
+
142
+ /**
143
+ * Name of the application
144
+ */
145
+ app_name: string;
146
+
147
+ /**
148
+ * RFC 3339 Nanoseconds timestamp when the invocation started
149
+ */
150
+ started_at: string;
151
+
152
+ /**
153
+ * Status of the invocation
154
+ */
155
+ status: 'queued' | 'running' | 'succeeded' | 'failed';
156
+
157
+ /**
158
+ * RFC 3339 Nanoseconds timestamp when the invocation finished (null if still
159
+ * running)
160
+ */
161
+ finished_at?: string | null;
162
+
163
+ /**
164
+ * Output produced by the action, rendered as a JSON string. This could be: string,
165
+ * number, boolean, array, object, or null.
166
+ */
167
+ output?: string;
168
+
169
+ /**
170
+ * Payload provided to the invocation. This is a string that can be parsed as JSON.
171
+ */
172
+ payload?: string;
173
+
174
+ /**
175
+ * Status reason
176
+ */
177
+ status_reason?: string;
178
+ }
179
+
112
180
  export interface InvocationCreateParams {
113
181
  /**
114
182
  * Name of the action to invoke
@@ -125,16 +193,36 @@ export interface InvocationCreateParams {
125
193
  */
126
194
  version: string;
127
195
 
196
+ /**
197
+ * If true, invoke asynchronously. When set, the API responds 202 Accepted with
198
+ * status "queued".
199
+ */
200
+ async?: boolean;
201
+
128
202
  /**
129
203
  * Input data for the action, sent as a JSON string.
130
204
  */
131
205
  payload?: string;
132
206
  }
133
207
 
208
+ export interface InvocationUpdateParams {
209
+ /**
210
+ * New status for the invocation.
211
+ */
212
+ status: 'succeeded' | 'failed';
213
+
214
+ /**
215
+ * Updated output of the invocation rendered as JSON string.
216
+ */
217
+ output?: string;
218
+ }
219
+
134
220
  export declare namespace Invocations {
135
221
  export {
136
222
  type InvocationCreateResponse as InvocationCreateResponse,
137
223
  type InvocationRetrieveResponse as InvocationRetrieveResponse,
224
+ type InvocationUpdateResponse as InvocationUpdateResponse,
138
225
  type InvocationCreateParams as InvocationCreateParams,
226
+ type InvocationUpdateParams as InvocationUpdateParams,
139
227
  };
140
228
  }
@@ -1,7 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import * as BrowsersAPI from './browsers';
4
5
  import { APIPromise } from '../core/api-promise';
6
+ import { buildHeaders } from '../internal/headers';
5
7
  import { RequestOptions } from '../internal/request-options';
6
8
  import { path } from '../internal/utils/path';
7
9
 
@@ -12,7 +14,7 @@ export class Browsers extends APIResource {
12
14
  * @example
13
15
  * ```ts
14
16
  * const browser = await client.browsers.create({
15
- * invocation_id: 'ckqwer3o20000jb9s7abcdef',
17
+ * invocation_id: 'rr33xuugxj9h0bkf1rdt2bet',
16
18
  * });
17
19
  * ```
18
20
  */
@@ -26,13 +28,71 @@ export class Browsers extends APIResource {
26
28
  * @example
27
29
  * ```ts
28
30
  * const browser = await client.browsers.retrieve(
29
- * 'e5bf36fe-9247-4e2b-8b5a-2f594cc1c073',
31
+ * 'htzv5orfit78e1m2biiifpbv',
30
32
  * );
31
33
  * ```
32
34
  */
33
35
  retrieve(id: string, options?: RequestOptions): APIPromise<BrowserRetrieveResponse> {
34
36
  return this._client.get(path`/browsers/${id}`, options);
35
37
  }
38
+
39
+ /**
40
+ * List active browser sessions for the authenticated user
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const browsers = await client.browsers.list();
45
+ * ```
46
+ */
47
+ list(options?: RequestOptions): APIPromise<BrowserListResponse> {
48
+ return this._client.get('/browsers', options);
49
+ }
50
+
51
+ /**
52
+ * Delete a persistent browser session by persistent_id query parameter.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * await client.browsers.delete({
57
+ * persistent_id: 'persistent_id',
58
+ * });
59
+ * ```
60
+ */
61
+ delete(params: BrowserDeleteParams, options?: RequestOptions): APIPromise<void> {
62
+ const { persistent_id } = params;
63
+ return this._client.delete('/browsers', {
64
+ query: { persistent_id },
65
+ ...options,
66
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
67
+ });
68
+ }
69
+
70
+ /**
71
+ * Delete Browser Session by ID
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * await client.browsers.deleteByID(
76
+ * 'htzv5orfit78e1m2biiifpbv',
77
+ * );
78
+ * ```
79
+ */
80
+ deleteByID(id: string, options?: RequestOptions): APIPromise<void> {
81
+ return this._client.delete(path`/browsers/${id}`, {
82
+ ...options,
83
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
84
+ });
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Optional persistence configuration for the browser session.
90
+ */
91
+ export interface BrowserPersistence {
92
+ /**
93
+ * Unique identifier for the persistent browser session.
94
+ */
95
+ id: string;
36
96
  }
37
97
 
38
98
  export interface BrowserCreateResponse {
@@ -50,6 +110,11 @@ export interface BrowserCreateResponse {
50
110
  * Unique identifier for the browser session
51
111
  */
52
112
  session_id: string;
113
+
114
+ /**
115
+ * Optional persistence configuration for the browser session.
116
+ */
117
+ persistence?: BrowserPersistence;
53
118
  }
54
119
 
55
120
  export interface BrowserRetrieveResponse {
@@ -67,6 +132,37 @@ export interface BrowserRetrieveResponse {
67
132
  * Unique identifier for the browser session
68
133
  */
69
134
  session_id: string;
135
+
136
+ /**
137
+ * Optional persistence configuration for the browser session.
138
+ */
139
+ persistence?: BrowserPersistence;
140
+ }
141
+
142
+ export type BrowserListResponse = Array<BrowserListResponse.BrowserListResponseItem>;
143
+
144
+ export namespace BrowserListResponse {
145
+ export interface BrowserListResponseItem {
146
+ /**
147
+ * Remote URL for live viewing the browser session
148
+ */
149
+ browser_live_view_url: string;
150
+
151
+ /**
152
+ * Websocket URL for Chrome DevTools Protocol connections to the browser session
153
+ */
154
+ cdp_ws_url: string;
155
+
156
+ /**
157
+ * Unique identifier for the browser session
158
+ */
159
+ session_id: string;
160
+
161
+ /**
162
+ * Optional persistence configuration for the browser session.
163
+ */
164
+ persistence?: BrowsersAPI.BrowserPersistence;
165
+ }
70
166
  }
71
167
 
72
168
  export interface BrowserCreateParams {
@@ -74,12 +170,27 @@ export interface BrowserCreateParams {
74
170
  * action invocation ID
75
171
  */
76
172
  invocation_id: string;
173
+
174
+ /**
175
+ * Optional persistence configuration for the browser session.
176
+ */
177
+ persistence?: BrowserPersistence;
178
+ }
179
+
180
+ export interface BrowserDeleteParams {
181
+ /**
182
+ * Persistent browser identifier
183
+ */
184
+ persistent_id: string;
77
185
  }
78
186
 
79
187
  export declare namespace Browsers {
80
188
  export {
189
+ type BrowserPersistence as BrowserPersistence,
81
190
  type BrowserCreateResponse as BrowserCreateResponse,
82
191
  type BrowserRetrieveResponse as BrowserRetrieveResponse,
192
+ type BrowserListResponse as BrowserListResponse,
83
193
  type BrowserCreateParams as BrowserCreateParams,
194
+ type BrowserDeleteParams as BrowserDeleteParams,
84
195
  };
85
196
  }
@@ -3,7 +3,10 @@
3
3
  export { Apps, type AppListResponse, type AppListParams } from './apps/apps';
4
4
  export {
5
5
  Browsers,
6
+ type BrowserPersistence,
6
7
  type BrowserCreateResponse,
7
8
  type BrowserRetrieveResponse,
9
+ type BrowserListResponse,
8
10
  type BrowserCreateParams,
11
+ type BrowserDeleteParams,
9
12
  } from './browsers';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.0'; // x-release-please-version
1
+ export const VERSION = '0.4.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.4.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.4.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.2.0'; // x-release-please-version
4
+ exports.VERSION = '0.4.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.0'; // x-release-please-version
1
+ export const VERSION = '0.4.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map