@cyberstrike-io/sdk 1.1.15-beta.2 → 1.1.16-beta.4
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.
- package/dist/v2/gen/client/client.gen.js +107 -125
- package/dist/v2/gen/client/types.gen.d.ts +7 -4
- package/dist/v2/gen/client/utils.gen.d.ts +7 -3
- package/dist/v2/gen/client/utils.gen.js +4 -4
- package/dist/v2/gen/core/bodySerializer.gen.d.ts +4 -4
- package/dist/v2/gen/core/params.gen.js +5 -5
- package/dist/v2/gen/core/serverSentEvents.gen.d.ts +1 -1
- package/dist/v2/gen/core/serverSentEvents.gen.js +3 -4
- package/dist/v2/gen/core/types.gen.d.ts +1 -1
- package/dist/v2/gen/core/utils.gen.js +1 -1
- package/dist/v2/gen/sdk.gen.d.ts +55 -55
- package/dist/v2/gen/sdk.gen.js +4 -4
- package/dist/v2/gen/types.gen.d.ts +6 -7
- package/package.json +2 -2
|
@@ -19,10 +19,7 @@ export const createClient = (config = {}) => {
|
|
|
19
19
|
serializedBody: undefined,
|
|
20
20
|
};
|
|
21
21
|
if (opts.security) {
|
|
22
|
-
await setAuthParams(
|
|
23
|
-
...opts,
|
|
24
|
-
security: opts.security,
|
|
25
|
-
});
|
|
22
|
+
await setAuthParams(opts);
|
|
26
23
|
}
|
|
27
24
|
if (opts.requestValidator) {
|
|
28
25
|
await opts.requestValidator(opts);
|
|
@@ -34,152 +31,137 @@ export const createClient = (config = {}) => {
|
|
|
34
31
|
if (opts.body === undefined || opts.serializedBody === "") {
|
|
35
32
|
opts.headers.delete("Content-Type");
|
|
36
33
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
34
|
+
const resolvedOpts = opts;
|
|
35
|
+
const url = buildUrl(resolvedOpts);
|
|
36
|
+
return { opts: resolvedOpts, url };
|
|
39
37
|
};
|
|
40
38
|
const request = async (options) => {
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
redirect: "follow",
|
|
45
|
-
...opts,
|
|
46
|
-
body: getValidRequestBody(opts),
|
|
47
|
-
};
|
|
48
|
-
let request = new Request(url, requestInit);
|
|
49
|
-
for (const fn of interceptors.request.fns) {
|
|
50
|
-
if (fn) {
|
|
51
|
-
request = await fn(request, opts);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// fetch must be assigned here, otherwise it would throw the error:
|
|
55
|
-
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
56
|
-
const _fetch = opts.fetch;
|
|
39
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
40
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
41
|
+
let request;
|
|
57
42
|
let response;
|
|
58
43
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
44
|
+
const { opts, url } = await beforeRequest(options);
|
|
45
|
+
const requestInit = {
|
|
46
|
+
redirect: "follow",
|
|
47
|
+
...opts,
|
|
48
|
+
body: getValidRequestBody(opts),
|
|
49
|
+
};
|
|
50
|
+
request = new Request(url, requestInit);
|
|
51
|
+
for (const fn of interceptors.request.fns) {
|
|
65
52
|
if (fn) {
|
|
66
|
-
|
|
53
|
+
request = await fn(request, opts);
|
|
67
54
|
}
|
|
68
55
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
error: finalError,
|
|
78
|
-
request,
|
|
79
|
-
response: undefined,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
for (const fn of interceptors.response.fns) {
|
|
83
|
-
if (fn) {
|
|
84
|
-
response = await fn(response, request, opts);
|
|
56
|
+
// fetch must be assigned here, otherwise it would throw the error:
|
|
57
|
+
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
58
|
+
const _fetch = opts.fetch;
|
|
59
|
+
response = await _fetch(request);
|
|
60
|
+
for (const fn of interceptors.response.fns) {
|
|
61
|
+
if (fn) {
|
|
62
|
+
response = await fn(response, request, opts);
|
|
63
|
+
}
|
|
85
64
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
65
|
+
const result = {
|
|
66
|
+
request,
|
|
67
|
+
response,
|
|
68
|
+
};
|
|
69
|
+
if (response.ok) {
|
|
70
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
71
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
72
|
+
let emptyData;
|
|
73
|
+
switch (parseAs) {
|
|
74
|
+
case "arrayBuffer":
|
|
75
|
+
case "blob":
|
|
76
|
+
case "text":
|
|
77
|
+
emptyData = await response[parseAs]();
|
|
78
|
+
break;
|
|
79
|
+
case "formData":
|
|
80
|
+
emptyData = new FormData();
|
|
81
|
+
break;
|
|
82
|
+
case "stream":
|
|
83
|
+
emptyData = response.body;
|
|
84
|
+
break;
|
|
85
|
+
case "json":
|
|
86
|
+
default:
|
|
87
|
+
emptyData = {};
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return opts.responseStyle === "data"
|
|
91
|
+
? emptyData
|
|
92
|
+
: {
|
|
93
|
+
data: emptyData,
|
|
94
|
+
...result,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
let data;
|
|
95
98
|
switch (parseAs) {
|
|
96
99
|
case "arrayBuffer":
|
|
97
100
|
case "blob":
|
|
101
|
+
case "formData":
|
|
98
102
|
case "text":
|
|
99
|
-
|
|
103
|
+
data = await response[parseAs]();
|
|
100
104
|
break;
|
|
101
|
-
case "
|
|
102
|
-
|
|
105
|
+
case "json": {
|
|
106
|
+
// Some servers return 200 with no Content-Length and empty body.
|
|
107
|
+
// response.json() would throw; read as text and parse if non-empty.
|
|
108
|
+
const text = await response.text();
|
|
109
|
+
data = text ? JSON.parse(text) : {};
|
|
103
110
|
break;
|
|
111
|
+
}
|
|
104
112
|
case "stream":
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
return opts.responseStyle === "data"
|
|
114
|
+
? response.body
|
|
115
|
+
: {
|
|
116
|
+
data: response.body,
|
|
117
|
+
...result,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (parseAs === "json") {
|
|
121
|
+
if (opts.responseValidator) {
|
|
122
|
+
await opts.responseValidator(data);
|
|
123
|
+
}
|
|
124
|
+
if (opts.responseTransformer) {
|
|
125
|
+
data = await opts.responseTransformer(data);
|
|
126
|
+
}
|
|
111
127
|
}
|
|
112
128
|
return opts.responseStyle === "data"
|
|
113
|
-
?
|
|
129
|
+
? data
|
|
114
130
|
: {
|
|
115
|
-
data
|
|
131
|
+
data,
|
|
116
132
|
...result,
|
|
117
133
|
};
|
|
118
134
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
case "formData":
|
|
124
|
-
case "text":
|
|
125
|
-
data = await response[parseAs]();
|
|
126
|
-
break;
|
|
127
|
-
case "json": {
|
|
128
|
-
// Some servers return 200 with no Content-Length and empty body.
|
|
129
|
-
// response.json() would throw; read as text and parse if non-empty.
|
|
130
|
-
const text = await response.text();
|
|
131
|
-
data = text ? JSON.parse(text) : {};
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
case "stream":
|
|
135
|
-
return opts.responseStyle === "data"
|
|
136
|
-
? response.body
|
|
137
|
-
: {
|
|
138
|
-
data: response.body,
|
|
139
|
-
...result,
|
|
140
|
-
};
|
|
135
|
+
const textError = await response.text();
|
|
136
|
+
let jsonError;
|
|
137
|
+
try {
|
|
138
|
+
jsonError = JSON.parse(textError);
|
|
141
139
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
catch {
|
|
141
|
+
// noop
|
|
142
|
+
}
|
|
143
|
+
throw jsonError ?? textError;
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
let finalError = error;
|
|
147
|
+
for (const fn of interceptors.error.fns) {
|
|
148
|
+
if (fn) {
|
|
149
|
+
finalError = await fn(finalError, response, request, options);
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
finalError = finalError || {};
|
|
153
|
+
if (throwOnError) {
|
|
154
|
+
throw finalError;
|
|
155
|
+
}
|
|
156
|
+
// TODO: we probably want to return error and improve types
|
|
157
|
+
return responseStyle === "data"
|
|
158
|
+
? undefined
|
|
152
159
|
: {
|
|
153
|
-
|
|
154
|
-
|
|
160
|
+
error: finalError,
|
|
161
|
+
request,
|
|
162
|
+
response,
|
|
155
163
|
};
|
|
156
164
|
}
|
|
157
|
-
const textError = await response.text();
|
|
158
|
-
let jsonError;
|
|
159
|
-
try {
|
|
160
|
-
jsonError = JSON.parse(textError);
|
|
161
|
-
}
|
|
162
|
-
catch {
|
|
163
|
-
// noop
|
|
164
|
-
}
|
|
165
|
-
const error = jsonError ?? textError;
|
|
166
|
-
let finalError = error;
|
|
167
|
-
for (const fn of interceptors.error.fns) {
|
|
168
|
-
if (fn) {
|
|
169
|
-
finalError = (await fn(error, response, request, opts));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
finalError = finalError || {};
|
|
173
|
-
if (opts.throwOnError) {
|
|
174
|
-
throw finalError;
|
|
175
|
-
}
|
|
176
|
-
// TODO: we probably want to return error and improve types
|
|
177
|
-
return opts.responseStyle === "data"
|
|
178
|
-
? undefined
|
|
179
|
-
: {
|
|
180
|
-
error: finalError,
|
|
181
|
-
...result,
|
|
182
|
-
};
|
|
183
165
|
};
|
|
184
166
|
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
185
167
|
const makeSseFn = (method) => async (options) => {
|
|
@@ -187,7 +169,6 @@ export const createClient = (config = {}) => {
|
|
|
187
169
|
return createSseClient({
|
|
188
170
|
...opts,
|
|
189
171
|
body: opts.body,
|
|
190
|
-
headers: opts.headers,
|
|
191
172
|
method,
|
|
192
173
|
onRequest: async (url, init) => {
|
|
193
174
|
let request = new Request(url, init);
|
|
@@ -202,8 +183,9 @@ export const createClient = (config = {}) => {
|
|
|
202
183
|
url,
|
|
203
184
|
});
|
|
204
185
|
};
|
|
186
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
205
187
|
return {
|
|
206
|
-
buildUrl,
|
|
188
|
+
buildUrl: _buildUrl,
|
|
207
189
|
connect: makeMethodFn("CONNECT"),
|
|
208
190
|
delete: makeMethodFn("DELETE"),
|
|
209
191
|
get: makeMethodFn("GET"),
|
|
@@ -47,7 +47,7 @@ export interface Config<T extends ClientOptions = ClientOptions> extends Omit<Re
|
|
|
47
47
|
export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
48
48
|
responseStyle: TResponseStyle;
|
|
49
49
|
throwOnError: ThrowOnError;
|
|
50
|
-
}>, Pick<ServerSentEventsOptions<TData>, "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay"> {
|
|
50
|
+
}>, Pick<ServerSentEventsOptions<TData>, "onRequest" | "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay"> {
|
|
51
51
|
/**
|
|
52
52
|
* Any body that you want to add to your request.
|
|
53
53
|
*
|
|
@@ -63,6 +63,7 @@ export interface RequestOptions<TData = unknown, TResponseStyle extends Response
|
|
|
63
63
|
url: Url;
|
|
64
64
|
}
|
|
65
65
|
export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
66
|
+
headers: Headers;
|
|
66
67
|
serializedBody?: string;
|
|
67
68
|
}
|
|
68
69
|
export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = "fields"> = ThrowOnError extends true ? Promise<TResponseStyle extends "data" ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
|
|
@@ -76,8 +77,10 @@ export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extend
|
|
|
76
77
|
data: undefined;
|
|
77
78
|
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
78
79
|
}) & {
|
|
79
|
-
request
|
|
80
|
-
|
|
80
|
+
/** request may be undefined, because error may be from building the request object itself */
|
|
81
|
+
request?: Request;
|
|
82
|
+
/** response may be undefined, because error may be from building the request object itself or from a network error */
|
|
83
|
+
response?: Response;
|
|
81
84
|
}>;
|
|
82
85
|
export interface ClientOptions {
|
|
83
86
|
baseUrl?: string;
|
|
@@ -85,7 +88,7 @@ export interface ClientOptions {
|
|
|
85
88
|
throwOnError?: boolean;
|
|
86
89
|
}
|
|
87
90
|
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
88
|
-
type SseFn = <TData = unknown,
|
|
91
|
+
type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, "method">) => Promise<ServerSentEventsResult<TData>>;
|
|
89
92
|
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method"> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
90
93
|
type BuildUrlFn = <TData extends {
|
|
91
94
|
body?: unknown;
|
|
@@ -5,13 +5,17 @@ export declare const createQuerySerializer: <T = unknown>({ parameters, ...args
|
|
|
5
5
|
* Infers parseAs value from provided Content-Type header.
|
|
6
6
|
*/
|
|
7
7
|
export declare const getParseAs: (contentType: string | null) => Exclude<Config["parseAs"], "auto">;
|
|
8
|
-
export declare
|
|
8
|
+
export declare function setAuthParams(options: Pick<RequestOptions, "auth" | "query" | "security"> & {
|
|
9
9
|
headers: Headers;
|
|
10
|
-
})
|
|
10
|
+
}): Promise<void>;
|
|
11
11
|
export declare const buildUrl: Client["buildUrl"];
|
|
12
12
|
export declare const mergeConfigs: (a: Config, b: Config) => Config;
|
|
13
13
|
export declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
|
|
14
|
-
type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
|
|
14
|
+
type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
|
|
15
|
+
/** response may be undefined due to a network error where no response object is produced */
|
|
16
|
+
response: Res | undefined,
|
|
17
|
+
/** request may be undefined, because error may be from building the request object itself */
|
|
18
|
+
request: Req | undefined, options: Options) => Err | Promise<Err>;
|
|
15
19
|
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
16
20
|
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
17
21
|
declare class Interceptors<Interceptor> {
|
|
@@ -88,8 +88,8 @@ const checkForExistence = (options, name) => {
|
|
|
88
88
|
}
|
|
89
89
|
return false;
|
|
90
90
|
};
|
|
91
|
-
export
|
|
92
|
-
for (const auth of security) {
|
|
91
|
+
export async function setAuthParams(options) {
|
|
92
|
+
for (const auth of options.security ?? []) {
|
|
93
93
|
if (checkForExistence(options, auth.name)) {
|
|
94
94
|
continue;
|
|
95
95
|
}
|
|
@@ -114,7 +114,7 @@ export const setAuthParams = async ({ security, ...options }) => {
|
|
|
114
114
|
break;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
}
|
|
117
|
+
}
|
|
118
118
|
export const buildUrl = (options) => getUrl({
|
|
119
119
|
baseUrl: options.baseUrl,
|
|
120
120
|
path: options.path,
|
|
@@ -156,7 +156,7 @@ export const mergeHeaders = (...headers) => {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
else if (value !== undefined) {
|
|
159
|
-
// assume object headers are meant to be JSON stringified, i.e
|
|
159
|
+
// assume object headers are meant to be JSON stringified, i.e., their
|
|
160
160
|
// content value in OpenAPI specification is 'application/json'
|
|
161
161
|
mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
162
162
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer.gen.js";
|
|
2
2
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
3
|
-
export type BodySerializer = (body:
|
|
3
|
+
export type BodySerializer = (body: unknown) => unknown;
|
|
4
4
|
type QuerySerializerOptionsObject = {
|
|
5
5
|
allowReserved?: boolean;
|
|
6
6
|
array?: Partial<SerializerOptions<ArrayStyle>>;
|
|
@@ -14,12 +14,12 @@ export type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
|
|
14
14
|
parameters?: Record<string, QuerySerializerOptionsObject>;
|
|
15
15
|
};
|
|
16
16
|
export declare const formDataBodySerializer: {
|
|
17
|
-
bodySerializer:
|
|
17
|
+
bodySerializer: (body: unknown) => FormData;
|
|
18
18
|
};
|
|
19
19
|
export declare const jsonBodySerializer: {
|
|
20
|
-
bodySerializer:
|
|
20
|
+
bodySerializer: (body: unknown) => string;
|
|
21
21
|
};
|
|
22
22
|
export declare const urlSearchParamsBodySerializer: {
|
|
23
|
-
bodySerializer:
|
|
23
|
+
bodySerializer: (body: unknown) => string;
|
|
24
24
|
};
|
|
25
25
|
export {};
|
|
@@ -32,17 +32,17 @@ const buildKeyMap = (fields, map) => {
|
|
|
32
32
|
};
|
|
33
33
|
const stripEmptySlots = (params) => {
|
|
34
34
|
for (const [slot, value] of Object.entries(params)) {
|
|
35
|
-
if (value && typeof value === "object" && !Object.keys(value).length) {
|
|
35
|
+
if (value && typeof value === "object" && !Array.isArray(value) && !Object.keys(value).length) {
|
|
36
36
|
delete params[slot];
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
export const buildClientParams = (args, fields) => {
|
|
41
41
|
const params = {
|
|
42
|
-
body:
|
|
43
|
-
headers:
|
|
44
|
-
path:
|
|
45
|
-
query:
|
|
42
|
+
body: Object.create(null),
|
|
43
|
+
headers: Object.create(null),
|
|
44
|
+
path: Object.create(null),
|
|
45
|
+
query: Object.create(null),
|
|
46
46
|
};
|
|
47
47
|
const map = buildKeyMap(fields);
|
|
48
48
|
let config;
|
|
@@ -68,4 +68,4 @@ export interface StreamEvent<TData = unknown> {
|
|
|
68
68
|
export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
69
69
|
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
70
70
|
};
|
|
71
|
-
export declare
|
|
71
|
+
export declare function createSseClient<TData = unknown>({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }: ServerSentEventsOptions): ServerSentEventsResult<TData>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
export
|
|
2
|
+
export function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
3
3
|
let lastEventId;
|
|
4
4
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
5
5
|
const createStream = async function* () {
|
|
@@ -53,8 +53,7 @@ export const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTra
|
|
|
53
53
|
if (done)
|
|
54
54
|
break;
|
|
55
55
|
buffer += value;
|
|
56
|
-
|
|
57
|
-
buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
56
|
+
buffer = buffer.replace(/\r\n?/g, "\n"); // normalize line endings
|
|
58
57
|
const chunks = buffer.split("\n\n");
|
|
59
58
|
buffer = chunks.pop() ?? "";
|
|
60
59
|
for (const chunk of chunks) {
|
|
@@ -130,4 +129,4 @@ export const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTra
|
|
|
130
129
|
};
|
|
131
130
|
const stream = createStream();
|
|
132
131
|
return { stream };
|
|
133
|
-
}
|
|
132
|
+
}
|
|
@@ -61,7 +61,7 @@ export interface Config {
|
|
|
61
61
|
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
62
62
|
/**
|
|
63
63
|
* A function transforming response data before it's returned. This is useful
|
|
64
|
-
* for post-processing data, e.g
|
|
64
|
+
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
65
65
|
*/
|
|
66
66
|
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
67
67
|
/**
|
|
@@ -75,7 +75,7 @@ export function getValidRequestBody(options) {
|
|
|
75
75
|
const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "";
|
|
76
76
|
return hasSerializedBody ? options.serializedBody : null;
|
|
77
77
|
}
|
|
78
|
-
// not all clients implement a serializedBody property (i.e
|
|
78
|
+
// not all clients implement a serializedBody property (i.e., client-axios)
|
|
79
79
|
return options.body !== "" ? options.body : null;
|
|
80
80
|
}
|
|
81
81
|
// plain/text body
|
package/dist/v2/gen/sdk.gen.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Client, type Options as Options2, type TDataShape } from "./client/index.js";
|
|
2
|
-
import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, Auth as Auth3, AuthRemoveErrors, AuthRemoveResponses, AuthSetErrors, AuthSetResponses, BoltAddErrors, BoltAddResponses, BoltConfig, BoltConnectResponses, BoltDisconnectResponses, BoltPairErrors, BoltPairResponses, BoltRemoveResponses, BoltStatusResponses, CommandListResponses, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalResourceListResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventPollResponses, GlobalEventResponses, GlobalHealthResponses, GlobalVersionCheckResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpBoltToolsResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpRemoveResponses, McpStatusResponses, MethodologyAssetCoverageErrors, MethodologyAssetCoverageResponses, MethodologyChainsErrors, MethodologyChainsResponses, MethodologyCoverageErrors, MethodologyCoverageNotesErrors, MethodologyCoverageNotesResponses, MethodologyCoverageResponses, MethodologyIntelErrors, MethodologyIntelResponses, MethodologyPerformanceErrors, MethodologyPerformanceResponses, MethodologyReportCompileErrors, MethodologyReportCompileResponses, MethodologyReportDownloadErrors, MethodologyReportDownloadResponses, MethodologyStateErrors, MethodologyStateResponses, MethodologyViolationsErrors, MethodologyViolationsResponses, OutputFormat, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionAnswer, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, SessionAbortErrors, SessionAbortResponses, SessionAddWebCredentialErrors, SessionAddWebCredentialResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteResponses, SessionDeleteWebCredentialErrors, SessionDeleteWebCredentialResponses, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionHackbrowserLaunchErrors, SessionHackbrowserLaunchResponses, SessionHackbrowserStatusErrors, SessionHackbrowserStatusResponses, SessionHackbrowserStopErrors, SessionHackbrowserStopResponses, SessionIngestErrors, SessionIngestResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionObservationsErrors, SessionObservationsResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionQueuePauseErrors, SessionQueuePauseResponses, SessionQueueResumeErrors, SessionQueueResumeResponses, SessionQueueStatusErrors, SessionQueueStatusResponses, SessionRequestErrors, SessionRequestResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SessionUpdateWebCredentialErrors, SessionUpdateWebCredentialResponses, SessionUsageErrors, SessionUsageResponses, SessionVulnerabilityErrors, SessionVulnerabilityResponses, SessionWebCredentialsErrors, SessionWebCredentialsResponses, SessionWebFunctionsErrors, SessionWebFunctionsResponses, SessionWebObjectsErrors, SessionWebObjectsResponses, SessionWebRetestQueueErrors, SessionWebRetestQueueResponses, SessionWebRolesErrors, SessionWebRolesResponses, SkillChainErrors, SkillChainResponses, SkillContextResponses, SkillDisableResponses, SkillEnableResponses, SkillGetErrors, SkillGetResponses, SkillInstallErrors, SkillInstallResponses, SkillListResponses, SkillRemoveErrors, SkillRemoveResponses, SkillSearchResponses, SkillVerifyErrors, SkillVerifyResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeListResponses, WorktreeRemoveErrors, WorktreeRemoveInput, WorktreeRemoveResponses, WorktreeResetErrors, WorktreeResetInput, WorktreeResetResponses } from "./types.gen.js";
|
|
3
|
-
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
|
2
|
+
import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, Auth as Auth3, AuthRemoveErrors, AuthRemoveResponses, AuthSetErrors, AuthSetResponses, BoltAddErrors, BoltAddResponses, BoltConfig, BoltConnectResponses, BoltDisconnectResponses, BoltPairErrors, BoltPairResponses, BoltRemoveResponses, BoltStatusResponses, CommandListResponses, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponse, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalResourceListResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventPollResponses, GlobalEventResponse, GlobalEventResponses, GlobalHealthResponses, GlobalVersionCheckResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpBoltToolsResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpRemoveResponses, McpStatusResponses, MethodologyAssetCoverageErrors, MethodologyAssetCoverageResponses, MethodologyChainsErrors, MethodologyChainsResponses, MethodologyCoverageErrors, MethodologyCoverageNotesErrors, MethodologyCoverageNotesResponses, MethodologyCoverageResponses, MethodologyIntelErrors, MethodologyIntelResponses, MethodologyPerformanceErrors, MethodologyPerformanceResponses, MethodologyReportCompileErrors, MethodologyReportCompileResponses, MethodologyReportDownloadErrors, MethodologyReportDownloadResponses, MethodologyStateErrors, MethodologyStateResponses, MethodologyViolationsErrors, MethodologyViolationsResponses, OutputFormat, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionAnswer, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, SessionAbortErrors, SessionAbortResponses, SessionAddWebCredentialErrors, SessionAddWebCredentialResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteResponses, SessionDeleteWebCredentialErrors, SessionDeleteWebCredentialResponses, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionHackbrowserLaunchErrors, SessionHackbrowserLaunchResponses, SessionHackbrowserStatusErrors, SessionHackbrowserStatusResponses, SessionHackbrowserStopErrors, SessionHackbrowserStopResponses, SessionIngestErrors, SessionIngestResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionObservationsErrors, SessionObservationsResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionQueuePauseErrors, SessionQueuePauseResponses, SessionQueueResumeErrors, SessionQueueResumeResponses, SessionQueueStatusErrors, SessionQueueStatusResponses, SessionRequestErrors, SessionRequestResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SessionUpdateWebCredentialErrors, SessionUpdateWebCredentialResponses, SessionUsageErrors, SessionUsageResponses, SessionVulnerabilityErrors, SessionVulnerabilityResponses, SessionWebCredentialsErrors, SessionWebCredentialsResponses, SessionWebFunctionsErrors, SessionWebFunctionsResponses, SessionWebObjectsErrors, SessionWebObjectsResponses, SessionWebRetestQueueErrors, SessionWebRetestQueueResponses, SessionWebRolesErrors, SessionWebRolesResponses, SkillChainErrors, SkillChainResponses, SkillContextResponses, SkillDisableResponses, SkillEnableResponses, SkillGetErrors, SkillGetResponses, SkillInstallErrors, SkillInstallResponses, SkillListResponses, SkillRemoveErrors, SkillRemoveResponses, SkillSearchResponses, SkillVerifyErrors, SkillVerifyResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeListResponses, WorktreeRemoveErrors, WorktreeRemoveInput, WorktreeRemoveResponses, WorktreeResetErrors, WorktreeResetInput, WorktreeResetResponses } from "./types.gen.js";
|
|
3
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
6
6
|
* individual options. This might be also useful if you want to implement a
|
|
@@ -25,7 +25,7 @@ declare class HeyApiRegistry<T> {
|
|
|
25
25
|
get(key?: string): T;
|
|
26
26
|
set(value: T, key?: string): void;
|
|
27
27
|
}
|
|
28
|
-
export declare class
|
|
28
|
+
export declare class Event_ extends HeyApiClient {
|
|
29
29
|
/**
|
|
30
30
|
* Poll global events
|
|
31
31
|
*
|
|
@@ -67,7 +67,7 @@ export declare class Global extends HeyApiClient {
|
|
|
67
67
|
*
|
|
68
68
|
* Subscribe to global events from the CyberStrike system using server-sent events.
|
|
69
69
|
*/
|
|
70
|
-
event<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<GlobalEventResponses
|
|
70
|
+
event<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError, GlobalEventResponse>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<GlobalEventResponses>>;
|
|
71
71
|
/**
|
|
72
72
|
* Dispose instance
|
|
73
73
|
*
|
|
@@ -75,7 +75,7 @@ export declare class Global extends HeyApiClient {
|
|
|
75
75
|
*/
|
|
76
76
|
dispose<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<GlobalDisposeResponses, unknown, ThrowOnError, "fields">;
|
|
77
77
|
private _event?;
|
|
78
|
-
get event2():
|
|
78
|
+
get event2(): Event_;
|
|
79
79
|
private _config?;
|
|
80
80
|
get config(): Config;
|
|
81
81
|
}
|
|
@@ -349,7 +349,7 @@ export declare class Session extends HeyApiClient {
|
|
|
349
349
|
hackbrowserLaunch<ThrowOnError extends boolean = false>(parameters: {
|
|
350
350
|
sessionID: string;
|
|
351
351
|
directory?: string;
|
|
352
|
-
target
|
|
352
|
+
target: string;
|
|
353
353
|
credentials?: Array<string>;
|
|
354
354
|
scope?: Array<string>;
|
|
355
355
|
exclude?: Array<string>;
|
|
@@ -477,7 +477,7 @@ export declare class Session extends HeyApiClient {
|
|
|
477
477
|
addWebCredential<ThrowOnError extends boolean = false>(parameters: {
|
|
478
478
|
sessionID: string;
|
|
479
479
|
directory?: string;
|
|
480
|
-
label
|
|
480
|
+
label: string;
|
|
481
481
|
headers?: {
|
|
482
482
|
[key: string]: string;
|
|
483
483
|
};
|
|
@@ -550,9 +550,9 @@ export declare class Session extends HeyApiClient {
|
|
|
550
550
|
*
|
|
551
551
|
* Send a message as if from user input (e.g. from another port or service). Creates a new session if sessionID is missing or invalid. AI response streams into the same session and appears in TUI chat.
|
|
552
552
|
*/
|
|
553
|
-
ingest<ThrowOnError extends boolean = false>(parameters
|
|
553
|
+
ingest<ThrowOnError extends boolean = false>(parameters: {
|
|
554
554
|
directory?: string;
|
|
555
|
-
text
|
|
555
|
+
text: string;
|
|
556
556
|
sessionID?: string;
|
|
557
557
|
agent?: string;
|
|
558
558
|
model?: {
|
|
@@ -600,9 +600,9 @@ export declare class Session extends HeyApiClient {
|
|
|
600
600
|
init<ThrowOnError extends boolean = false>(parameters: {
|
|
601
601
|
sessionID: string;
|
|
602
602
|
directory?: string;
|
|
603
|
-
modelID
|
|
604
|
-
providerID
|
|
605
|
-
messageID
|
|
603
|
+
modelID: string;
|
|
604
|
+
providerID: string;
|
|
605
|
+
messageID: string;
|
|
606
606
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<SessionInitResponses, SessionInitErrors, ThrowOnError, "fields">;
|
|
607
607
|
/**
|
|
608
608
|
* Fork session
|
|
@@ -677,8 +677,8 @@ export declare class Session extends HeyApiClient {
|
|
|
677
677
|
summarize<ThrowOnError extends boolean = false>(parameters: {
|
|
678
678
|
sessionID: string;
|
|
679
679
|
directory?: string;
|
|
680
|
-
providerID
|
|
681
|
-
modelID
|
|
680
|
+
providerID: string;
|
|
681
|
+
modelID: string;
|
|
682
682
|
auto?: boolean;
|
|
683
683
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<SessionSummarizeResponses, SessionSummarizeErrors, ThrowOnError, "fields">;
|
|
684
684
|
/**
|
|
@@ -713,7 +713,7 @@ export declare class Session extends HeyApiClient {
|
|
|
713
713
|
system?: string;
|
|
714
714
|
variant?: string;
|
|
715
715
|
excludeHistory?: boolean;
|
|
716
|
-
parts
|
|
716
|
+
parts: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>;
|
|
717
717
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<SessionPromptResponses, SessionPromptErrors, ThrowOnError, "fields">;
|
|
718
718
|
/**
|
|
719
719
|
* Get message
|
|
@@ -747,7 +747,7 @@ export declare class Session extends HeyApiClient {
|
|
|
747
747
|
system?: string;
|
|
748
748
|
variant?: string;
|
|
749
749
|
excludeHistory?: boolean;
|
|
750
|
-
parts
|
|
750
|
+
parts: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>;
|
|
751
751
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<SessionPromptAsyncResponses, SessionPromptAsyncErrors, ThrowOnError, "fields">;
|
|
752
752
|
/**
|
|
753
753
|
* Send command
|
|
@@ -760,8 +760,8 @@ export declare class Session extends HeyApiClient {
|
|
|
760
760
|
messageID?: string;
|
|
761
761
|
agent?: string;
|
|
762
762
|
model?: string;
|
|
763
|
-
arguments
|
|
764
|
-
command
|
|
763
|
+
arguments: string;
|
|
764
|
+
command: string;
|
|
765
765
|
variant?: string;
|
|
766
766
|
parts?: Array<{
|
|
767
767
|
id?: string;
|
|
@@ -780,12 +780,12 @@ export declare class Session extends HeyApiClient {
|
|
|
780
780
|
shell<ThrowOnError extends boolean = false>(parameters: {
|
|
781
781
|
sessionID: string;
|
|
782
782
|
directory?: string;
|
|
783
|
-
agent
|
|
783
|
+
agent: string;
|
|
784
784
|
model?: {
|
|
785
785
|
providerID: string;
|
|
786
786
|
modelID: string;
|
|
787
787
|
};
|
|
788
|
-
command
|
|
788
|
+
command: string;
|
|
789
789
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<SessionShellResponses, SessionShellErrors, ThrowOnError, "fields">;
|
|
790
790
|
/**
|
|
791
791
|
* Revert message
|
|
@@ -795,7 +795,7 @@ export declare class Session extends HeyApiClient {
|
|
|
795
795
|
revert<ThrowOnError extends boolean = false>(parameters: {
|
|
796
796
|
sessionID: string;
|
|
797
797
|
directory?: string;
|
|
798
|
-
messageID
|
|
798
|
+
messageID: string;
|
|
799
799
|
partID?: string;
|
|
800
800
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<SessionRevertResponses, SessionRevertErrors, ThrowOnError, "fields">;
|
|
801
801
|
/**
|
|
@@ -841,7 +841,7 @@ export declare class Permission extends HeyApiClient {
|
|
|
841
841
|
sessionID: string;
|
|
842
842
|
permissionID: string;
|
|
843
843
|
directory?: string;
|
|
844
|
-
response
|
|
844
|
+
response: "once" | "always" | "reject";
|
|
845
845
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<PermissionRespondResponses, PermissionRespondErrors, ThrowOnError, "fields">;
|
|
846
846
|
/**
|
|
847
847
|
* Respond to permission request
|
|
@@ -851,7 +851,7 @@ export declare class Permission extends HeyApiClient {
|
|
|
851
851
|
reply<ThrowOnError extends boolean = false>(parameters: {
|
|
852
852
|
requestID: string;
|
|
853
853
|
directory?: string;
|
|
854
|
-
reply
|
|
854
|
+
reply: "once" | "always" | "reject";
|
|
855
855
|
message?: string;
|
|
856
856
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<PermissionReplyResponses, PermissionReplyErrors, ThrowOnError, "fields">;
|
|
857
857
|
/**
|
|
@@ -880,7 +880,7 @@ export declare class Question extends HeyApiClient {
|
|
|
880
880
|
reply<ThrowOnError extends boolean = false>(parameters: {
|
|
881
881
|
requestID: string;
|
|
882
882
|
directory?: string;
|
|
883
|
-
answers
|
|
883
|
+
answers: Array<QuestionAnswer>;
|
|
884
884
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<QuestionReplyResponses, QuestionReplyErrors, ThrowOnError, "fields">;
|
|
885
885
|
/**
|
|
886
886
|
* Reject question request
|
|
@@ -901,7 +901,7 @@ export declare class Oauth extends HeyApiClient {
|
|
|
901
901
|
authorize<ThrowOnError extends boolean = false>(parameters: {
|
|
902
902
|
providerID: string;
|
|
903
903
|
directory?: string;
|
|
904
|
-
method
|
|
904
|
+
method: number;
|
|
905
905
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProviderOauthAuthorizeResponses, ProviderOauthAuthorizeErrors, ThrowOnError, "fields">;
|
|
906
906
|
/**
|
|
907
907
|
* OAuth callback
|
|
@@ -911,7 +911,7 @@ export declare class Oauth extends HeyApiClient {
|
|
|
911
911
|
callback<ThrowOnError extends boolean = false>(parameters: {
|
|
912
912
|
providerID: string;
|
|
913
913
|
directory?: string;
|
|
914
|
-
method
|
|
914
|
+
method: number;
|
|
915
915
|
code?: string;
|
|
916
916
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProviderOauthCallbackResponses, ProviderOauthCallbackErrors, ThrowOnError, "fields">;
|
|
917
917
|
}
|
|
@@ -967,7 +967,7 @@ export declare class Find extends HeyApiClient {
|
|
|
967
967
|
query: string;
|
|
968
968
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<FindSymbolsResponses, unknown, ThrowOnError, "fields">;
|
|
969
969
|
}
|
|
970
|
-
export declare class
|
|
970
|
+
export declare class File_ extends HeyApiClient {
|
|
971
971
|
/**
|
|
972
972
|
* List files
|
|
973
973
|
*
|
|
@@ -1022,7 +1022,7 @@ export declare class Auth2 extends HeyApiClient {
|
|
|
1022
1022
|
callback<ThrowOnError extends boolean = false>(parameters: {
|
|
1023
1023
|
name: string;
|
|
1024
1024
|
directory?: string;
|
|
1025
|
-
code
|
|
1025
|
+
code: string;
|
|
1026
1026
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpAuthCallbackResponses, McpAuthCallbackErrors, ThrowOnError, "fields">;
|
|
1027
1027
|
/**
|
|
1028
1028
|
* Authenticate MCP OAuth
|
|
@@ -1048,10 +1048,10 @@ export declare class Mcp extends HeyApiClient {
|
|
|
1048
1048
|
*
|
|
1049
1049
|
* Dynamically add a new Model Context Protocol (MCP) server to the system.
|
|
1050
1050
|
*/
|
|
1051
|
-
add<ThrowOnError extends boolean = false>(parameters
|
|
1051
|
+
add<ThrowOnError extends boolean = false>(parameters: {
|
|
1052
1052
|
directory?: string;
|
|
1053
|
-
name
|
|
1054
|
-
config
|
|
1053
|
+
name: string;
|
|
1054
|
+
config: McpLocalConfig | McpRemoteConfig;
|
|
1055
1055
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<McpAddResponses, McpAddErrors, ThrowOnError, "fields">;
|
|
1056
1056
|
/**
|
|
1057
1057
|
* Get Bolt tool groups
|
|
@@ -1101,10 +1101,10 @@ export declare class Bolt extends HeyApiClient {
|
|
|
1101
1101
|
*
|
|
1102
1102
|
* Dynamically add a new Bolt server.
|
|
1103
1103
|
*/
|
|
1104
|
-
add<ThrowOnError extends boolean = false>(parameters
|
|
1104
|
+
add<ThrowOnError extends boolean = false>(parameters: {
|
|
1105
1105
|
directory?: string;
|
|
1106
|
-
name
|
|
1107
|
-
config
|
|
1106
|
+
name: string;
|
|
1107
|
+
config: BoltConfig;
|
|
1108
1108
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<BoltAddResponses, BoltAddErrors, ThrowOnError, "fields">;
|
|
1109
1109
|
/**
|
|
1110
1110
|
* Pair with Bolt server
|
|
@@ -1114,8 +1114,8 @@ export declare class Bolt extends HeyApiClient {
|
|
|
1114
1114
|
pair<ThrowOnError extends boolean = false>(parameters: {
|
|
1115
1115
|
name: string;
|
|
1116
1116
|
directory?: string;
|
|
1117
|
-
url
|
|
1118
|
-
adminToken
|
|
1117
|
+
url: string;
|
|
1118
|
+
adminToken: string;
|
|
1119
1119
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<BoltPairResponses, BoltPairErrors, ThrowOnError, "fields">;
|
|
1120
1120
|
/**
|
|
1121
1121
|
* Connect a Bolt server
|
|
@@ -1166,9 +1166,9 @@ export declare class Tui extends HeyApiClient {
|
|
|
1166
1166
|
*
|
|
1167
1167
|
* Append prompt to the TUI
|
|
1168
1168
|
*/
|
|
1169
|
-
appendPrompt<ThrowOnError extends boolean = false>(parameters
|
|
1169
|
+
appendPrompt<ThrowOnError extends boolean = false>(parameters: {
|
|
1170
1170
|
directory?: string;
|
|
1171
|
-
text
|
|
1171
|
+
text: string;
|
|
1172
1172
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<TuiAppendPromptResponses, TuiAppendPromptErrors, ThrowOnError, "fields">;
|
|
1173
1173
|
/**
|
|
1174
1174
|
* Open help dialog
|
|
@@ -1223,20 +1223,20 @@ export declare class Tui extends HeyApiClient {
|
|
|
1223
1223
|
*
|
|
1224
1224
|
* Execute a TUI command (e.g. agent_cycle)
|
|
1225
1225
|
*/
|
|
1226
|
-
executeCommand<ThrowOnError extends boolean = false>(parameters
|
|
1226
|
+
executeCommand<ThrowOnError extends boolean = false>(parameters: {
|
|
1227
1227
|
directory?: string;
|
|
1228
|
-
command
|
|
1228
|
+
command: string;
|
|
1229
1229
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<TuiExecuteCommandResponses, TuiExecuteCommandErrors, ThrowOnError, "fields">;
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Show TUI toast
|
|
1232
1232
|
*
|
|
1233
1233
|
* Show a toast notification in the TUI
|
|
1234
1234
|
*/
|
|
1235
|
-
showToast<ThrowOnError extends boolean = false>(parameters
|
|
1235
|
+
showToast<ThrowOnError extends boolean = false>(parameters: {
|
|
1236
1236
|
directory?: string;
|
|
1237
1237
|
title?: string;
|
|
1238
|
-
message
|
|
1239
|
-
variant
|
|
1238
|
+
message: string;
|
|
1239
|
+
variant: "info" | "success" | "warning" | "error";
|
|
1240
1240
|
duration?: number;
|
|
1241
1241
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<TuiShowToastResponses, unknown, ThrowOnError, "fields">;
|
|
1242
1242
|
/**
|
|
@@ -1253,9 +1253,9 @@ export declare class Tui extends HeyApiClient {
|
|
|
1253
1253
|
*
|
|
1254
1254
|
* Navigate the TUI to display the specified session.
|
|
1255
1255
|
*/
|
|
1256
|
-
selectSession<ThrowOnError extends boolean = false>(parameters
|
|
1256
|
+
selectSession<ThrowOnError extends boolean = false>(parameters: {
|
|
1257
1257
|
directory?: string;
|
|
1258
|
-
sessionID
|
|
1258
|
+
sessionID: string;
|
|
1259
1259
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<TuiSelectSessionResponses, TuiSelectSessionErrors, ThrowOnError, "fields">;
|
|
1260
1260
|
private _control?;
|
|
1261
1261
|
get control(): Control;
|
|
@@ -1399,11 +1399,11 @@ export declare class App extends HeyApiClient {
|
|
|
1399
1399
|
*
|
|
1400
1400
|
* Write a log entry to the server logs with specified level and metadata.
|
|
1401
1401
|
*/
|
|
1402
|
-
log<ThrowOnError extends boolean = false>(parameters
|
|
1402
|
+
log<ThrowOnError extends boolean = false>(parameters: {
|
|
1403
1403
|
directory?: string;
|
|
1404
|
-
service
|
|
1405
|
-
level
|
|
1406
|
-
message
|
|
1404
|
+
service: string;
|
|
1405
|
+
level: "debug" | "info" | "error" | "warn";
|
|
1406
|
+
message: string;
|
|
1407
1407
|
extra?: {
|
|
1408
1408
|
[key: string]: unknown;
|
|
1409
1409
|
};
|
|
@@ -1452,9 +1452,9 @@ export declare class Skill extends HeyApiClient {
|
|
|
1452
1452
|
*
|
|
1453
1453
|
* Analyze findings for kill chain opportunities.
|
|
1454
1454
|
*/
|
|
1455
|
-
chain<ThrowOnError extends boolean = false>(parameters
|
|
1455
|
+
chain<ThrowOnError extends boolean = false>(parameters: {
|
|
1456
1456
|
directory?: string;
|
|
1457
|
-
findings
|
|
1457
|
+
findings: Array<{
|
|
1458
1458
|
skill_id: string;
|
|
1459
1459
|
severity: "info" | "low" | "medium" | "high" | "critical";
|
|
1460
1460
|
cwe_id?: string;
|
|
@@ -1493,9 +1493,9 @@ export declare class Skill extends HeyApiClient {
|
|
|
1493
1493
|
*
|
|
1494
1494
|
* Download and install a skill from a remote URL or registry.
|
|
1495
1495
|
*/
|
|
1496
|
-
install<ThrowOnError extends boolean = false>(parameters
|
|
1496
|
+
install<ThrowOnError extends boolean = false>(parameters: {
|
|
1497
1497
|
directory?: string;
|
|
1498
|
-
url
|
|
1498
|
+
url: string;
|
|
1499
1499
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<SkillInstallResponses, SkillInstallErrors, ThrowOnError, "fields">;
|
|
1500
1500
|
/**
|
|
1501
1501
|
* Enable a skill
|
|
@@ -1544,7 +1544,7 @@ export declare class Event2 extends HeyApiClient {
|
|
|
1544
1544
|
*/
|
|
1545
1545
|
subscribe<ThrowOnError extends boolean = false>(parameters?: {
|
|
1546
1546
|
directory?: string;
|
|
1547
|
-
}, options?: Options<never, ThrowOnError>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<EventSubscribeResponses
|
|
1547
|
+
}, options?: Options<never, ThrowOnError, EventSubscribeResponse>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<EventSubscribeResponses>>;
|
|
1548
1548
|
}
|
|
1549
1549
|
export declare class CyberstrikeClient extends HeyApiClient {
|
|
1550
1550
|
static readonly __registry: HeyApiRegistry<CyberstrikeClient>;
|
|
@@ -1581,7 +1581,7 @@ export declare class CyberstrikeClient extends HeyApiClient {
|
|
|
1581
1581
|
private _find?;
|
|
1582
1582
|
get find(): Find;
|
|
1583
1583
|
private _file?;
|
|
1584
|
-
get file():
|
|
1584
|
+
get file(): File_;
|
|
1585
1585
|
private _mcp?;
|
|
1586
1586
|
get mcp(): Mcp;
|
|
1587
1587
|
private _bolt?;
|
package/dist/v2/gen/sdk.gen.js
CHANGED
|
@@ -21,7 +21,7 @@ class HeyApiRegistry {
|
|
|
21
21
|
this.instances.set(key ?? this.defaultKey, value);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
export class
|
|
24
|
+
export class Event_ extends HeyApiClient {
|
|
25
25
|
/**
|
|
26
26
|
* Poll global events
|
|
27
27
|
*
|
|
@@ -112,7 +112,7 @@ export class Global extends HeyApiClient {
|
|
|
112
112
|
}
|
|
113
113
|
_event;
|
|
114
114
|
get event2() {
|
|
115
|
-
return (this._event ??= new
|
|
115
|
+
return (this._event ??= new Event_({ client: this.client }));
|
|
116
116
|
}
|
|
117
117
|
_config;
|
|
118
118
|
get config() {
|
|
@@ -1847,7 +1847,7 @@ export class Find extends HeyApiClient {
|
|
|
1847
1847
|
});
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
|
-
export class
|
|
1850
|
+
export class File_ extends HeyApiClient {
|
|
1851
1851
|
/**
|
|
1852
1852
|
* List files
|
|
1853
1853
|
*
|
|
@@ -3097,7 +3097,7 @@ export class CyberstrikeClient extends HeyApiClient {
|
|
|
3097
3097
|
}
|
|
3098
3098
|
_file;
|
|
3099
3099
|
get file() {
|
|
3100
|
-
return (this._file ??= new
|
|
3100
|
+
return (this._file ??= new File_({ client: this.client }));
|
|
3101
3101
|
}
|
|
3102
3102
|
_mcp;
|
|
3103
3103
|
get mcp() {
|
|
@@ -210,6 +210,8 @@ export type AssistantMessage = {
|
|
|
210
210
|
variant?: string;
|
|
211
211
|
finish?: string;
|
|
212
212
|
stepCapped?: boolean;
|
|
213
|
+
stuckNudged?: boolean;
|
|
214
|
+
stuckAborted?: boolean;
|
|
213
215
|
};
|
|
214
216
|
export type Message = UserMessage | AssistantMessage;
|
|
215
217
|
export type EventMessageUpdated = {
|
|
@@ -737,6 +739,7 @@ export type Vulnerability = {
|
|
|
737
739
|
endpoint?: string;
|
|
738
740
|
attack_vector?: string;
|
|
739
741
|
status?: "new" | "approved" | "duplicate" | "open" | "fixed" | "ignored";
|
|
742
|
+
candidate?: "critical" | "high" | "medium" | "low" | "info";
|
|
740
743
|
duplicate_of?: string;
|
|
741
744
|
message_id?: string;
|
|
742
745
|
time?: {
|
|
@@ -1540,11 +1543,7 @@ export type AgentConfig = {
|
|
|
1540
1543
|
*/
|
|
1541
1544
|
maxSteps?: number;
|
|
1542
1545
|
permission?: PermissionConfig;
|
|
1543
|
-
[key: string]: unknown
|
|
1544
|
-
[key: string]: boolean;
|
|
1545
|
-
} | boolean | "subagent" | "primary" | "all" | {
|
|
1546
|
-
[key: string]: unknown;
|
|
1547
|
-
} | string | "primary" | "secondary" | "accent" | "success" | "warning" | "error" | "info" | number | PermissionConfig | undefined;
|
|
1546
|
+
[key: string]: unknown;
|
|
1548
1547
|
};
|
|
1549
1548
|
export type ProviderConfig = {
|
|
1550
1549
|
api?: string;
|
|
@@ -1636,7 +1635,7 @@ export type ProviderConfig = {
|
|
|
1636
1635
|
* Disable this variant for the model
|
|
1637
1636
|
*/
|
|
1638
1637
|
disabled?: boolean;
|
|
1639
|
-
[key: string]: unknown
|
|
1638
|
+
[key: string]: unknown;
|
|
1640
1639
|
};
|
|
1641
1640
|
};
|
|
1642
1641
|
};
|
|
@@ -1658,7 +1657,7 @@ export type ProviderConfig = {
|
|
|
1658
1657
|
* Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
|
|
1659
1658
|
*/
|
|
1660
1659
|
timeout?: number | false;
|
|
1661
|
-
[key: string]: unknown
|
|
1660
|
+
[key: string]: unknown;
|
|
1662
1661
|
};
|
|
1663
1662
|
};
|
|
1664
1663
|
export type McpLocalConfig = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@cyberstrike-io/sdk",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.16-beta.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"scripts": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@hey-api/openapi-ts": "0.
|
|
41
|
+
"@hey-api/openapi-ts": "0.97.3",
|
|
42
42
|
"@tsconfig/node22": "22.0.2",
|
|
43
43
|
"@types/node": "22.13.9",
|
|
44
44
|
"typescript": "5.8.2",
|