@trycua/cua 0.2.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.
- package/README.md +121 -0
- package/bin/cua.js +37 -0
- package/browser/cua_sdk-ffi.d.ts +6 -0
- package/browser/cua_sdk-ffi.js +3 -0
- package/browser/cua_sdk-ffi.ts +14 -0
- package/browser/cua_sdk.d.ts +2237 -0
- package/browser/cua_sdk.js +2607 -0
- package/browser/cua_sdk.ts +3644 -0
- package/browser/cyclops_sdk_schema-ffi.d.ts +6 -0
- package/browser/cyclops_sdk_schema-ffi.js +3 -0
- package/browser/cyclops_sdk_schema-ffi.ts +14 -0
- package/browser/cyclops_sdk_schema.d.ts +996 -0
- package/browser/cyclops_sdk_schema.js +2194 -0
- package/browser/cyclops_sdk_schema.ts +2934 -0
- package/browser/fleet_sdk-ffi.d.ts +28 -0
- package/browser/fleet_sdk-ffi.js +3 -0
- package/browser/fleet_sdk-ffi.ts +35 -0
- package/browser/fleet_sdk.d.ts +3056 -0
- package/browser/fleet_sdk.js +5088 -0
- package/browser/fleet_sdk.ts +6830 -0
- package/browser/index.d.ts +2 -0
- package/browser/index.js +18 -0
- package/browser/index.web.ts +34 -0
- package/browser/tsconfig.json +20 -0
- package/browser/wasm-bindgen/index.d.ts +2346 -0
- package/browser/wasm-bindgen/index.js +6642 -0
- package/browser/wasm-bindgen/index_bg.wasm +0 -0
- package/browser/wasm-bindgen/index_bg.wasm.d.ts +1154 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.js +207 -0
- package/dist/mcp.d.ts +33 -0
- package/dist/mcp.js +41 -0
- package/dist/native/cua_sdk-ffi.d.ts +1038 -0
- package/dist/native/cua_sdk-ffi.js +5095 -0
- package/dist/native/cua_sdk.d.ts +15906 -0
- package/dist/native/cua_sdk.js +27061 -0
- package/dist/native/index.d.ts +7 -0
- package/dist/native/index.js +12 -0
- package/dist/native/node-runtime.d.ts +72 -0
- package/dist/native/node-runtime.js +35 -0
- package/dist/spaces/cursorArt.d.ts +27 -0
- package/dist/spaces/cursorArt.js +59 -0
- package/dist/spaces/errors.d.ts +81 -0
- package/dist/spaces/errors.js +102 -0
- package/dist/spaces/events.d.ts +154 -0
- package/dist/spaces/events.js +182 -0
- package/dist/spaces/groups.d.ts +130 -0
- package/dist/spaces/groups.js +275 -0
- package/dist/spaces/host.d.ts +71 -0
- package/dist/spaces/host.js +154 -0
- package/dist/spaces/index.d.ts +48 -0
- package/dist/spaces/index.js +44 -0
- package/dist/spaces/pip.d.ts +128 -0
- package/dist/spaces/pip.js +250 -0
- package/dist/spaces/presence.d.ts +187 -0
- package/dist/spaces/presence.js +449 -0
- package/dist/spaces/presenceTypes.check.d.ts +12 -0
- package/dist/spaces/presenceTypes.check.js +1 -0
- package/dist/spaces/presenceTypes.d.ts +47 -0
- package/dist/spaces/presenceTypes.js +7 -0
- package/dist/spaces/routines.d.ts +158 -0
- package/dist/spaces/routines.js +339 -0
- package/dist/spaces/thread.d.ts +147 -0
- package/dist/spaces/thread.js +285 -0
- package/dist/spaces/transport/http.d.ts +51 -0
- package/dist/spaces/transport/http.js +113 -0
- package/dist/spaces/transport/index.d.ts +19 -0
- package/dist/spaces/transport/index.js +19 -0
- package/dist/spaces/transport/session.d.ts +120 -0
- package/dist/spaces/transport/session.js +188 -0
- package/dist/spaces/transport/tauri.d.ts +50 -0
- package/dist/spaces/transport/tauri.js +90 -0
- package/dist/spaces/transport/types.d.ts +123 -0
- package/dist/spaces/transport/types.js +59 -0
- package/dist/teleport/controller.d.ts +34 -0
- package/dist/teleport/controller.js +107 -0
- package/dist/teleport/drop.d.ts +62 -0
- package/dist/teleport/drop.js +138 -0
- package/dist/teleport/dropZone.d.ts +59 -0
- package/dist/teleport/dropZone.js +166 -0
- package/dist/teleport/element.d.ts +28 -0
- package/dist/teleport/element.js +340 -0
- package/dist/teleport/index.d.ts +32 -0
- package/dist/teleport/index.js +32 -0
- package/dist/teleport/install.d.ts +31 -0
- package/dist/teleport/install.js +65 -0
- package/dist/teleport/model.d.ts +245 -0
- package/dist/teleport/model.js +334 -0
- package/dist/teleport/windowDrag.d.ts +86 -0
- package/dist/teleport/windowDrag.js +71 -0
- package/package.json +93 -0
|
@@ -0,0 +1,3644 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
import * as wasmBundle from "./wasm-bindgen/index.js";
|
|
7
|
+
import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct,
|
|
8
|
+
} from "./cua_sdk-ffi.js";
|
|
9
|
+
import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterFloat64, FfiConverterInt32, FfiConverterInt64, FfiConverterMap, FfiConverterObject, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTypeNameSymbol, variantOrdinalSymbol,
|
|
10
|
+
} from "@ubjs/core";
|
|
11
|
+
// wasm1: wrap the wasm-bindgen namespace once so the codegen call sites can
|
|
12
|
+
// uniformly reference `nativeModule().rustbuffer_alloc` / `.rustbuffer_free`.
|
|
13
|
+
// For wasm1, RustBuffers are plain JS Uint8Arrays — no Rust-side allocation
|
|
14
|
+
// is involved, so alloc just hands back a fresh view and free is a no-op.
|
|
15
|
+
const _nativeModule = Object.assign({}, wasmBundle, {
|
|
16
|
+
rustbuffer_alloc: (n: number): Uint8Array => new Uint8Array(n),
|
|
17
|
+
rustbuffer_free: (_: Uint8Array): void => {},
|
|
18
|
+
});
|
|
19
|
+
const nativeModule = () => _nativeModule;
|
|
20
|
+
const uniffiCaller = new UniffiRustCaller(() => new wasmBundle.RustCallStatus());
|
|
21
|
+
|
|
22
|
+
const uniffiIsDebug =
|
|
23
|
+
// @ts-ignore -- The process global might not be defined
|
|
24
|
+
typeof process !== "object" ||
|
|
25
|
+
// @ts-ignore -- The process global might not be defined
|
|
26
|
+
process?.env?.NODE_ENV !== "production" ||
|
|
27
|
+
false;
|
|
28
|
+
|
|
29
|
+
// Public interface members begin here.
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Version of the SDK library.
|
|
33
|
+
*/
|
|
34
|
+
export function cuaSdkVersion(): string {
|
|
35
|
+
return ((__rb: Uint8Array) => {
|
|
36
|
+
try {
|
|
37
|
+
return FfiConverterString.lift(__rb);
|
|
38
|
+
} finally {
|
|
39
|
+
nativeModule().rustbuffer_free(__rb);
|
|
40
|
+
}
|
|
41
|
+
})(uniffiCaller.rustCall(
|
|
42
|
+
/*caller:*/ (callStatus) => {
|
|
43
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_func_cua_sdk_version(
|
|
44
|
+
callStatus);
|
|
45
|
+
},
|
|
46
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A link to the errors-reference entry of a [`CuaError`] variant, by name
|
|
52
|
+
* (`InvalidArgument`, case-insensitive). An unknown name links to the
|
|
53
|
+
* page itself. The bindings' `doc_url` / `docUrl` on `CuaError` use it.
|
|
54
|
+
*/
|
|
55
|
+
export function errorDocUrl(variant: string): string {
|
|
56
|
+
return ((__rb: Uint8Array) => {
|
|
57
|
+
try {
|
|
58
|
+
return FfiConverterString.lift(__rb);
|
|
59
|
+
} finally {
|
|
60
|
+
nativeModule().rustbuffer_free(__rb);
|
|
61
|
+
}
|
|
62
|
+
})(uniffiCaller.rustCall(
|
|
63
|
+
/*caller:*/ (callStatus) => {
|
|
64
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_func_error_doc_url(
|
|
65
|
+
FfiConverterString.lower(variant, nativeModule().rustbuffer_alloc),
|
|
66
|
+
callStatus);
|
|
67
|
+
},
|
|
68
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
69
|
+
));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const stringConverter = (() => {
|
|
73
|
+
const encoder = new TextEncoder();
|
|
74
|
+
const decoder = new TextDecoder();
|
|
75
|
+
return {
|
|
76
|
+
stringToBytes: (s: string) => encoder.encode(s),
|
|
77
|
+
bytesToString: (ab: UniffiByteArray) => decoder.decode(ab),
|
|
78
|
+
stringByteLength: (s: string) => encoder.encode(s).byteLength,
|
|
79
|
+
writeStringIntoBuffer: (s: string, buf: any, offset: number): number => {
|
|
80
|
+
const view = new Uint8Array(
|
|
81
|
+
buf.arrayBuffer,
|
|
82
|
+
offset,
|
|
83
|
+
buf.arrayBuffer.byteLength - offset,
|
|
84
|
+
);
|
|
85
|
+
return encoder.encodeInto(s, view).written;
|
|
86
|
+
},
|
|
87
|
+
readStringFromBuffer: (buf: any, offset: number, length: number): string =>
|
|
88
|
+
decoder.decode(new Uint8Array(buf.arrayBuffer, offset, length)),
|
|
89
|
+
};
|
|
90
|
+
})();
|
|
91
|
+
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Fleet settings for the browser (static bearer only).
|
|
95
|
+
*/
|
|
96
|
+
export type FleetSettings = {
|
|
97
|
+
/**
|
|
98
|
+
* Fleet API base URL.
|
|
99
|
+
*/
|
|
100
|
+
baseUrl?: string,
|
|
101
|
+
/**
|
|
102
|
+
* Bearer token.
|
|
103
|
+
*/
|
|
104
|
+
token?: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Generated factory for {@link FleetSettings} record objects.
|
|
109
|
+
*/
|
|
110
|
+
export const FleetSettings = (() => {
|
|
111
|
+
const defaults = () => ({
|
|
112
|
+
baseUrl: undefined,
|
|
113
|
+
token: undefined
|
|
114
|
+
});
|
|
115
|
+
const create = (() => {
|
|
116
|
+
return uniffiCreateRecord<FleetSettings, ReturnType<typeof defaults>>(defaults);
|
|
117
|
+
})();
|
|
118
|
+
return Object.freeze({
|
|
119
|
+
create,
|
|
120
|
+
new: create,
|
|
121
|
+
defaults: () => Object.freeze(defaults()) as Partial<FleetSettings>,
|
|
122
|
+
});
|
|
123
|
+
})();
|
|
124
|
+
|
|
125
|
+
const FfiConverterTypeFleetSettings = (() => {
|
|
126
|
+
type TypeName = FleetSettings;
|
|
127
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
128
|
+
read(from: RustBuffer): TypeName {
|
|
129
|
+
return {
|
|
130
|
+
baseUrl: FfiConverterOptionalString.read(from),
|
|
131
|
+
token: FfiConverterOptionalString.read(from)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
135
|
+
FfiConverterOptionalString.write(value.baseUrl, into);
|
|
136
|
+
FfiConverterOptionalString.write(value.token, into);
|
|
137
|
+
}
|
|
138
|
+
allocationSize(value: TypeName): number {
|
|
139
|
+
return FfiConverterOptionalString.allocationSize(value.baseUrl) +
|
|
140
|
+
FfiConverterOptionalString.allocationSize(value.token);
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
return new FFIConverter();
|
|
145
|
+
})();
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Configuration of the browser SDK.
|
|
149
|
+
*/
|
|
150
|
+
export type CuaConfig = {
|
|
151
|
+
/**
|
|
152
|
+
* Fleet settings.
|
|
153
|
+
*/
|
|
154
|
+
fleet?: FleetSettings
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Generated factory for {@link CuaConfig} record objects.
|
|
159
|
+
*/
|
|
160
|
+
export const CuaConfig = (() => {
|
|
161
|
+
const defaults = () => ({
|
|
162
|
+
fleet: undefined
|
|
163
|
+
});
|
|
164
|
+
const create = (() => {
|
|
165
|
+
return uniffiCreateRecord<CuaConfig, ReturnType<typeof defaults>>(defaults);
|
|
166
|
+
})();
|
|
167
|
+
return Object.freeze({
|
|
168
|
+
create,
|
|
169
|
+
new: create,
|
|
170
|
+
defaults: () => Object.freeze(defaults()) as Partial<CuaConfig>,
|
|
171
|
+
});
|
|
172
|
+
})();
|
|
173
|
+
|
|
174
|
+
const FfiConverterTypeCuaConfig = (() => {
|
|
175
|
+
type TypeName = CuaConfig;
|
|
176
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
177
|
+
read(from: RustBuffer): TypeName {
|
|
178
|
+
return {
|
|
179
|
+
fleet: FfiConverterOptionalTypeFleetSettings.read(from)
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
183
|
+
FfiConverterOptionalTypeFleetSettings.write(value.fleet, into);
|
|
184
|
+
}
|
|
185
|
+
allocationSize(value: TypeName): number {
|
|
186
|
+
return FfiConverterOptionalTypeFleetSettings.allocationSize(value.fleet);
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
return new FFIConverter();
|
|
191
|
+
})();
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* How a process ended.
|
|
195
|
+
*/
|
|
196
|
+
export type ExitInfo = {
|
|
197
|
+
/**
|
|
198
|
+
* Exit code for a normal exit.
|
|
199
|
+
*/
|
|
200
|
+
code?: number,
|
|
201
|
+
/**
|
|
202
|
+
* Terminating signal (`kill`, `term`, ...).
|
|
203
|
+
*/
|
|
204
|
+
signal?: string,
|
|
205
|
+
/**
|
|
206
|
+
* Stopped by its timeout.
|
|
207
|
+
*/
|
|
208
|
+
timedOut: boolean,
|
|
209
|
+
/**
|
|
210
|
+
* Supervisor error (for example "executable not found").
|
|
211
|
+
*/
|
|
212
|
+
error?: string,
|
|
213
|
+
/**
|
|
214
|
+
* `code == 0`.
|
|
215
|
+
*/
|
|
216
|
+
success: boolean
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Generated factory for {@link ExitInfo} record objects.
|
|
221
|
+
*/
|
|
222
|
+
export const ExitInfo = (() => {
|
|
223
|
+
const defaults = () => ({
|
|
224
|
+
});
|
|
225
|
+
const create = (() => {
|
|
226
|
+
return uniffiCreateRecord<ExitInfo, ReturnType<typeof defaults>>(defaults);
|
|
227
|
+
})();
|
|
228
|
+
return Object.freeze({
|
|
229
|
+
create,
|
|
230
|
+
new: create,
|
|
231
|
+
defaults: () => Object.freeze(defaults()) as Partial<ExitInfo>,
|
|
232
|
+
});
|
|
233
|
+
})();
|
|
234
|
+
|
|
235
|
+
const FfiConverterTypeExitInfo = (() => {
|
|
236
|
+
type TypeName = ExitInfo;
|
|
237
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
238
|
+
read(from: RustBuffer): TypeName {
|
|
239
|
+
return {
|
|
240
|
+
code: FfiConverterOptionalInt32.read(from),
|
|
241
|
+
signal: FfiConverterOptionalString.read(from),
|
|
242
|
+
timedOut: FfiConverterBool.read(from),
|
|
243
|
+
error: FfiConverterOptionalString.read(from),
|
|
244
|
+
success: FfiConverterBool.read(from)
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
248
|
+
FfiConverterOptionalInt32.write(value.code, into);
|
|
249
|
+
FfiConverterOptionalString.write(value.signal, into);
|
|
250
|
+
FfiConverterBool.write(value.timedOut, into);
|
|
251
|
+
FfiConverterOptionalString.write(value.error, into);
|
|
252
|
+
FfiConverterBool.write(value.success, into);
|
|
253
|
+
}
|
|
254
|
+
allocationSize(value: TypeName): number {
|
|
255
|
+
return FfiConverterOptionalInt32.allocationSize(value.code) +
|
|
256
|
+
FfiConverterOptionalString.allocationSize(value.signal) +
|
|
257
|
+
FfiConverterBool.allocationSize(value.timedOut) +
|
|
258
|
+
FfiConverterOptionalString.allocationSize(value.error) +
|
|
259
|
+
FfiConverterBool.allocationSize(value.success);
|
|
260
|
+
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
return new FFIConverter();
|
|
264
|
+
})();
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* A file or directory in the guest.
|
|
268
|
+
*/
|
|
269
|
+
export type FileEntry = {
|
|
270
|
+
/**
|
|
271
|
+
* Base name.
|
|
272
|
+
*/
|
|
273
|
+
name: string,
|
|
274
|
+
/**
|
|
275
|
+
* Absolute path.
|
|
276
|
+
*/
|
|
277
|
+
path: string,
|
|
278
|
+
/**
|
|
279
|
+
* `file`, `directory`, `symlink` or `other`.
|
|
280
|
+
*/
|
|
281
|
+
kind: string,
|
|
282
|
+
/**
|
|
283
|
+
* Size in bytes.
|
|
284
|
+
*/
|
|
285
|
+
size: bigint,
|
|
286
|
+
/**
|
|
287
|
+
* Unix mode bits.
|
|
288
|
+
*/
|
|
289
|
+
mode: number,
|
|
290
|
+
/**
|
|
291
|
+
* Modification time (Unix ms), when known.
|
|
292
|
+
*/
|
|
293
|
+
modifiedMs?: bigint,
|
|
294
|
+
/**
|
|
295
|
+
* Symlink target.
|
|
296
|
+
*/
|
|
297
|
+
symlinkTarget?: string
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Generated factory for {@link FileEntry} record objects.
|
|
302
|
+
*/
|
|
303
|
+
export const FileEntry = (() => {
|
|
304
|
+
const defaults = () => ({
|
|
305
|
+
});
|
|
306
|
+
const create = (() => {
|
|
307
|
+
return uniffiCreateRecord<FileEntry, ReturnType<typeof defaults>>(defaults);
|
|
308
|
+
})();
|
|
309
|
+
return Object.freeze({
|
|
310
|
+
create,
|
|
311
|
+
new: create,
|
|
312
|
+
defaults: () => Object.freeze(defaults()) as Partial<FileEntry>,
|
|
313
|
+
});
|
|
314
|
+
})();
|
|
315
|
+
|
|
316
|
+
const FfiConverterTypeFileEntry = (() => {
|
|
317
|
+
type TypeName = FileEntry;
|
|
318
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
319
|
+
read(from: RustBuffer): TypeName {
|
|
320
|
+
return {
|
|
321
|
+
name: FfiConverterString.read(from),
|
|
322
|
+
path: FfiConverterString.read(from),
|
|
323
|
+
kind: FfiConverterString.read(from),
|
|
324
|
+
size: FfiConverterUInt64.read(from),
|
|
325
|
+
mode: FfiConverterUInt32.read(from),
|
|
326
|
+
modifiedMs: FfiConverterOptionalInt64.read(from),
|
|
327
|
+
symlinkTarget: FfiConverterOptionalString.read(from)
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
331
|
+
FfiConverterString.write(value.name, into);
|
|
332
|
+
FfiConverterString.write(value.path, into);
|
|
333
|
+
FfiConverterString.write(value.kind, into);
|
|
334
|
+
FfiConverterUInt64.write(value.size, into);
|
|
335
|
+
FfiConverterUInt32.write(value.mode, into);
|
|
336
|
+
FfiConverterOptionalInt64.write(value.modifiedMs, into);
|
|
337
|
+
FfiConverterOptionalString.write(value.symlinkTarget, into);
|
|
338
|
+
}
|
|
339
|
+
allocationSize(value: TypeName): number {
|
|
340
|
+
return FfiConverterString.allocationSize(value.name) +
|
|
341
|
+
FfiConverterString.allocationSize(value.path) +
|
|
342
|
+
FfiConverterString.allocationSize(value.kind) +
|
|
343
|
+
FfiConverterUInt64.allocationSize(value.size) +
|
|
344
|
+
FfiConverterUInt32.allocationSize(value.mode) +
|
|
345
|
+
FfiConverterOptionalInt64.allocationSize(value.modifiedMs) +
|
|
346
|
+
FfiConverterOptionalString.allocationSize(value.symlinkTarget);
|
|
347
|
+
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
return new FFIConverter();
|
|
351
|
+
})();
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* A bound Fleet sandbox.
|
|
355
|
+
*/
|
|
356
|
+
export type FleetSandbox = {
|
|
357
|
+
/**
|
|
358
|
+
* Sandbox name.
|
|
359
|
+
*/
|
|
360
|
+
name: string,
|
|
361
|
+
/**
|
|
362
|
+
* Namespace.
|
|
363
|
+
*/
|
|
364
|
+
namespace: string,
|
|
365
|
+
/**
|
|
366
|
+
* Claim name.
|
|
367
|
+
*/
|
|
368
|
+
claim: string,
|
|
369
|
+
/**
|
|
370
|
+
* Declared services.
|
|
371
|
+
*/
|
|
372
|
+
services: Array<string>
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Generated factory for {@link FleetSandbox} record objects.
|
|
377
|
+
*/
|
|
378
|
+
export const FleetSandbox = (() => {
|
|
379
|
+
const defaults = () => ({
|
|
380
|
+
});
|
|
381
|
+
const create = (() => {
|
|
382
|
+
return uniffiCreateRecord<FleetSandbox, ReturnType<typeof defaults>>(defaults);
|
|
383
|
+
})();
|
|
384
|
+
return Object.freeze({
|
|
385
|
+
create,
|
|
386
|
+
new: create,
|
|
387
|
+
defaults: () => Object.freeze(defaults()) as Partial<FleetSandbox>,
|
|
388
|
+
});
|
|
389
|
+
})();
|
|
390
|
+
|
|
391
|
+
const FfiConverterTypeFleetSandbox = (() => {
|
|
392
|
+
type TypeName = FleetSandbox;
|
|
393
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
394
|
+
read(from: RustBuffer): TypeName {
|
|
395
|
+
return {
|
|
396
|
+
name: FfiConverterString.read(from),
|
|
397
|
+
namespace: FfiConverterString.read(from),
|
|
398
|
+
claim: FfiConverterString.read(from),
|
|
399
|
+
services: FfiConverterSequenceString.read(from)
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
403
|
+
FfiConverterString.write(value.name, into);
|
|
404
|
+
FfiConverterString.write(value.namespace, into);
|
|
405
|
+
FfiConverterString.write(value.claim, into);
|
|
406
|
+
FfiConverterSequenceString.write(value.services, into);
|
|
407
|
+
}
|
|
408
|
+
allocationSize(value: TypeName): number {
|
|
409
|
+
return FfiConverterString.allocationSize(value.name) +
|
|
410
|
+
FfiConverterString.allocationSize(value.namespace) +
|
|
411
|
+
FfiConverterString.allocationSize(value.claim) +
|
|
412
|
+
FfiConverterSequenceString.allocationSize(value.services);
|
|
413
|
+
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
return new FFIConverter();
|
|
417
|
+
})();
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Media session options.
|
|
421
|
+
*/
|
|
422
|
+
export type MediaOpenOptions = {
|
|
423
|
+
/**
|
|
424
|
+
* Display id (primary when unset). Ignored when `window_handle` is set.
|
|
425
|
+
*/
|
|
426
|
+
display?: string,
|
|
427
|
+
/**
|
|
428
|
+
* Window handle (from `ListTargets` / `ListWindows`).
|
|
429
|
+
*/
|
|
430
|
+
windowHandle?: string,
|
|
431
|
+
/**
|
|
432
|
+
* FPS cap (0 = driver default).
|
|
433
|
+
*/
|
|
434
|
+
maxFps: number,
|
|
435
|
+
/**
|
|
436
|
+
* Long-edge cap (0 = native).
|
|
437
|
+
*/
|
|
438
|
+
maxDimension: number,
|
|
439
|
+
/**
|
|
440
|
+
* Also negotiate desktop/app audio (Opus).
|
|
441
|
+
*/
|
|
442
|
+
audio: boolean,
|
|
443
|
+
/**
|
|
444
|
+
* Audio only.
|
|
445
|
+
*/
|
|
446
|
+
disableVideo: boolean,
|
|
447
|
+
/**
|
|
448
|
+
* Extra `OpenMediaRequest` fields as proto3 JSON, merged over the
|
|
449
|
+
* above (escape hatch).
|
|
450
|
+
*/
|
|
451
|
+
requestJson?: string
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Generated factory for {@link MediaOpenOptions} record objects.
|
|
456
|
+
*/
|
|
457
|
+
export const MediaOpenOptions = (() => {
|
|
458
|
+
const defaults = () => ({
|
|
459
|
+
display: undefined,
|
|
460
|
+
windowHandle: undefined,
|
|
461
|
+
maxFps: 0,
|
|
462
|
+
maxDimension: 0,
|
|
463
|
+
audio: false,
|
|
464
|
+
disableVideo: false,
|
|
465
|
+
requestJson: undefined
|
|
466
|
+
});
|
|
467
|
+
const create = (() => {
|
|
468
|
+
return uniffiCreateRecord<MediaOpenOptions, ReturnType<typeof defaults>>(defaults);
|
|
469
|
+
})();
|
|
470
|
+
return Object.freeze({
|
|
471
|
+
create,
|
|
472
|
+
new: create,
|
|
473
|
+
defaults: () => Object.freeze(defaults()) as Partial<MediaOpenOptions>,
|
|
474
|
+
});
|
|
475
|
+
})();
|
|
476
|
+
|
|
477
|
+
const FfiConverterTypeMediaOpenOptions = (() => {
|
|
478
|
+
type TypeName = MediaOpenOptions;
|
|
479
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
480
|
+
read(from: RustBuffer): TypeName {
|
|
481
|
+
return {
|
|
482
|
+
display: FfiConverterOptionalString.read(from),
|
|
483
|
+
windowHandle: FfiConverterOptionalString.read(from),
|
|
484
|
+
maxFps: FfiConverterUInt32.read(from),
|
|
485
|
+
maxDimension: FfiConverterUInt32.read(from),
|
|
486
|
+
audio: FfiConverterBool.read(from),
|
|
487
|
+
disableVideo: FfiConverterBool.read(from),
|
|
488
|
+
requestJson: FfiConverterOptionalString.read(from)
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
492
|
+
FfiConverterOptionalString.write(value.display, into);
|
|
493
|
+
FfiConverterOptionalString.write(value.windowHandle, into);
|
|
494
|
+
FfiConverterUInt32.write(value.maxFps, into);
|
|
495
|
+
FfiConverterUInt32.write(value.maxDimension, into);
|
|
496
|
+
FfiConverterBool.write(value.audio, into);
|
|
497
|
+
FfiConverterBool.write(value.disableVideo, into);
|
|
498
|
+
FfiConverterOptionalString.write(value.requestJson, into);
|
|
499
|
+
}
|
|
500
|
+
allocationSize(value: TypeName): number {
|
|
501
|
+
return FfiConverterOptionalString.allocationSize(value.display) +
|
|
502
|
+
FfiConverterOptionalString.allocationSize(value.windowHandle) +
|
|
503
|
+
FfiConverterUInt32.allocationSize(value.maxFps) +
|
|
504
|
+
FfiConverterUInt32.allocationSize(value.maxDimension) +
|
|
505
|
+
FfiConverterBool.allocationSize(value.audio) +
|
|
506
|
+
FfiConverterBool.allocationSize(value.disableVideo) +
|
|
507
|
+
FfiConverterOptionalString.allocationSize(value.requestJson);
|
|
508
|
+
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
return new FFIConverter();
|
|
512
|
+
})();
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* A point.
|
|
516
|
+
*/
|
|
517
|
+
export type Point = {
|
|
518
|
+
/**
|
|
519
|
+
* X.
|
|
520
|
+
*/
|
|
521
|
+
x: number,
|
|
522
|
+
/**
|
|
523
|
+
* Y.
|
|
524
|
+
*/
|
|
525
|
+
y: number
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Generated factory for {@link Point} record objects.
|
|
530
|
+
*/
|
|
531
|
+
export const Point = (() => {
|
|
532
|
+
const defaults = () => ({
|
|
533
|
+
});
|
|
534
|
+
const create = (() => {
|
|
535
|
+
return uniffiCreateRecord<Point, ReturnType<typeof defaults>>(defaults);
|
|
536
|
+
})();
|
|
537
|
+
return Object.freeze({
|
|
538
|
+
create,
|
|
539
|
+
new: create,
|
|
540
|
+
defaults: () => Object.freeze(defaults()) as Partial<Point>,
|
|
541
|
+
});
|
|
542
|
+
})();
|
|
543
|
+
|
|
544
|
+
const FfiConverterTypePoint = (() => {
|
|
545
|
+
type TypeName = Point;
|
|
546
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
547
|
+
read(from: RustBuffer): TypeName {
|
|
548
|
+
return {
|
|
549
|
+
x: FfiConverterFloat64.read(from),
|
|
550
|
+
y: FfiConverterFloat64.read(from)
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
554
|
+
FfiConverterFloat64.write(value.x, into);
|
|
555
|
+
FfiConverterFloat64.write(value.y, into);
|
|
556
|
+
}
|
|
557
|
+
allocationSize(value: TypeName): number {
|
|
558
|
+
return FfiConverterFloat64.allocationSize(value.x) +
|
|
559
|
+
FfiConverterFloat64.allocationSize(value.y);
|
|
560
|
+
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
return new FFIConverter();
|
|
564
|
+
})();
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Kind of a process event.
|
|
568
|
+
*/
|
|
569
|
+
export enum ProcessEventKind {
|
|
570
|
+
/**
|
|
571
|
+
* stdout bytes.
|
|
572
|
+
*/
|
|
573
|
+
Stdout,
|
|
574
|
+
/**
|
|
575
|
+
* stderr bytes.
|
|
576
|
+
*/
|
|
577
|
+
Stderr,
|
|
578
|
+
/**
|
|
579
|
+
* PTY bytes.
|
|
580
|
+
*/
|
|
581
|
+
Pty,
|
|
582
|
+
/**
|
|
583
|
+
* The process ended (always last).
|
|
584
|
+
*/
|
|
585
|
+
Exit
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const FfiConverterTypeProcessEventKind = (() => {
|
|
589
|
+
const ordinalConverter = FfiConverterInt32;
|
|
590
|
+
type TypeName = ProcessEventKind;
|
|
591
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
592
|
+
read(from: RustBuffer): TypeName {
|
|
593
|
+
switch (ordinalConverter.read(from)) {
|
|
594
|
+
case 1: return ProcessEventKind.Stdout;
|
|
595
|
+
case 2: return ProcessEventKind.Stderr;
|
|
596
|
+
case 3: return ProcessEventKind.Pty;
|
|
597
|
+
case 4: return ProcessEventKind.Exit;
|
|
598
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
602
|
+
switch (value) {
|
|
603
|
+
case ProcessEventKind.Stdout: return ordinalConverter.write(1, into);
|
|
604
|
+
case ProcessEventKind.Stderr: return ordinalConverter.write(2, into);
|
|
605
|
+
case ProcessEventKind.Pty: return ordinalConverter.write(3, into);
|
|
606
|
+
case ProcessEventKind.Exit: return ordinalConverter.write(4, into);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
allocationSize(value: TypeName): number {
|
|
610
|
+
return ordinalConverter.allocationSize(0);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return new FFIConverter();
|
|
614
|
+
})();
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* One output chunk or the exit.
|
|
618
|
+
*/
|
|
619
|
+
export type ProcessEvent = {
|
|
620
|
+
/**
|
|
621
|
+
* Kind.
|
|
622
|
+
*/
|
|
623
|
+
kind: ProcessEventKind,
|
|
624
|
+
/**
|
|
625
|
+
* Combined-output offset of the first byte.
|
|
626
|
+
*/
|
|
627
|
+
offset: bigint,
|
|
628
|
+
/**
|
|
629
|
+
* Bytes (empty for `Exit`).
|
|
630
|
+
*/
|
|
631
|
+
data: ArrayBuffer,
|
|
632
|
+
/**
|
|
633
|
+
* Exit (only for `Exit`).
|
|
634
|
+
*/
|
|
635
|
+
exit?: ExitInfo
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Generated factory for {@link ProcessEvent} record objects.
|
|
640
|
+
*/
|
|
641
|
+
export const ProcessEvent = (() => {
|
|
642
|
+
const defaults = () => ({
|
|
643
|
+
});
|
|
644
|
+
const create = (() => {
|
|
645
|
+
return uniffiCreateRecord<ProcessEvent, ReturnType<typeof defaults>>(defaults);
|
|
646
|
+
})();
|
|
647
|
+
return Object.freeze({
|
|
648
|
+
create,
|
|
649
|
+
new: create,
|
|
650
|
+
defaults: () => Object.freeze(defaults()) as Partial<ProcessEvent>,
|
|
651
|
+
});
|
|
652
|
+
})();
|
|
653
|
+
|
|
654
|
+
const FfiConverterTypeProcessEvent = (() => {
|
|
655
|
+
type TypeName = ProcessEvent;
|
|
656
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
657
|
+
read(from: RustBuffer): TypeName {
|
|
658
|
+
return {
|
|
659
|
+
kind: FfiConverterTypeProcessEventKind.read(from),
|
|
660
|
+
offset: FfiConverterUInt64.read(from),
|
|
661
|
+
data: FfiConverterArrayBuffer.read(from),
|
|
662
|
+
exit: FfiConverterOptionalTypeExitInfo.read(from)
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
666
|
+
FfiConverterTypeProcessEventKind.write(value.kind, into);
|
|
667
|
+
FfiConverterUInt64.write(value.offset, into);
|
|
668
|
+
FfiConverterArrayBuffer.write(value.data, into);
|
|
669
|
+
FfiConverterOptionalTypeExitInfo.write(value.exit, into);
|
|
670
|
+
}
|
|
671
|
+
allocationSize(value: TypeName): number {
|
|
672
|
+
return FfiConverterTypeProcessEventKind.allocationSize(value.kind) +
|
|
673
|
+
FfiConverterUInt64.allocationSize(value.offset) +
|
|
674
|
+
FfiConverterArrayBuffer.allocationSize(value.data) +
|
|
675
|
+
FfiConverterOptionalTypeExitInfo.allocationSize(value.exit);
|
|
676
|
+
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
return new FFIConverter();
|
|
680
|
+
})();
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Collected output of a finished process.
|
|
684
|
+
*/
|
|
685
|
+
export type ProcessOutput = {
|
|
686
|
+
/**
|
|
687
|
+
* Exit.
|
|
688
|
+
*/
|
|
689
|
+
exit: ExitInfo,
|
|
690
|
+
/**
|
|
691
|
+
* stdout bytes.
|
|
692
|
+
*/
|
|
693
|
+
stdout: ArrayBuffer,
|
|
694
|
+
/**
|
|
695
|
+
* stderr bytes.
|
|
696
|
+
*/
|
|
697
|
+
stderr: ArrayBuffer,
|
|
698
|
+
/**
|
|
699
|
+
* PTY bytes.
|
|
700
|
+
*/
|
|
701
|
+
pty: ArrayBuffer
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Generated factory for {@link ProcessOutput} record objects.
|
|
706
|
+
*/
|
|
707
|
+
export const ProcessOutput = (() => {
|
|
708
|
+
const defaults = () => ({
|
|
709
|
+
});
|
|
710
|
+
const create = (() => {
|
|
711
|
+
return uniffiCreateRecord<ProcessOutput, ReturnType<typeof defaults>>(defaults);
|
|
712
|
+
})();
|
|
713
|
+
return Object.freeze({
|
|
714
|
+
create,
|
|
715
|
+
new: create,
|
|
716
|
+
defaults: () => Object.freeze(defaults()) as Partial<ProcessOutput>,
|
|
717
|
+
});
|
|
718
|
+
})();
|
|
719
|
+
|
|
720
|
+
const FfiConverterTypeProcessOutput = (() => {
|
|
721
|
+
type TypeName = ProcessOutput;
|
|
722
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
723
|
+
read(from: RustBuffer): TypeName {
|
|
724
|
+
return {
|
|
725
|
+
exit: FfiConverterTypeExitInfo.read(from),
|
|
726
|
+
stdout: FfiConverterArrayBuffer.read(from),
|
|
727
|
+
stderr: FfiConverterArrayBuffer.read(from),
|
|
728
|
+
pty: FfiConverterArrayBuffer.read(from)
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
732
|
+
FfiConverterTypeExitInfo.write(value.exit, into);
|
|
733
|
+
FfiConverterArrayBuffer.write(value.stdout, into);
|
|
734
|
+
FfiConverterArrayBuffer.write(value.stderr, into);
|
|
735
|
+
FfiConverterArrayBuffer.write(value.pty, into);
|
|
736
|
+
}
|
|
737
|
+
allocationSize(value: TypeName): number {
|
|
738
|
+
return FfiConverterTypeExitInfo.allocationSize(value.exit) +
|
|
739
|
+
FfiConverterArrayBuffer.allocationSize(value.stdout) +
|
|
740
|
+
FfiConverterArrayBuffer.allocationSize(value.stderr) +
|
|
741
|
+
FfiConverterArrayBuffer.allocationSize(value.pty);
|
|
742
|
+
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
return new FFIConverter();
|
|
746
|
+
})();
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* A PTY size.
|
|
750
|
+
*/
|
|
751
|
+
export type PtySize = {
|
|
752
|
+
/**
|
|
753
|
+
* Columns.
|
|
754
|
+
*/
|
|
755
|
+
cols: number,
|
|
756
|
+
/**
|
|
757
|
+
* Rows.
|
|
758
|
+
*/
|
|
759
|
+
rows: number
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Generated factory for {@link PtySize} record objects.
|
|
764
|
+
*/
|
|
765
|
+
export const PtySize = (() => {
|
|
766
|
+
const defaults = () => ({
|
|
767
|
+
});
|
|
768
|
+
const create = (() => {
|
|
769
|
+
return uniffiCreateRecord<PtySize, ReturnType<typeof defaults>>(defaults);
|
|
770
|
+
})();
|
|
771
|
+
return Object.freeze({
|
|
772
|
+
create,
|
|
773
|
+
new: create,
|
|
774
|
+
defaults: () => Object.freeze(defaults()) as Partial<PtySize>,
|
|
775
|
+
});
|
|
776
|
+
})();
|
|
777
|
+
|
|
778
|
+
const FfiConverterTypePtySize = (() => {
|
|
779
|
+
type TypeName = PtySize;
|
|
780
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
781
|
+
read(from: RustBuffer): TypeName {
|
|
782
|
+
return {
|
|
783
|
+
cols: FfiConverterUInt32.read(from),
|
|
784
|
+
rows: FfiConverterUInt32.read(from)
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
788
|
+
FfiConverterUInt32.write(value.cols, into);
|
|
789
|
+
FfiConverterUInt32.write(value.rows, into);
|
|
790
|
+
}
|
|
791
|
+
allocationSize(value: TypeName): number {
|
|
792
|
+
return FfiConverterUInt32.allocationSize(value.cols) +
|
|
793
|
+
FfiConverterUInt32.allocationSize(value.rows);
|
|
794
|
+
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
return new FFIConverter();
|
|
798
|
+
})();
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Screenshot encoding.
|
|
802
|
+
*/
|
|
803
|
+
export enum ImageFormat {
|
|
804
|
+
/**
|
|
805
|
+
* PNG.
|
|
806
|
+
*/
|
|
807
|
+
Png,
|
|
808
|
+
/**
|
|
809
|
+
* JPEG.
|
|
810
|
+
*/
|
|
811
|
+
Jpeg,
|
|
812
|
+
/**
|
|
813
|
+
* WebP.
|
|
814
|
+
*/
|
|
815
|
+
Webp
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
const FfiConverterTypeImageFormat = (() => {
|
|
819
|
+
const ordinalConverter = FfiConverterInt32;
|
|
820
|
+
type TypeName = ImageFormat;
|
|
821
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
822
|
+
read(from: RustBuffer): TypeName {
|
|
823
|
+
switch (ordinalConverter.read(from)) {
|
|
824
|
+
case 1: return ImageFormat.Png;
|
|
825
|
+
case 2: return ImageFormat.Jpeg;
|
|
826
|
+
case 3: return ImageFormat.Webp;
|
|
827
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
831
|
+
switch (value) {
|
|
832
|
+
case ImageFormat.Png: return ordinalConverter.write(1, into);
|
|
833
|
+
case ImageFormat.Jpeg: return ordinalConverter.write(2, into);
|
|
834
|
+
case ImageFormat.Webp: return ordinalConverter.write(3, into);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
allocationSize(value: TypeName): number {
|
|
838
|
+
return ordinalConverter.allocationSize(0);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
return new FFIConverter();
|
|
842
|
+
})();
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* A captured screenshot.
|
|
846
|
+
*/
|
|
847
|
+
export type Screenshot = {
|
|
848
|
+
/**
|
|
849
|
+
* Encoded image.
|
|
850
|
+
*/
|
|
851
|
+
image: ArrayBuffer,
|
|
852
|
+
/**
|
|
853
|
+
* Encoding.
|
|
854
|
+
*/
|
|
855
|
+
format: ImageFormat,
|
|
856
|
+
/**
|
|
857
|
+
* Pixel width.
|
|
858
|
+
*/
|
|
859
|
+
width: number,
|
|
860
|
+
/**
|
|
861
|
+
* Pixel height.
|
|
862
|
+
*/
|
|
863
|
+
height: number,
|
|
864
|
+
/**
|
|
865
|
+
* Image pixels per logical point.
|
|
866
|
+
*/
|
|
867
|
+
scale: number,
|
|
868
|
+
/**
|
|
869
|
+
* Id for screenshot-space input.
|
|
870
|
+
*/
|
|
871
|
+
screenshotId: string
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Generated factory for {@link Screenshot} record objects.
|
|
876
|
+
*/
|
|
877
|
+
export const Screenshot = (() => {
|
|
878
|
+
const defaults = () => ({
|
|
879
|
+
});
|
|
880
|
+
const create = (() => {
|
|
881
|
+
return uniffiCreateRecord<Screenshot, ReturnType<typeof defaults>>(defaults);
|
|
882
|
+
})();
|
|
883
|
+
return Object.freeze({
|
|
884
|
+
create,
|
|
885
|
+
new: create,
|
|
886
|
+
defaults: () => Object.freeze(defaults()) as Partial<Screenshot>,
|
|
887
|
+
});
|
|
888
|
+
})();
|
|
889
|
+
|
|
890
|
+
const FfiConverterTypeScreenshot = (() => {
|
|
891
|
+
type TypeName = Screenshot;
|
|
892
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
893
|
+
read(from: RustBuffer): TypeName {
|
|
894
|
+
return {
|
|
895
|
+
image: FfiConverterArrayBuffer.read(from),
|
|
896
|
+
format: FfiConverterTypeImageFormat.read(from),
|
|
897
|
+
width: FfiConverterUInt32.read(from),
|
|
898
|
+
height: FfiConverterUInt32.read(from),
|
|
899
|
+
scale: FfiConverterFloat64.read(from),
|
|
900
|
+
screenshotId: FfiConverterString.read(from)
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
904
|
+
FfiConverterArrayBuffer.write(value.image, into);
|
|
905
|
+
FfiConverterTypeImageFormat.write(value.format, into);
|
|
906
|
+
FfiConverterUInt32.write(value.width, into);
|
|
907
|
+
FfiConverterUInt32.write(value.height, into);
|
|
908
|
+
FfiConverterFloat64.write(value.scale, into);
|
|
909
|
+
FfiConverterString.write(value.screenshotId, into);
|
|
910
|
+
}
|
|
911
|
+
allocationSize(value: TypeName): number {
|
|
912
|
+
return FfiConverterArrayBuffer.allocationSize(value.image) +
|
|
913
|
+
FfiConverterTypeImageFormat.allocationSize(value.format) +
|
|
914
|
+
FfiConverterUInt32.allocationSize(value.width) +
|
|
915
|
+
FfiConverterUInt32.allocationSize(value.height) +
|
|
916
|
+
FfiConverterFloat64.allocationSize(value.scale) +
|
|
917
|
+
FfiConverterString.allocationSize(value.screenshotId);
|
|
918
|
+
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
return new FFIConverter();
|
|
922
|
+
})();
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Screenshot options.
|
|
926
|
+
*/
|
|
927
|
+
export type ScreenshotOptions = {
|
|
928
|
+
/**
|
|
929
|
+
* Display id (primary when unset).
|
|
930
|
+
*/
|
|
931
|
+
display?: string,
|
|
932
|
+
/**
|
|
933
|
+
* Encoding (PNG when unset).
|
|
934
|
+
*/
|
|
935
|
+
format?: ImageFormat,
|
|
936
|
+
/**
|
|
937
|
+
* Lossy quality 1–100.
|
|
938
|
+
*/
|
|
939
|
+
quality?: number,
|
|
940
|
+
/**
|
|
941
|
+
* Long-edge cap in pixels.
|
|
942
|
+
*/
|
|
943
|
+
maxDimension?: number,
|
|
944
|
+
/**
|
|
945
|
+
* Draw the cursor.
|
|
946
|
+
*/
|
|
947
|
+
includeCursor: boolean
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Generated factory for {@link ScreenshotOptions} record objects.
|
|
952
|
+
*/
|
|
953
|
+
export const ScreenshotOptions = (() => {
|
|
954
|
+
const defaults = () => ({
|
|
955
|
+
display: undefined,
|
|
956
|
+
format: undefined,
|
|
957
|
+
quality: undefined,
|
|
958
|
+
maxDimension: undefined,
|
|
959
|
+
includeCursor: false
|
|
960
|
+
});
|
|
961
|
+
const create = (() => {
|
|
962
|
+
return uniffiCreateRecord<ScreenshotOptions, ReturnType<typeof defaults>>(defaults);
|
|
963
|
+
})();
|
|
964
|
+
return Object.freeze({
|
|
965
|
+
create,
|
|
966
|
+
new: create,
|
|
967
|
+
defaults: () => Object.freeze(defaults()) as Partial<ScreenshotOptions>,
|
|
968
|
+
});
|
|
969
|
+
})();
|
|
970
|
+
|
|
971
|
+
const FfiConverterTypeScreenshotOptions = (() => {
|
|
972
|
+
type TypeName = ScreenshotOptions;
|
|
973
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
974
|
+
read(from: RustBuffer): TypeName {
|
|
975
|
+
return {
|
|
976
|
+
display: FfiConverterOptionalString.read(from),
|
|
977
|
+
format: FfiConverterOptionalTypeImageFormat.read(from),
|
|
978
|
+
quality: FfiConverterOptionalUInt32.read(from),
|
|
979
|
+
maxDimension: FfiConverterOptionalUInt32.read(from),
|
|
980
|
+
includeCursor: FfiConverterBool.read(from)
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
984
|
+
FfiConverterOptionalString.write(value.display, into);
|
|
985
|
+
FfiConverterOptionalTypeImageFormat.write(value.format, into);
|
|
986
|
+
FfiConverterOptionalUInt32.write(value.quality, into);
|
|
987
|
+
FfiConverterOptionalUInt32.write(value.maxDimension, into);
|
|
988
|
+
FfiConverterBool.write(value.includeCursor, into);
|
|
989
|
+
}
|
|
990
|
+
allocationSize(value: TypeName): number {
|
|
991
|
+
return FfiConverterOptionalString.allocationSize(value.display) +
|
|
992
|
+
FfiConverterOptionalTypeImageFormat.allocationSize(value.format) +
|
|
993
|
+
FfiConverterOptionalUInt32.allocationSize(value.quality) +
|
|
994
|
+
FfiConverterOptionalUInt32.allocationSize(value.maxDimension) +
|
|
995
|
+
FfiConverterBool.allocationSize(value.includeCursor);
|
|
996
|
+
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
return new FFIConverter();
|
|
1000
|
+
})();
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* One capability flag.
|
|
1004
|
+
*/
|
|
1005
|
+
export type SpacesdFeature = {
|
|
1006
|
+
/**
|
|
1007
|
+
* Feature name (for example `a11y`, `stream.h264`, `audio.desktop`).
|
|
1008
|
+
*/
|
|
1009
|
+
name: string,
|
|
1010
|
+
/**
|
|
1011
|
+
* Supported in this guest.
|
|
1012
|
+
*/
|
|
1013
|
+
supported: boolean,
|
|
1014
|
+
/**
|
|
1015
|
+
* Limitation when degraded or unsupported.
|
|
1016
|
+
*/
|
|
1017
|
+
limitation?: string,
|
|
1018
|
+
/**
|
|
1019
|
+
* Extra attributes.
|
|
1020
|
+
*/
|
|
1021
|
+
attributes: Map<string, string>
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Generated factory for {@link SpacesdFeature} record objects.
|
|
1026
|
+
*/
|
|
1027
|
+
export const SpacesdFeature = (() => {
|
|
1028
|
+
const defaults = () => ({
|
|
1029
|
+
});
|
|
1030
|
+
const create = (() => {
|
|
1031
|
+
return uniffiCreateRecord<SpacesdFeature, ReturnType<typeof defaults>>(defaults);
|
|
1032
|
+
})();
|
|
1033
|
+
return Object.freeze({
|
|
1034
|
+
create,
|
|
1035
|
+
new: create,
|
|
1036
|
+
defaults: () => Object.freeze(defaults()) as Partial<SpacesdFeature>,
|
|
1037
|
+
});
|
|
1038
|
+
})();
|
|
1039
|
+
|
|
1040
|
+
const FfiConverterTypeSpacesdFeature = (() => {
|
|
1041
|
+
type TypeName = SpacesdFeature;
|
|
1042
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1043
|
+
read(from: RustBuffer): TypeName {
|
|
1044
|
+
return {
|
|
1045
|
+
name: FfiConverterString.read(from),
|
|
1046
|
+
supported: FfiConverterBool.read(from),
|
|
1047
|
+
limitation: FfiConverterOptionalString.read(from),
|
|
1048
|
+
attributes: FfiConverterMapStringString.read(from)
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1052
|
+
FfiConverterString.write(value.name, into);
|
|
1053
|
+
FfiConverterBool.write(value.supported, into);
|
|
1054
|
+
FfiConverterOptionalString.write(value.limitation, into);
|
|
1055
|
+
FfiConverterMapStringString.write(value.attributes, into);
|
|
1056
|
+
}
|
|
1057
|
+
allocationSize(value: TypeName): number {
|
|
1058
|
+
return FfiConverterString.allocationSize(value.name) +
|
|
1059
|
+
FfiConverterBool.allocationSize(value.supported) +
|
|
1060
|
+
FfiConverterOptionalString.allocationSize(value.limitation) +
|
|
1061
|
+
FfiConverterMapStringString.allocationSize(value.attributes);
|
|
1062
|
+
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
return new FFIConverter();
|
|
1066
|
+
})();
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* `SystemService.GetCapabilities`, summarized. `json` has everything.
|
|
1070
|
+
*/
|
|
1071
|
+
export type SpacesdCapabilities = {
|
|
1072
|
+
/**
|
|
1073
|
+
* spacesd version.
|
|
1074
|
+
*/
|
|
1075
|
+
version: string,
|
|
1076
|
+
/**
|
|
1077
|
+
* `cua.env.v1` protocol version.
|
|
1078
|
+
*/
|
|
1079
|
+
protocolVersion: number,
|
|
1080
|
+
/**
|
|
1081
|
+
* Additive contract revision.
|
|
1082
|
+
*/
|
|
1083
|
+
protocolRevision: number,
|
|
1084
|
+
/**
|
|
1085
|
+
* OS family (`linux`, `macos`, `windows`).
|
|
1086
|
+
*/
|
|
1087
|
+
osFamily: string,
|
|
1088
|
+
/**
|
|
1089
|
+
* OS name.
|
|
1090
|
+
*/
|
|
1091
|
+
osName: string,
|
|
1092
|
+
/**
|
|
1093
|
+
* OS version.
|
|
1094
|
+
*/
|
|
1095
|
+
osVersion: string,
|
|
1096
|
+
/**
|
|
1097
|
+
* CPU architecture.
|
|
1098
|
+
*/
|
|
1099
|
+
arch: string,
|
|
1100
|
+
/**
|
|
1101
|
+
* Guest hostname.
|
|
1102
|
+
*/
|
|
1103
|
+
hostname: string,
|
|
1104
|
+
/**
|
|
1105
|
+
* `SystemService.Init` has run.
|
|
1106
|
+
*/
|
|
1107
|
+
initialized: boolean,
|
|
1108
|
+
/**
|
|
1109
|
+
* Feature flags.
|
|
1110
|
+
*/
|
|
1111
|
+
features: Array<SpacesdFeature>,
|
|
1112
|
+
/**
|
|
1113
|
+
* The full response as proto3 JSON.
|
|
1114
|
+
*/
|
|
1115
|
+
json: string
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Generated factory for {@link SpacesdCapabilities} record objects.
|
|
1120
|
+
*/
|
|
1121
|
+
export const SpacesdCapabilities = (() => {
|
|
1122
|
+
const defaults = () => ({
|
|
1123
|
+
});
|
|
1124
|
+
const create = (() => {
|
|
1125
|
+
return uniffiCreateRecord<SpacesdCapabilities, ReturnType<typeof defaults>>(defaults);
|
|
1126
|
+
})();
|
|
1127
|
+
return Object.freeze({
|
|
1128
|
+
create,
|
|
1129
|
+
new: create,
|
|
1130
|
+
defaults: () => Object.freeze(defaults()) as Partial<SpacesdCapabilities>,
|
|
1131
|
+
});
|
|
1132
|
+
})();
|
|
1133
|
+
|
|
1134
|
+
const FfiConverterTypeSpacesdCapabilities = (() => {
|
|
1135
|
+
type TypeName = SpacesdCapabilities;
|
|
1136
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1137
|
+
read(from: RustBuffer): TypeName {
|
|
1138
|
+
return {
|
|
1139
|
+
version: FfiConverterString.read(from),
|
|
1140
|
+
protocolVersion: FfiConverterUInt32.read(from),
|
|
1141
|
+
protocolRevision: FfiConverterUInt32.read(from),
|
|
1142
|
+
osFamily: FfiConverterString.read(from),
|
|
1143
|
+
osName: FfiConverterString.read(from),
|
|
1144
|
+
osVersion: FfiConverterString.read(from),
|
|
1145
|
+
arch: FfiConverterString.read(from),
|
|
1146
|
+
hostname: FfiConverterString.read(from),
|
|
1147
|
+
initialized: FfiConverterBool.read(from),
|
|
1148
|
+
features: FfiConverterSequenceTypeSpacesdFeature.read(from),
|
|
1149
|
+
json: FfiConverterString.read(from)
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1153
|
+
FfiConverterString.write(value.version, into);
|
|
1154
|
+
FfiConverterUInt32.write(value.protocolVersion, into);
|
|
1155
|
+
FfiConverterUInt32.write(value.protocolRevision, into);
|
|
1156
|
+
FfiConverterString.write(value.osFamily, into);
|
|
1157
|
+
FfiConverterString.write(value.osName, into);
|
|
1158
|
+
FfiConverterString.write(value.osVersion, into);
|
|
1159
|
+
FfiConverterString.write(value.arch, into);
|
|
1160
|
+
FfiConverterString.write(value.hostname, into);
|
|
1161
|
+
FfiConverterBool.write(value.initialized, into);
|
|
1162
|
+
FfiConverterSequenceTypeSpacesdFeature.write(value.features, into);
|
|
1163
|
+
FfiConverterString.write(value.json, into);
|
|
1164
|
+
}
|
|
1165
|
+
allocationSize(value: TypeName): number {
|
|
1166
|
+
return FfiConverterString.allocationSize(value.version) +
|
|
1167
|
+
FfiConverterUInt32.allocationSize(value.protocolVersion) +
|
|
1168
|
+
FfiConverterUInt32.allocationSize(value.protocolRevision) +
|
|
1169
|
+
FfiConverterString.allocationSize(value.osFamily) +
|
|
1170
|
+
FfiConverterString.allocationSize(value.osName) +
|
|
1171
|
+
FfiConverterString.allocationSize(value.osVersion) +
|
|
1172
|
+
FfiConverterString.allocationSize(value.arch) +
|
|
1173
|
+
FfiConverterString.allocationSize(value.hostname) +
|
|
1174
|
+
FfiConverterBool.allocationSize(value.initialized) +
|
|
1175
|
+
FfiConverterSequenceTypeSpacesdFeature.allocationSize(value.features) +
|
|
1176
|
+
FfiConverterString.allocationSize(value.json);
|
|
1177
|
+
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
return new FFIConverter();
|
|
1181
|
+
})();
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* A command to run in the guest.
|
|
1185
|
+
*/
|
|
1186
|
+
export type SpacesdCommand = {
|
|
1187
|
+
/**
|
|
1188
|
+
* Program (absolute path or `PATH` lookup).
|
|
1189
|
+
*/
|
|
1190
|
+
program: string,
|
|
1191
|
+
/**
|
|
1192
|
+
* Arguments.
|
|
1193
|
+
*/
|
|
1194
|
+
args: Array<string>,
|
|
1195
|
+
/**
|
|
1196
|
+
* Extra environment.
|
|
1197
|
+
*/
|
|
1198
|
+
env: Map<string, string>,
|
|
1199
|
+
/**
|
|
1200
|
+
* Working directory.
|
|
1201
|
+
*/
|
|
1202
|
+
cwd?: string,
|
|
1203
|
+
/**
|
|
1204
|
+
* Run as this user.
|
|
1205
|
+
*/
|
|
1206
|
+
user?: string,
|
|
1207
|
+
/**
|
|
1208
|
+
* Kill after this long.
|
|
1209
|
+
*/
|
|
1210
|
+
timeoutMs?: number,
|
|
1211
|
+
/**
|
|
1212
|
+
* Tag for reattaching (`attach(tag=…)`).
|
|
1213
|
+
*/
|
|
1214
|
+
tag?: string,
|
|
1215
|
+
/**
|
|
1216
|
+
* Keep stdin open for `write_stdin`.
|
|
1217
|
+
*/
|
|
1218
|
+
stdin: boolean,
|
|
1219
|
+
/**
|
|
1220
|
+
* Run in a PTY of this size.
|
|
1221
|
+
*/
|
|
1222
|
+
pty?: PtySize
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* Generated factory for {@link SpacesdCommand} record objects.
|
|
1227
|
+
*/
|
|
1228
|
+
export const SpacesdCommand = (() => {
|
|
1229
|
+
const defaults = () => ({
|
|
1230
|
+
args: [],
|
|
1231
|
+
env: new Map(),
|
|
1232
|
+
cwd: undefined,
|
|
1233
|
+
user: undefined,
|
|
1234
|
+
timeoutMs: undefined,
|
|
1235
|
+
tag: undefined,
|
|
1236
|
+
stdin: false,
|
|
1237
|
+
pty: undefined
|
|
1238
|
+
});
|
|
1239
|
+
const create = (() => {
|
|
1240
|
+
return uniffiCreateRecord<SpacesdCommand, ReturnType<typeof defaults>>(defaults);
|
|
1241
|
+
})();
|
|
1242
|
+
return Object.freeze({
|
|
1243
|
+
create,
|
|
1244
|
+
new: create,
|
|
1245
|
+
defaults: () => Object.freeze(defaults()) as Partial<SpacesdCommand>,
|
|
1246
|
+
});
|
|
1247
|
+
})();
|
|
1248
|
+
|
|
1249
|
+
const FfiConverterTypeSpacesdCommand = (() => {
|
|
1250
|
+
type TypeName = SpacesdCommand;
|
|
1251
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1252
|
+
read(from: RustBuffer): TypeName {
|
|
1253
|
+
return {
|
|
1254
|
+
program: FfiConverterString.read(from),
|
|
1255
|
+
args: FfiConverterSequenceString.read(from),
|
|
1256
|
+
env: FfiConverterMapStringString.read(from),
|
|
1257
|
+
cwd: FfiConverterOptionalString.read(from),
|
|
1258
|
+
user: FfiConverterOptionalString.read(from),
|
|
1259
|
+
timeoutMs: FfiConverterOptionalUInt32.read(from),
|
|
1260
|
+
tag: FfiConverterOptionalString.read(from),
|
|
1261
|
+
stdin: FfiConverterBool.read(from),
|
|
1262
|
+
pty: FfiConverterOptionalTypePtySize.read(from)
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1266
|
+
FfiConverterString.write(value.program, into);
|
|
1267
|
+
FfiConverterSequenceString.write(value.args, into);
|
|
1268
|
+
FfiConverterMapStringString.write(value.env, into);
|
|
1269
|
+
FfiConverterOptionalString.write(value.cwd, into);
|
|
1270
|
+
FfiConverterOptionalString.write(value.user, into);
|
|
1271
|
+
FfiConverterOptionalUInt32.write(value.timeoutMs, into);
|
|
1272
|
+
FfiConverterOptionalString.write(value.tag, into);
|
|
1273
|
+
FfiConverterBool.write(value.stdin, into);
|
|
1274
|
+
FfiConverterOptionalTypePtySize.write(value.pty, into);
|
|
1275
|
+
}
|
|
1276
|
+
allocationSize(value: TypeName): number {
|
|
1277
|
+
return FfiConverterString.allocationSize(value.program) +
|
|
1278
|
+
FfiConverterSequenceString.allocationSize(value.args) +
|
|
1279
|
+
FfiConverterMapStringString.allocationSize(value.env) +
|
|
1280
|
+
FfiConverterOptionalString.allocationSize(value.cwd) +
|
|
1281
|
+
FfiConverterOptionalString.allocationSize(value.user) +
|
|
1282
|
+
FfiConverterOptionalUInt32.allocationSize(value.timeoutMs) +
|
|
1283
|
+
FfiConverterOptionalString.allocationSize(value.tag) +
|
|
1284
|
+
FfiConverterBool.allocationSize(value.stdin) +
|
|
1285
|
+
FfiConverterOptionalTypePtySize.allocationSize(value.pty);
|
|
1286
|
+
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
return new FFIConverter();
|
|
1290
|
+
})();
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Result of an upload or download.
|
|
1294
|
+
*/
|
|
1295
|
+
export type TransferResult = {
|
|
1296
|
+
/**
|
|
1297
|
+
* Bytes transferred.
|
|
1298
|
+
*/
|
|
1299
|
+
size: bigint,
|
|
1300
|
+
/**
|
|
1301
|
+
* SHA-256 (hex) of the content.
|
|
1302
|
+
*/
|
|
1303
|
+
sha256: string,
|
|
1304
|
+
/**
|
|
1305
|
+
* Resumes after dropped connections.
|
|
1306
|
+
*/
|
|
1307
|
+
resumes: number
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* Generated factory for {@link TransferResult} record objects.
|
|
1312
|
+
*/
|
|
1313
|
+
export const TransferResult = (() => {
|
|
1314
|
+
const defaults = () => ({
|
|
1315
|
+
});
|
|
1316
|
+
const create = (() => {
|
|
1317
|
+
return uniffiCreateRecord<TransferResult, ReturnType<typeof defaults>>(defaults);
|
|
1318
|
+
})();
|
|
1319
|
+
return Object.freeze({
|
|
1320
|
+
create,
|
|
1321
|
+
new: create,
|
|
1322
|
+
defaults: () => Object.freeze(defaults()) as Partial<TransferResult>,
|
|
1323
|
+
});
|
|
1324
|
+
})();
|
|
1325
|
+
|
|
1326
|
+
const FfiConverterTypeTransferResult = (() => {
|
|
1327
|
+
type TypeName = TransferResult;
|
|
1328
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1329
|
+
read(from: RustBuffer): TypeName {
|
|
1330
|
+
return {
|
|
1331
|
+
size: FfiConverterUInt64.read(from),
|
|
1332
|
+
sha256: FfiConverterString.read(from),
|
|
1333
|
+
resumes: FfiConverterUInt32.read(from)
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1337
|
+
FfiConverterUInt64.write(value.size, into);
|
|
1338
|
+
FfiConverterString.write(value.sha256, into);
|
|
1339
|
+
FfiConverterUInt32.write(value.resumes, into);
|
|
1340
|
+
}
|
|
1341
|
+
allocationSize(value: TypeName): number {
|
|
1342
|
+
return FfiConverterUInt64.allocationSize(value.size) +
|
|
1343
|
+
FfiConverterString.allocationSize(value.sha256) +
|
|
1344
|
+
FfiConverterUInt32.allocationSize(value.resumes);
|
|
1345
|
+
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
return new FFIConverter();
|
|
1349
|
+
})();
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* Upload options.
|
|
1353
|
+
*/
|
|
1354
|
+
export type UploadOptions = {
|
|
1355
|
+
/**
|
|
1356
|
+
* Fail when the file exists (instead of overwriting).
|
|
1357
|
+
*/
|
|
1358
|
+
createNew: boolean,
|
|
1359
|
+
/**
|
|
1360
|
+
* Append instead of overwriting.
|
|
1361
|
+
*/
|
|
1362
|
+
append: boolean,
|
|
1363
|
+
/**
|
|
1364
|
+
* Unix permissions (0 = default).
|
|
1365
|
+
*/
|
|
1366
|
+
permissions: number,
|
|
1367
|
+
/**
|
|
1368
|
+
* Create missing parent directories.
|
|
1369
|
+
*/
|
|
1370
|
+
createParents: boolean
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* Generated factory for {@link UploadOptions} record objects.
|
|
1375
|
+
*/
|
|
1376
|
+
export const UploadOptions = (() => {
|
|
1377
|
+
const defaults = () => ({
|
|
1378
|
+
createNew: false,
|
|
1379
|
+
append: false,
|
|
1380
|
+
permissions: 0,
|
|
1381
|
+
createParents: true
|
|
1382
|
+
});
|
|
1383
|
+
const create = (() => {
|
|
1384
|
+
return uniffiCreateRecord<UploadOptions, ReturnType<typeof defaults>>(defaults);
|
|
1385
|
+
})();
|
|
1386
|
+
return Object.freeze({
|
|
1387
|
+
create,
|
|
1388
|
+
new: create,
|
|
1389
|
+
defaults: () => Object.freeze(defaults()) as Partial<UploadOptions>,
|
|
1390
|
+
});
|
|
1391
|
+
})();
|
|
1392
|
+
|
|
1393
|
+
const FfiConverterTypeUploadOptions = (() => {
|
|
1394
|
+
type TypeName = UploadOptions;
|
|
1395
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1396
|
+
read(from: RustBuffer): TypeName {
|
|
1397
|
+
return {
|
|
1398
|
+
createNew: FfiConverterBool.read(from),
|
|
1399
|
+
append: FfiConverterBool.read(from),
|
|
1400
|
+
permissions: FfiConverterUInt32.read(from),
|
|
1401
|
+
createParents: FfiConverterBool.read(from)
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1405
|
+
FfiConverterBool.write(value.createNew, into);
|
|
1406
|
+
FfiConverterBool.write(value.append, into);
|
|
1407
|
+
FfiConverterUInt32.write(value.permissions, into);
|
|
1408
|
+
FfiConverterBool.write(value.createParents, into);
|
|
1409
|
+
}
|
|
1410
|
+
allocationSize(value: TypeName): number {
|
|
1411
|
+
return FfiConverterBool.allocationSize(value.createNew) +
|
|
1412
|
+
FfiConverterBool.allocationSize(value.append) +
|
|
1413
|
+
FfiConverterUInt32.allocationSize(value.permissions) +
|
|
1414
|
+
FfiConverterBool.allocationSize(value.createParents);
|
|
1415
|
+
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
return new FFIConverter();
|
|
1419
|
+
})();
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
// Flat error type: CuaError
|
|
1423
|
+
export enum CuaError_Tags {
|
|
1424
|
+
InvalidArgument = "InvalidArgument",
|
|
1425
|
+
InvalidPlacement = "InvalidPlacement",
|
|
1426
|
+
NotFound = "NotFound",
|
|
1427
|
+
ProviderNotConfigured = "ProviderNotConfigured",
|
|
1428
|
+
Unsupported = "Unsupported",
|
|
1429
|
+
SpacesdNotAvailable = "SpacesdNotAvailable",
|
|
1430
|
+
Timeout = "Timeout",
|
|
1431
|
+
Fleet = "Fleet",
|
|
1432
|
+
FleetAdmissionDenied = "FleetAdmissionDenied",
|
|
1433
|
+
CloudCreditExhausted = "CloudCreditExhausted",
|
|
1434
|
+
Runtime = "Runtime",
|
|
1435
|
+
Env = "Env",
|
|
1436
|
+
Http = "Http",
|
|
1437
|
+
Unauthenticated = "Unauthenticated",
|
|
1438
|
+
PermissionDenied = "PermissionDenied",
|
|
1439
|
+
Transport = "Transport",
|
|
1440
|
+
DaemonNotRunning = "DaemonNotRunning",
|
|
1441
|
+
Closed = "Closed",
|
|
1442
|
+
CapabilityMissing = "CapabilityMissing",
|
|
1443
|
+
HostCapabilityMissing = "HostCapabilityMissing",
|
|
1444
|
+
TeleportRefused = "TeleportRefused",
|
|
1445
|
+
PoolSpecMismatch = "PoolSpecMismatch",
|
|
1446
|
+
ClaimSecretsNotDelivered = "ClaimSecretsNotDelivered",
|
|
1447
|
+
Internal = "Internal",
|
|
1448
|
+
AmbiguousSandbox = "AmbiguousSandbox",
|
|
1449
|
+
InsufficientDisk = "InsufficientDisk",
|
|
1450
|
+
ImageNotPublished = "ImageNotPublished",
|
|
1451
|
+
Cancelled = "Cancelled",
|
|
1452
|
+
Cloud = "Cloud"
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Every error the SDK raises. Flat across the FFI: each language sees one
|
|
1456
|
+
* exception/error type with a case per variant and the message.
|
|
1457
|
+
*/
|
|
1458
|
+
export const CuaError = (() => {
|
|
1459
|
+
/**
|
|
1460
|
+
* Bad input.
|
|
1461
|
+
*
|
|
1462
|
+
* Fix: Check the value against the reference; the message names the
|
|
1463
|
+
* argument and what it accepts.
|
|
1464
|
+
*/
|
|
1465
|
+
class InvalidArgument extends UniffiError {
|
|
1466
|
+
/**
|
|
1467
|
+
* @private
|
|
1468
|
+
* This field is private and should not be used.
|
|
1469
|
+
*/
|
|
1470
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1471
|
+
/**
|
|
1472
|
+
* @private
|
|
1473
|
+
* This field is private and should not be used.
|
|
1474
|
+
*/
|
|
1475
|
+
readonly [variantOrdinalSymbol] = 1;
|
|
1476
|
+
|
|
1477
|
+
readonly tag = CuaError_Tags.InvalidArgument;
|
|
1478
|
+
|
|
1479
|
+
constructor(message: string) {
|
|
1480
|
+
super("CuaError", "InvalidArgument", message);
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
static instanceOf(e: any): e is InvalidArgument {
|
|
1484
|
+
return (
|
|
1485
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* A location, kind or runtime that does not exist, or a combination of
|
|
1491
|
+
* them (or with the image) that does not. The message ends with the
|
|
1492
|
+
* valid values for that context.
|
|
1493
|
+
*
|
|
1494
|
+
* Fix: Use one of the values the message lists, or leave `kind` and
|
|
1495
|
+
* `runtime` unset (`auto`). `cua config list` shows the defaults in
|
|
1496
|
+
* effect.
|
|
1497
|
+
*/
|
|
1498
|
+
class InvalidPlacement extends UniffiError {
|
|
1499
|
+
/**
|
|
1500
|
+
* @private
|
|
1501
|
+
* This field is private and should not be used.
|
|
1502
|
+
*/
|
|
1503
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1504
|
+
/**
|
|
1505
|
+
* @private
|
|
1506
|
+
* This field is private and should not be used.
|
|
1507
|
+
*/
|
|
1508
|
+
readonly [variantOrdinalSymbol] = 2;
|
|
1509
|
+
|
|
1510
|
+
readonly tag = CuaError_Tags.InvalidPlacement;
|
|
1511
|
+
|
|
1512
|
+
constructor(message: string) {
|
|
1513
|
+
super("CuaError", "InvalidPlacement", message);
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
static instanceOf(e: any): e is InvalidPlacement {
|
|
1517
|
+
return (
|
|
1518
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 2
|
|
1519
|
+
);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* No such sandbox, process, path, forward or session.
|
|
1524
|
+
*
|
|
1525
|
+
* Fix: Check the ref, path or id. `Sandboxes.list` (`cua sb ls`) lists the
|
|
1526
|
+
* sandboxes this client can see.
|
|
1527
|
+
*/
|
|
1528
|
+
class NotFound extends UniffiError {
|
|
1529
|
+
/**
|
|
1530
|
+
* @private
|
|
1531
|
+
* This field is private and should not be used.
|
|
1532
|
+
*/
|
|
1533
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1534
|
+
/**
|
|
1535
|
+
* @private
|
|
1536
|
+
* This field is private and should not be used.
|
|
1537
|
+
*/
|
|
1538
|
+
readonly [variantOrdinalSymbol] = 3;
|
|
1539
|
+
|
|
1540
|
+
readonly tag = CuaError_Tags.NotFound;
|
|
1541
|
+
|
|
1542
|
+
constructor(message: string) {
|
|
1543
|
+
super("CuaError", "NotFound", message);
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
static instanceOf(e: any): e is NotFound {
|
|
1547
|
+
return (
|
|
1548
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3
|
|
1549
|
+
);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* The provider is not configured (for example no Fleet credentials).
|
|
1554
|
+
*
|
|
1555
|
+
* Fix: Set `FLEETS_TOKEN`, or `CUA_CLIENT_ID` and `CUA_CLIENT_SECRET`, or
|
|
1556
|
+
* run `cua auth login` and create the client with `fleet_from_session`.
|
|
1557
|
+
*/
|
|
1558
|
+
class ProviderNotConfigured extends UniffiError {
|
|
1559
|
+
/**
|
|
1560
|
+
* @private
|
|
1561
|
+
* This field is private and should not be used.
|
|
1562
|
+
*/
|
|
1563
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1564
|
+
/**
|
|
1565
|
+
* @private
|
|
1566
|
+
* This field is private and should not be used.
|
|
1567
|
+
*/
|
|
1568
|
+
readonly [variantOrdinalSymbol] = 4;
|
|
1569
|
+
|
|
1570
|
+
readonly tag = CuaError_Tags.ProviderNotConfigured;
|
|
1571
|
+
|
|
1572
|
+
constructor(message: string) {
|
|
1573
|
+
super("CuaError", "ProviderNotConfigured", message);
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
static instanceOf(e: any): e is ProviderNotConfigured {
|
|
1577
|
+
return (
|
|
1578
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4
|
|
1579
|
+
);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Not supported by this provider, guest or build.
|
|
1584
|
+
*
|
|
1585
|
+
* Fix: Use a provider, image or runtime that supports the call; the
|
|
1586
|
+
* message names what is missing.
|
|
1587
|
+
*/
|
|
1588
|
+
class Unsupported extends UniffiError {
|
|
1589
|
+
/**
|
|
1590
|
+
* @private
|
|
1591
|
+
* This field is private and should not be used.
|
|
1592
|
+
*/
|
|
1593
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1594
|
+
/**
|
|
1595
|
+
* @private
|
|
1596
|
+
* This field is private and should not be used.
|
|
1597
|
+
*/
|
|
1598
|
+
readonly [variantOrdinalSymbol] = 5;
|
|
1599
|
+
|
|
1600
|
+
readonly tag = CuaError_Tags.Unsupported;
|
|
1601
|
+
|
|
1602
|
+
constructor(message: string) {
|
|
1603
|
+
super("CuaError", "Unsupported", message);
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
static instanceOf(e: any): e is Unsupported {
|
|
1607
|
+
return (
|
|
1608
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 5
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* No cua-spacesd answered in the sandbox or at the URL.
|
|
1614
|
+
*
|
|
1615
|
+
* Fix: Use an image that runs cua-spacesd (the canonical Linux image does),
|
|
1616
|
+
* or reach the sandbox through the services it declares.
|
|
1617
|
+
*/
|
|
1618
|
+
class SpacesdNotAvailable extends UniffiError {
|
|
1619
|
+
/**
|
|
1620
|
+
* @private
|
|
1621
|
+
* This field is private and should not be used.
|
|
1622
|
+
*/
|
|
1623
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1624
|
+
/**
|
|
1625
|
+
* @private
|
|
1626
|
+
* This field is private and should not be used.
|
|
1627
|
+
*/
|
|
1628
|
+
readonly [variantOrdinalSymbol] = 6;
|
|
1629
|
+
|
|
1630
|
+
readonly tag = CuaError_Tags.SpacesdNotAvailable;
|
|
1631
|
+
|
|
1632
|
+
constructor(message: string) {
|
|
1633
|
+
super("CuaError", "SpacesdNotAvailable", message);
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
static instanceOf(e: any): e is SpacesdNotAvailable {
|
|
1637
|
+
return (
|
|
1638
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 6
|
|
1639
|
+
);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* A deadline elapsed.
|
|
1644
|
+
*
|
|
1645
|
+
* Fix: Raise the timeout (for example `ready_timeout_ms`), and check that
|
|
1646
|
+
* the sandbox or service actually starts.
|
|
1647
|
+
*/
|
|
1648
|
+
class Timeout extends UniffiError {
|
|
1649
|
+
/**
|
|
1650
|
+
* @private
|
|
1651
|
+
* This field is private and should not be used.
|
|
1652
|
+
*/
|
|
1653
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1654
|
+
/**
|
|
1655
|
+
* @private
|
|
1656
|
+
* This field is private and should not be used.
|
|
1657
|
+
*/
|
|
1658
|
+
readonly [variantOrdinalSymbol] = 7;
|
|
1659
|
+
|
|
1660
|
+
readonly tag = CuaError_Tags.Timeout;
|
|
1661
|
+
|
|
1662
|
+
constructor(message: string) {
|
|
1663
|
+
super("CuaError", "Timeout", message);
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
static instanceOf(e: any): e is Timeout {
|
|
1667
|
+
return (
|
|
1668
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 7
|
|
1669
|
+
);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Fleet API failure.
|
|
1674
|
+
*
|
|
1675
|
+
* Fix: Read the status in the message. Retry a transient failure; check
|
|
1676
|
+
* the credentials and the account's capacity otherwise.
|
|
1677
|
+
*/
|
|
1678
|
+
class Fleet extends UniffiError {
|
|
1679
|
+
/**
|
|
1680
|
+
* @private
|
|
1681
|
+
* This field is private and should not be used.
|
|
1682
|
+
*/
|
|
1683
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1684
|
+
/**
|
|
1685
|
+
* @private
|
|
1686
|
+
* This field is private and should not be used.
|
|
1687
|
+
*/
|
|
1688
|
+
readonly [variantOrdinalSymbol] = 8;
|
|
1689
|
+
|
|
1690
|
+
readonly tag = CuaError_Tags.Fleet;
|
|
1691
|
+
|
|
1692
|
+
constructor(message: string) {
|
|
1693
|
+
super("CuaError", "Fleet", message);
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
static instanceOf(e: any): e is Fleet {
|
|
1697
|
+
return (
|
|
1698
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 8
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Fleet's admission refused the request: a sandbox or pool size over
|
|
1704
|
+
* this account's limits, or a template its policy does not admit. The
|
|
1705
|
+
* message is Fleet's own and names the limit.
|
|
1706
|
+
*
|
|
1707
|
+
* Fix: Pick a size within the limit the message names (most accounts
|
|
1708
|
+
* run 1-8 vCPUs and 1-32 GiB per sandbox), or contact Cua support to
|
|
1709
|
+
* raise the account's limits.
|
|
1710
|
+
*/
|
|
1711
|
+
class FleetAdmissionDenied extends UniffiError {
|
|
1712
|
+
/**
|
|
1713
|
+
* @private
|
|
1714
|
+
* This field is private and should not be used.
|
|
1715
|
+
*/
|
|
1716
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1717
|
+
/**
|
|
1718
|
+
* @private
|
|
1719
|
+
* This field is private and should not be used.
|
|
1720
|
+
*/
|
|
1721
|
+
readonly [variantOrdinalSymbol] = 9;
|
|
1722
|
+
|
|
1723
|
+
readonly tag = CuaError_Tags.FleetAdmissionDenied;
|
|
1724
|
+
|
|
1725
|
+
constructor(message: string) {
|
|
1726
|
+
super("CuaError", "FleetAdmissionDenied", message);
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
static instanceOf(e: any): e is FleetAdmissionDenied {
|
|
1730
|
+
return (
|
|
1731
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 9
|
|
1732
|
+
);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1736
|
+
* The account is out of Cua Cloud credit: no credit left, and no card
|
|
1737
|
+
* or plan. New cloud sandboxes and Spaces are refused; running ones
|
|
1738
|
+
* keep running, and local ones are never affected. The message ends
|
|
1739
|
+
* with the website billing page's URL.
|
|
1740
|
+
*
|
|
1741
|
+
* Fix: Add credit on that page (a plan, or a card for pay as you go),
|
|
1742
|
+
* or run the sandbox locally.
|
|
1743
|
+
*/
|
|
1744
|
+
class CloudCreditExhausted extends UniffiError {
|
|
1745
|
+
/**
|
|
1746
|
+
* @private
|
|
1747
|
+
* This field is private and should not be used.
|
|
1748
|
+
*/
|
|
1749
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1750
|
+
/**
|
|
1751
|
+
* @private
|
|
1752
|
+
* This field is private and should not be used.
|
|
1753
|
+
*/
|
|
1754
|
+
readonly [variantOrdinalSymbol] = 10;
|
|
1755
|
+
|
|
1756
|
+
readonly tag = CuaError_Tags.CloudCreditExhausted;
|
|
1757
|
+
|
|
1758
|
+
constructor(message: string) {
|
|
1759
|
+
super("CuaError", "CloudCreditExhausted", message);
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
static instanceOf(e: any): e is CloudCreditExhausted {
|
|
1763
|
+
return (
|
|
1764
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 10
|
|
1765
|
+
);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Local runtime failure.
|
|
1770
|
+
*
|
|
1771
|
+
* Fix: Run `cua runtime doctor` (`Local.doctor`) and follow the steps it
|
|
1772
|
+
* prints.
|
|
1773
|
+
*/
|
|
1774
|
+
class Runtime extends UniffiError {
|
|
1775
|
+
/**
|
|
1776
|
+
* @private
|
|
1777
|
+
* This field is private and should not be used.
|
|
1778
|
+
*/
|
|
1779
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1780
|
+
/**
|
|
1781
|
+
* @private
|
|
1782
|
+
* This field is private and should not be used.
|
|
1783
|
+
*/
|
|
1784
|
+
readonly [variantOrdinalSymbol] = 11;
|
|
1785
|
+
|
|
1786
|
+
readonly tag = CuaError_Tags.Runtime;
|
|
1787
|
+
|
|
1788
|
+
constructor(message: string) {
|
|
1789
|
+
super("CuaError", "Runtime", message);
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
static instanceOf(e: any): e is Runtime {
|
|
1793
|
+
return (
|
|
1794
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 11
|
|
1795
|
+
);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* spacesd call failure.
|
|
1800
|
+
*
|
|
1801
|
+
* Fix: Read the status in the message; `SpacesdClient.capabilities` tells
|
|
1802
|
+
* whether this spacesd supports the call.
|
|
1803
|
+
*/
|
|
1804
|
+
class Env extends UniffiError {
|
|
1805
|
+
/**
|
|
1806
|
+
* @private
|
|
1807
|
+
* This field is private and should not be used.
|
|
1808
|
+
*/
|
|
1809
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1810
|
+
/**
|
|
1811
|
+
* @private
|
|
1812
|
+
* This field is private and should not be used.
|
|
1813
|
+
*/
|
|
1814
|
+
readonly [variantOrdinalSymbol] = 12;
|
|
1815
|
+
|
|
1816
|
+
readonly tag = CuaError_Tags.Env;
|
|
1817
|
+
|
|
1818
|
+
constructor(message: string) {
|
|
1819
|
+
super("CuaError", "Env", message);
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
static instanceOf(e: any): e is Env {
|
|
1823
|
+
return (
|
|
1824
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 12
|
|
1825
|
+
);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* HTTP failure talking to a sandbox service.
|
|
1830
|
+
*
|
|
1831
|
+
* Fix: Check that the service listens on its declared port and answers
|
|
1832
|
+
* HTTP.
|
|
1833
|
+
*/
|
|
1834
|
+
class Http extends UniffiError {
|
|
1835
|
+
/**
|
|
1836
|
+
* @private
|
|
1837
|
+
* This field is private and should not be used.
|
|
1838
|
+
*/
|
|
1839
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1840
|
+
/**
|
|
1841
|
+
* @private
|
|
1842
|
+
* This field is private and should not be used.
|
|
1843
|
+
*/
|
|
1844
|
+
readonly [variantOrdinalSymbol] = 13;
|
|
1845
|
+
|
|
1846
|
+
readonly tag = CuaError_Tags.Http;
|
|
1847
|
+
|
|
1848
|
+
constructor(message: string) {
|
|
1849
|
+
super("CuaError", "Http", message);
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
static instanceOf(e: any): e is Http {
|
|
1853
|
+
return (
|
|
1854
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 13
|
|
1855
|
+
);
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Missing or wrong token or ticket.
|
|
1860
|
+
*
|
|
1861
|
+
* Fix: Pass the sandbox's env token, refresh the Fleet credentials, or run
|
|
1862
|
+
* `cua auth login` again.
|
|
1863
|
+
*/
|
|
1864
|
+
class Unauthenticated extends UniffiError {
|
|
1865
|
+
/**
|
|
1866
|
+
* @private
|
|
1867
|
+
* This field is private and should not be used.
|
|
1868
|
+
*/
|
|
1869
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1870
|
+
/**
|
|
1871
|
+
* @private
|
|
1872
|
+
* This field is private and should not be used.
|
|
1873
|
+
*/
|
|
1874
|
+
readonly [variantOrdinalSymbol] = 14;
|
|
1875
|
+
|
|
1876
|
+
readonly tag = CuaError_Tags.Unauthenticated;
|
|
1877
|
+
|
|
1878
|
+
constructor(message: string) {
|
|
1879
|
+
super("CuaError", "Unauthenticated", message);
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
static instanceOf(e: any): e is Unauthenticated {
|
|
1883
|
+
return (
|
|
1884
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 14
|
|
1885
|
+
);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* The guest OS denied permission.
|
|
1890
|
+
*
|
|
1891
|
+
* Fix: Run the call as a guest user allowed to do it, or change the
|
|
1892
|
+
* permissions of the path.
|
|
1893
|
+
*/
|
|
1894
|
+
class PermissionDenied extends UniffiError {
|
|
1895
|
+
/**
|
|
1896
|
+
* @private
|
|
1897
|
+
* This field is private and should not be used.
|
|
1898
|
+
*/
|
|
1899
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1900
|
+
/**
|
|
1901
|
+
* @private
|
|
1902
|
+
* This field is private and should not be used.
|
|
1903
|
+
*/
|
|
1904
|
+
readonly [variantOrdinalSymbol] = 15;
|
|
1905
|
+
|
|
1906
|
+
readonly tag = CuaError_Tags.PermissionDenied;
|
|
1907
|
+
|
|
1908
|
+
constructor(message: string) {
|
|
1909
|
+
super("CuaError", "PermissionDenied", message);
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
static instanceOf(e: any): e is PermissionDenied {
|
|
1913
|
+
return (
|
|
1914
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 15
|
|
1915
|
+
);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Could not reach the daemon or the endpoint.
|
|
1920
|
+
*
|
|
1921
|
+
* Fix: Check the address. For a daemon client, start the daemon with `cua
|
|
1922
|
+
* daemon start`.
|
|
1923
|
+
*/
|
|
1924
|
+
class Transport extends UniffiError {
|
|
1925
|
+
/**
|
|
1926
|
+
* @private
|
|
1927
|
+
* This field is private and should not be used.
|
|
1928
|
+
*/
|
|
1929
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1930
|
+
/**
|
|
1931
|
+
* @private
|
|
1932
|
+
* This field is private and should not be used.
|
|
1933
|
+
*/
|
|
1934
|
+
readonly [variantOrdinalSymbol] = 16;
|
|
1935
|
+
|
|
1936
|
+
readonly tag = CuaError_Tags.Transport;
|
|
1937
|
+
|
|
1938
|
+
constructor(message: string) {
|
|
1939
|
+
super("CuaError", "Transport", message);
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
static instanceOf(e: any): e is Transport {
|
|
1943
|
+
return (
|
|
1944
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 16
|
|
1945
|
+
);
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* No `cua daemon` is running: nothing listens at its socket or
|
|
1950
|
+
* port, or its discovery file (`~/.cua/daemon.json`) was left by a
|
|
1951
|
+
* daemon that exited. The message says so in plain words.
|
|
1952
|
+
*
|
|
1953
|
+
* Fix: Start Cua (the Spaces app starts the daemon), or run `cua daemon
|
|
1954
|
+
* start`. `Cua.auto` uses the runtime in this process when no daemon
|
|
1955
|
+
* runs.
|
|
1956
|
+
*/
|
|
1957
|
+
class DaemonNotRunning extends UniffiError {
|
|
1958
|
+
/**
|
|
1959
|
+
* @private
|
|
1960
|
+
* This field is private and should not be used.
|
|
1961
|
+
*/
|
|
1962
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1963
|
+
/**
|
|
1964
|
+
* @private
|
|
1965
|
+
* This field is private and should not be used.
|
|
1966
|
+
*/
|
|
1967
|
+
readonly [variantOrdinalSymbol] = 17;
|
|
1968
|
+
|
|
1969
|
+
readonly tag = CuaError_Tags.DaemonNotRunning;
|
|
1970
|
+
|
|
1971
|
+
constructor(message: string) {
|
|
1972
|
+
super("CuaError", "DaemonNotRunning", message);
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
static instanceOf(e: any): e is DaemonNotRunning {
|
|
1976
|
+
return (
|
|
1977
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 17
|
|
1978
|
+
);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
/**
|
|
1982
|
+
* The object was closed.
|
|
1983
|
+
*
|
|
1984
|
+
* Fix: Open a new handle or session; a closed one stays closed.
|
|
1985
|
+
*/
|
|
1986
|
+
class Closed extends UniffiError {
|
|
1987
|
+
/**
|
|
1988
|
+
* @private
|
|
1989
|
+
* This field is private and should not be used.
|
|
1990
|
+
*/
|
|
1991
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
1992
|
+
/**
|
|
1993
|
+
* @private
|
|
1994
|
+
* This field is private and should not be used.
|
|
1995
|
+
*/
|
|
1996
|
+
readonly [variantOrdinalSymbol] = 18;
|
|
1997
|
+
|
|
1998
|
+
readonly tag = CuaError_Tags.Closed;
|
|
1999
|
+
|
|
2000
|
+
constructor(message: string) {
|
|
2001
|
+
super("CuaError", "Closed", message);
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
static instanceOf(e: any): e is Closed {
|
|
2005
|
+
return (
|
|
2006
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 18
|
|
2007
|
+
);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
2011
|
+
* The Space's spacesd reports a feature this call needs as
|
|
2012
|
+
* unsupported (the message names it).
|
|
2013
|
+
*
|
|
2014
|
+
* Fix: Use a Space whose spacesd supports the feature (`Space.supports`),
|
|
2015
|
+
* or update cua-spacesd on it.
|
|
2016
|
+
*/
|
|
2017
|
+
class CapabilityMissing extends UniffiError {
|
|
2018
|
+
/**
|
|
2019
|
+
* @private
|
|
2020
|
+
* This field is private and should not be used.
|
|
2021
|
+
*/
|
|
2022
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2023
|
+
/**
|
|
2024
|
+
* @private
|
|
2025
|
+
* This field is private and should not be used.
|
|
2026
|
+
*/
|
|
2027
|
+
readonly [variantOrdinalSymbol] = 19;
|
|
2028
|
+
|
|
2029
|
+
readonly tag = CuaError_Tags.CapabilityMissing;
|
|
2030
|
+
|
|
2031
|
+
constructor(message: string) {
|
|
2032
|
+
super("CuaError", "CapabilityMissing", message);
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
static instanceOf(e: any): e is CapabilityMissing {
|
|
2036
|
+
return (
|
|
2037
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 19
|
|
2038
|
+
);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* A host-side prerequisite (app-session providers, an operator
|
|
2043
|
+
* display, a local runtime) is not available.
|
|
2044
|
+
*
|
|
2045
|
+
* Fix: Install or start the prerequisite the message names on this
|
|
2046
|
+
* machine.
|
|
2047
|
+
*/
|
|
2048
|
+
class HostCapabilityMissing extends UniffiError {
|
|
2049
|
+
/**
|
|
2050
|
+
* @private
|
|
2051
|
+
* This field is private and should not be used.
|
|
2052
|
+
*/
|
|
2053
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2054
|
+
/**
|
|
2055
|
+
* @private
|
|
2056
|
+
* This field is private and should not be used.
|
|
2057
|
+
*/
|
|
2058
|
+
readonly [variantOrdinalSymbol] = 20;
|
|
2059
|
+
|
|
2060
|
+
readonly tag = CuaError_Tags.HostCapabilityMissing;
|
|
2061
|
+
|
|
2062
|
+
constructor(message: string) {
|
|
2063
|
+
super("CuaError", "HostCapabilityMissing", message);
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
static instanceOf(e: any): e is HostCapabilityMissing {
|
|
2067
|
+
return (
|
|
2068
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 20
|
|
2069
|
+
);
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* The teleport consent gate refused (or the approver declined).
|
|
2074
|
+
*
|
|
2075
|
+
* Fix: Approve the manifest in the consent callback, or teleport a smaller
|
|
2076
|
+
* scope.
|
|
2077
|
+
*/
|
|
2078
|
+
class TeleportRefused extends UniffiError {
|
|
2079
|
+
/**
|
|
2080
|
+
* @private
|
|
2081
|
+
* This field is private and should not be used.
|
|
2082
|
+
*/
|
|
2083
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2084
|
+
/**
|
|
2085
|
+
* @private
|
|
2086
|
+
* This field is private and should not be used.
|
|
2087
|
+
*/
|
|
2088
|
+
readonly [variantOrdinalSymbol] = 21;
|
|
2089
|
+
|
|
2090
|
+
readonly tag = CuaError_Tags.TeleportRefused;
|
|
2091
|
+
|
|
2092
|
+
constructor(message: string) {
|
|
2093
|
+
super("CuaError", "TeleportRefused", message);
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
static instanceOf(e: any): e is TeleportRefused {
|
|
2097
|
+
return (
|
|
2098
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 21
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
/**
|
|
2103
|
+
* A named cloud pool's template differs from the requested sandbox
|
|
2104
|
+
* fields; the message holds the diff (pass `apply` to update it).
|
|
2105
|
+
*
|
|
2106
|
+
* Fix: Pass the pool's own fields, or pass `apply` to update its template.
|
|
2107
|
+
*/
|
|
2108
|
+
class PoolSpecMismatch extends UniffiError {
|
|
2109
|
+
/**
|
|
2110
|
+
* @private
|
|
2111
|
+
* This field is private and should not be used.
|
|
2112
|
+
*/
|
|
2113
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2114
|
+
/**
|
|
2115
|
+
* @private
|
|
2116
|
+
* This field is private and should not be used.
|
|
2117
|
+
*/
|
|
2118
|
+
readonly [variantOrdinalSymbol] = 22;
|
|
2119
|
+
|
|
2120
|
+
readonly tag = CuaError_Tags.PoolSpecMismatch;
|
|
2121
|
+
|
|
2122
|
+
constructor(message: string) {
|
|
2123
|
+
super("CuaError", "PoolSpecMismatch", message);
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
static instanceOf(e: any): e is PoolSpecMismatch {
|
|
2127
|
+
return (
|
|
2128
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 22
|
|
2129
|
+
);
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
/**
|
|
2133
|
+
* A claim bound but its per-claim secrets (the env token) never
|
|
2134
|
+
* reached the sandbox within the bounded wait; the claim was released.
|
|
2135
|
+
*
|
|
2136
|
+
* Fix: Retry. If it keeps failing, check the pool's claim-secrets setup
|
|
2137
|
+
* and the Fleet status.
|
|
2138
|
+
*/
|
|
2139
|
+
class ClaimSecretsNotDelivered extends UniffiError {
|
|
2140
|
+
/**
|
|
2141
|
+
* @private
|
|
2142
|
+
* This field is private and should not be used.
|
|
2143
|
+
*/
|
|
2144
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2145
|
+
/**
|
|
2146
|
+
* @private
|
|
2147
|
+
* This field is private and should not be used.
|
|
2148
|
+
*/
|
|
2149
|
+
readonly [variantOrdinalSymbol] = 23;
|
|
2150
|
+
|
|
2151
|
+
readonly tag = CuaError_Tags.ClaimSecretsNotDelivered;
|
|
2152
|
+
|
|
2153
|
+
constructor(message: string) {
|
|
2154
|
+
super("CuaError", "ClaimSecretsNotDelivered", message);
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
static instanceOf(e: any): e is ClaimSecretsNotDelivered {
|
|
2158
|
+
return (
|
|
2159
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 23
|
|
2160
|
+
);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* Bug or I/O failure.
|
|
2165
|
+
*
|
|
2166
|
+
* Fix: Report it with the message at https://github.com/trycua/cua/issues.
|
|
2167
|
+
*/
|
|
2168
|
+
class Internal extends UniffiError {
|
|
2169
|
+
/**
|
|
2170
|
+
* @private
|
|
2171
|
+
* This field is private and should not be used.
|
|
2172
|
+
*/
|
|
2173
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2174
|
+
/**
|
|
2175
|
+
* @private
|
|
2176
|
+
* This field is private and should not be used.
|
|
2177
|
+
*/
|
|
2178
|
+
readonly [variantOrdinalSymbol] = 24;
|
|
2179
|
+
|
|
2180
|
+
readonly tag = CuaError_Tags.Internal;
|
|
2181
|
+
|
|
2182
|
+
constructor(message: string) {
|
|
2183
|
+
super("CuaError", "Internal", message);
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
static instanceOf(e: any): e is Internal {
|
|
2187
|
+
return (
|
|
2188
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 24
|
|
2189
|
+
);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* A bare sandbox name matches sandboxes in more than one location. The
|
|
2194
|
+
* message ends with the qualified candidates (`use one of: local:box,
|
|
2195
|
+
* cloud:box`); `ambiguous_sandbox_candidates` extracts them.
|
|
2196
|
+
*
|
|
2197
|
+
* Fix: Use one of the qualified refs the message lists (`local:<name>`,
|
|
2198
|
+
* `cloud:<name>`).
|
|
2199
|
+
*/
|
|
2200
|
+
class AmbiguousSandbox extends UniffiError {
|
|
2201
|
+
/**
|
|
2202
|
+
* @private
|
|
2203
|
+
* This field is private and should not be used.
|
|
2204
|
+
*/
|
|
2205
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2206
|
+
/**
|
|
2207
|
+
* @private
|
|
2208
|
+
* This field is private and should not be used.
|
|
2209
|
+
*/
|
|
2210
|
+
readonly [variantOrdinalSymbol] = 25;
|
|
2211
|
+
|
|
2212
|
+
readonly tag = CuaError_Tags.AmbiguousSandbox;
|
|
2213
|
+
|
|
2214
|
+
constructor(message: string) {
|
|
2215
|
+
super("CuaError", "AmbiguousSandbox", message);
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
static instanceOf(e: any): e is AmbiguousSandbox {
|
|
2219
|
+
return (
|
|
2220
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 25
|
|
2221
|
+
);
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
/**
|
|
2225
|
+
* A pull, build or VM create would leave less than the configured
|
|
2226
|
+
* minimum free disk space (`CUA_DISK_MIN_FREE`, default 5 GiB);
|
|
2227
|
+
* nothing was written.
|
|
2228
|
+
*
|
|
2229
|
+
* Fix: Free space with `cua cache prune`, or lower `CUA_DISK_MIN_FREE`.
|
|
2230
|
+
*/
|
|
2231
|
+
class InsufficientDisk extends UniffiError {
|
|
2232
|
+
/**
|
|
2233
|
+
* @private
|
|
2234
|
+
* This field is private and should not be used.
|
|
2235
|
+
*/
|
|
2236
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2237
|
+
/**
|
|
2238
|
+
* @private
|
|
2239
|
+
* This field is private and should not be used.
|
|
2240
|
+
*/
|
|
2241
|
+
readonly [variantOrdinalSymbol] = 26;
|
|
2242
|
+
|
|
2243
|
+
readonly tag = CuaError_Tags.InsufficientDisk;
|
|
2244
|
+
|
|
2245
|
+
constructor(message: string) {
|
|
2246
|
+
super("CuaError", "InsufficientDisk", message);
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
static instanceOf(e: any): e is InsufficientDisk {
|
|
2250
|
+
return (
|
|
2251
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 26
|
|
2252
|
+
);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* A catalog image (an `Image.*` constructor, a tier or `cua sb create
|
|
2257
|
+
* <word>`) that CI has not published yet. The message names the
|
|
2258
|
+
* reference.
|
|
2259
|
+
*
|
|
2260
|
+
* Fix: Pass the reference explicitly (`Image.from_registry("<ref>")`,
|
|
2261
|
+
* `cua sb create <ref>`) to use it anyway, or pick a published image
|
|
2262
|
+
* (`cua images ls`).
|
|
2263
|
+
*/
|
|
2264
|
+
class ImageNotPublished extends UniffiError {
|
|
2265
|
+
/**
|
|
2266
|
+
* @private
|
|
2267
|
+
* This field is private and should not be used.
|
|
2268
|
+
*/
|
|
2269
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2270
|
+
/**
|
|
2271
|
+
* @private
|
|
2272
|
+
* This field is private and should not be used.
|
|
2273
|
+
*/
|
|
2274
|
+
readonly [variantOrdinalSymbol] = 27;
|
|
2275
|
+
|
|
2276
|
+
readonly tag = CuaError_Tags.ImageNotPublished;
|
|
2277
|
+
|
|
2278
|
+
constructor(message: string) {
|
|
2279
|
+
super("CuaError", "ImageNotPublished", message);
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
static instanceOf(e: any): e is ImageNotPublished {
|
|
2283
|
+
return (
|
|
2284
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 27
|
|
2285
|
+
);
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
/**
|
|
2289
|
+
* The create was cancelled (`Spaces.cancel_create`, Ctrl-C in `cua`,
|
|
2290
|
+
* or its caller went away). What it made is gone; the message says
|
|
2291
|
+
* what was removed and what stays (finished image downloads stay
|
|
2292
|
+
* cached, so the next create resumes).
|
|
2293
|
+
*
|
|
2294
|
+
* Fix: Nothing to clean up. Create it again when you want it.
|
|
2295
|
+
*/
|
|
2296
|
+
class Cancelled extends UniffiError {
|
|
2297
|
+
/**
|
|
2298
|
+
* @private
|
|
2299
|
+
* This field is private and should not be used.
|
|
2300
|
+
*/
|
|
2301
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2302
|
+
/**
|
|
2303
|
+
* @private
|
|
2304
|
+
* This field is private and should not be used.
|
|
2305
|
+
*/
|
|
2306
|
+
readonly [variantOrdinalSymbol] = 28;
|
|
2307
|
+
|
|
2308
|
+
readonly tag = CuaError_Tags.Cancelled;
|
|
2309
|
+
|
|
2310
|
+
constructor(message: string) {
|
|
2311
|
+
super("CuaError", "Cancelled", message);
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
static instanceOf(e: any): e is Cancelled {
|
|
2315
|
+
return (
|
|
2316
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 28
|
|
2317
|
+
);
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Your own cloud account (AWS, Google Cloud, Modal) refused or failed
|
|
2322
|
+
* a call Cua made for a Space there: a missing permission, a quota, a
|
|
2323
|
+
* region without the machine type. The message names the cloud's own
|
|
2324
|
+
* error.
|
|
2325
|
+
*
|
|
2326
|
+
* Fix: Fix what the message names in that account (`cua cloud test
|
|
2327
|
+
* <provider>` checks it without creating anything), or connect another
|
|
2328
|
+
* region or project.
|
|
2329
|
+
*/
|
|
2330
|
+
class Cloud extends UniffiError {
|
|
2331
|
+
/**
|
|
2332
|
+
* @private
|
|
2333
|
+
* This field is private and should not be used.
|
|
2334
|
+
*/
|
|
2335
|
+
readonly [uniffiTypeNameSymbol]: string = "CuaError";
|
|
2336
|
+
/**
|
|
2337
|
+
* @private
|
|
2338
|
+
* This field is private and should not be used.
|
|
2339
|
+
*/
|
|
2340
|
+
readonly [variantOrdinalSymbol] = 29;
|
|
2341
|
+
|
|
2342
|
+
readonly tag = CuaError_Tags.Cloud;
|
|
2343
|
+
|
|
2344
|
+
constructor(message: string) {
|
|
2345
|
+
super("CuaError", "Cloud", message);
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
static instanceOf(e: any): e is Cloud {
|
|
2349
|
+
return (
|
|
2350
|
+
instanceOf(e) && (e as any)[variantOrdinalSymbol] === 29
|
|
2351
|
+
);
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
// Utility function which does not rely on instanceof.
|
|
2356
|
+
function instanceOf(e: any): e is CuaError {
|
|
2357
|
+
return (e as any)[uniffiTypeNameSymbol] === "CuaError";
|
|
2358
|
+
}
|
|
2359
|
+
return {
|
|
2360
|
+
InvalidArgument,
|
|
2361
|
+
InvalidPlacement,
|
|
2362
|
+
NotFound,
|
|
2363
|
+
ProviderNotConfigured,
|
|
2364
|
+
Unsupported,
|
|
2365
|
+
SpacesdNotAvailable,
|
|
2366
|
+
Timeout,
|
|
2367
|
+
Fleet,
|
|
2368
|
+
FleetAdmissionDenied,
|
|
2369
|
+
CloudCreditExhausted,
|
|
2370
|
+
Runtime,
|
|
2371
|
+
Env,
|
|
2372
|
+
Http,
|
|
2373
|
+
Unauthenticated,
|
|
2374
|
+
PermissionDenied,
|
|
2375
|
+
Transport,
|
|
2376
|
+
DaemonNotRunning,
|
|
2377
|
+
Closed,
|
|
2378
|
+
CapabilityMissing,
|
|
2379
|
+
HostCapabilityMissing,
|
|
2380
|
+
TeleportRefused,
|
|
2381
|
+
PoolSpecMismatch,
|
|
2382
|
+
ClaimSecretsNotDelivered,
|
|
2383
|
+
Internal,
|
|
2384
|
+
AmbiguousSandbox,
|
|
2385
|
+
InsufficientDisk,
|
|
2386
|
+
ImageNotPublished,
|
|
2387
|
+
Cancelled,
|
|
2388
|
+
Cloud,
|
|
2389
|
+
instanceOf,
|
|
2390
|
+
};
|
|
2391
|
+
})();
|
|
2392
|
+
|
|
2393
|
+
// Union type for CuaError error type.
|
|
2394
|
+
/**
|
|
2395
|
+
* Every error the SDK raises. Flat across the FFI: each language sees one
|
|
2396
|
+
* exception/error type with a case per variant and the message.
|
|
2397
|
+
*/
|
|
2398
|
+
export type CuaError = InstanceType<
|
|
2399
|
+
typeof CuaError['InvalidArgument' | 'InvalidPlacement' | 'NotFound' | 'ProviderNotConfigured' | 'Unsupported' | 'SpacesdNotAvailable' | 'Timeout' | 'Fleet' | 'FleetAdmissionDenied' | 'CloudCreditExhausted' | 'Runtime' | 'Env' | 'Http' | 'Unauthenticated' | 'PermissionDenied' | 'Transport' | 'DaemonNotRunning' | 'Closed' | 'CapabilityMissing' | 'HostCapabilityMissing' | 'TeleportRefused' | 'PoolSpecMismatch' | 'ClaimSecretsNotDelivered' | 'Internal' | 'AmbiguousSandbox' | 'InsufficientDisk' | 'ImageNotPublished' | 'Cancelled' | 'Cloud']
|
|
2400
|
+
>;
|
|
2401
|
+
|
|
2402
|
+
const FfiConverterTypeCuaError = (() => {
|
|
2403
|
+
const intConverter = FfiConverterInt32;
|
|
2404
|
+
type TypeName = CuaError;
|
|
2405
|
+
class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2406
|
+
read(from: RustBuffer): TypeName {
|
|
2407
|
+
switch (intConverter.read(from)) {
|
|
2408
|
+
case 1: return new CuaError.InvalidArgument(
|
|
2409
|
+
FfiConverterString.read(from)
|
|
2410
|
+
);
|
|
2411
|
+
|
|
2412
|
+
case 2: return new CuaError.InvalidPlacement(
|
|
2413
|
+
FfiConverterString.read(from)
|
|
2414
|
+
);
|
|
2415
|
+
|
|
2416
|
+
case 3: return new CuaError.NotFound(
|
|
2417
|
+
FfiConverterString.read(from)
|
|
2418
|
+
);
|
|
2419
|
+
|
|
2420
|
+
case 4: return new CuaError.ProviderNotConfigured(
|
|
2421
|
+
FfiConverterString.read(from)
|
|
2422
|
+
);
|
|
2423
|
+
|
|
2424
|
+
case 5: return new CuaError.Unsupported(
|
|
2425
|
+
FfiConverterString.read(from)
|
|
2426
|
+
);
|
|
2427
|
+
|
|
2428
|
+
case 6: return new CuaError.SpacesdNotAvailable(
|
|
2429
|
+
FfiConverterString.read(from)
|
|
2430
|
+
);
|
|
2431
|
+
|
|
2432
|
+
case 7: return new CuaError.Timeout(
|
|
2433
|
+
FfiConverterString.read(from)
|
|
2434
|
+
);
|
|
2435
|
+
|
|
2436
|
+
case 8: return new CuaError.Fleet(
|
|
2437
|
+
FfiConverterString.read(from)
|
|
2438
|
+
);
|
|
2439
|
+
|
|
2440
|
+
case 9: return new CuaError.FleetAdmissionDenied(
|
|
2441
|
+
FfiConverterString.read(from)
|
|
2442
|
+
);
|
|
2443
|
+
|
|
2444
|
+
case 10: return new CuaError.CloudCreditExhausted(
|
|
2445
|
+
FfiConverterString.read(from)
|
|
2446
|
+
);
|
|
2447
|
+
|
|
2448
|
+
case 11: return new CuaError.Runtime(
|
|
2449
|
+
FfiConverterString.read(from)
|
|
2450
|
+
);
|
|
2451
|
+
|
|
2452
|
+
case 12: return new CuaError.Env(
|
|
2453
|
+
FfiConverterString.read(from)
|
|
2454
|
+
);
|
|
2455
|
+
|
|
2456
|
+
case 13: return new CuaError.Http(
|
|
2457
|
+
FfiConverterString.read(from)
|
|
2458
|
+
);
|
|
2459
|
+
|
|
2460
|
+
case 14: return new CuaError.Unauthenticated(
|
|
2461
|
+
FfiConverterString.read(from)
|
|
2462
|
+
);
|
|
2463
|
+
|
|
2464
|
+
case 15: return new CuaError.PermissionDenied(
|
|
2465
|
+
FfiConverterString.read(from)
|
|
2466
|
+
);
|
|
2467
|
+
|
|
2468
|
+
case 16: return new CuaError.Transport(
|
|
2469
|
+
FfiConverterString.read(from)
|
|
2470
|
+
);
|
|
2471
|
+
|
|
2472
|
+
case 17: return new CuaError.DaemonNotRunning(
|
|
2473
|
+
FfiConverterString.read(from)
|
|
2474
|
+
);
|
|
2475
|
+
|
|
2476
|
+
case 18: return new CuaError.Closed(
|
|
2477
|
+
FfiConverterString.read(from)
|
|
2478
|
+
);
|
|
2479
|
+
|
|
2480
|
+
case 19: return new CuaError.CapabilityMissing(
|
|
2481
|
+
FfiConverterString.read(from)
|
|
2482
|
+
);
|
|
2483
|
+
|
|
2484
|
+
case 20: return new CuaError.HostCapabilityMissing(
|
|
2485
|
+
FfiConverterString.read(from)
|
|
2486
|
+
);
|
|
2487
|
+
|
|
2488
|
+
case 21: return new CuaError.TeleportRefused(
|
|
2489
|
+
FfiConverterString.read(from)
|
|
2490
|
+
);
|
|
2491
|
+
|
|
2492
|
+
case 22: return new CuaError.PoolSpecMismatch(
|
|
2493
|
+
FfiConverterString.read(from)
|
|
2494
|
+
);
|
|
2495
|
+
|
|
2496
|
+
case 23: return new CuaError.ClaimSecretsNotDelivered(
|
|
2497
|
+
FfiConverterString.read(from)
|
|
2498
|
+
);
|
|
2499
|
+
|
|
2500
|
+
case 24: return new CuaError.Internal(
|
|
2501
|
+
FfiConverterString.read(from)
|
|
2502
|
+
);
|
|
2503
|
+
|
|
2504
|
+
case 25: return new CuaError.AmbiguousSandbox(
|
|
2505
|
+
FfiConverterString.read(from)
|
|
2506
|
+
);
|
|
2507
|
+
|
|
2508
|
+
case 26: return new CuaError.InsufficientDisk(
|
|
2509
|
+
FfiConverterString.read(from)
|
|
2510
|
+
);
|
|
2511
|
+
|
|
2512
|
+
case 27: return new CuaError.ImageNotPublished(
|
|
2513
|
+
FfiConverterString.read(from)
|
|
2514
|
+
);
|
|
2515
|
+
|
|
2516
|
+
case 28: return new CuaError.Cancelled(
|
|
2517
|
+
FfiConverterString.read(from)
|
|
2518
|
+
);
|
|
2519
|
+
|
|
2520
|
+
case 29: return new CuaError.Cloud(
|
|
2521
|
+
FfiConverterString.read(from)
|
|
2522
|
+
);
|
|
2523
|
+
|
|
2524
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
2528
|
+
const obj = value as any;
|
|
2529
|
+
const index = obj[variantOrdinalSymbol] as number;
|
|
2530
|
+
intConverter.write(index, into);
|
|
2531
|
+
}
|
|
2532
|
+
allocationSize(value: TypeName): number {
|
|
2533
|
+
return intConverter.allocationSize(0);
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
return new FfiConverter();
|
|
2537
|
+
})();
|
|
2538
|
+
|
|
2539
|
+
/**
|
|
2540
|
+
* Fleet control plane (browser transport).
|
|
2541
|
+
*/
|
|
2542
|
+
export interface FleetLike {
|
|
2543
|
+
|
|
2544
|
+
/**
|
|
2545
|
+
* Claims a sandbox from `pool` and waits for it to bind.
|
|
2546
|
+
*/
|
|
2547
|
+
acquire(pool: string, name: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<FleetSandbox>;
|
|
2548
|
+
/**
|
|
2549
|
+
* Claims in a namespace (JSON resources).
|
|
2550
|
+
*/
|
|
2551
|
+
listClaims(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<string>>;
|
|
2552
|
+
/**
|
|
2553
|
+
* Pools in a namespace (JSON resources).
|
|
2554
|
+
*/
|
|
2555
|
+
listPools(namespace: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<string>>;
|
|
2556
|
+
/**
|
|
2557
|
+
* Releases a claim.
|
|
2558
|
+
*/
|
|
2559
|
+
release(sandbox: FleetSandbox, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
|
|
2560
|
+
}
|
|
2561
|
+
/**
|
|
2562
|
+
* @deprecated Use `FleetLike` instead.
|
|
2563
|
+
*/
|
|
2564
|
+
export type FleetInterface = FleetLike;
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
/**
|
|
2568
|
+
* Fleet control plane (browser transport).
|
|
2569
|
+
*/
|
|
2570
|
+
export class Fleet extends UniffiAbstractObject implements FleetLike {
|
|
2571
|
+
|
|
2572
|
+
readonly [uniffiTypeNameSymbol] = "Fleet";
|
|
2573
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
2574
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
2575
|
+
// No primary constructor declared for this class.
|
|
2576
|
+
private constructor(pointer: UniffiHandle) {
|
|
2577
|
+
super();
|
|
2578
|
+
this[pointerLiteralSymbol] = pointer;
|
|
2579
|
+
this[destructorGuardSymbol] = uniffiTypeFleetObjectFactory.bless(pointer);
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
/**
|
|
2586
|
+
* Claims a sandbox from `pool` and waits for it to bind.
|
|
2587
|
+
*/
|
|
2588
|
+
async acquire(pool: string, name: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<FleetSandbox> /*throws*/ {
|
|
2589
|
+
return await uniffiRustCallAsync(
|
|
2590
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2591
|
+
/*rustFutureFunc:*/ () => {
|
|
2592
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_fleet_acquire(
|
|
2593
|
+
uniffiTypeFleetObjectFactory.clonePointer(this),FfiConverterString.lower(pool, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(name, nativeModule().rustbuffer_alloc)
|
|
2594
|
+
);
|
|
2595
|
+
},
|
|
2596
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
2597
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
2598
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
2599
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
2600
|
+
// Async returns always go through the JS-side converter: the
|
|
2601
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
2602
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
2603
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
2604
|
+
// here using the per-callable return-type converter.
|
|
2605
|
+
/*liftFunc:*/ FfiConverterTypeFleetSandbox.lift.bind(FfiConverterTypeFleetSandbox),
|
|
2606
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2607
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2608
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2609
|
+
);
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
/**
|
|
2613
|
+
* Claims in a namespace (JSON resources).
|
|
2614
|
+
*/
|
|
2615
|
+
async listClaims(namespace: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array<string>> /*throws*/ {
|
|
2616
|
+
return await uniffiRustCallAsync(
|
|
2617
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2618
|
+
/*rustFutureFunc:*/ () => {
|
|
2619
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_fleet_list_claims(
|
|
2620
|
+
uniffiTypeFleetObjectFactory.clonePointer(this),FfiConverterString.lower(namespace, nativeModule().rustbuffer_alloc)
|
|
2621
|
+
);
|
|
2622
|
+
},
|
|
2623
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
2624
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
2625
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
2626
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
2627
|
+
// Async returns always go through the JS-side converter: the
|
|
2628
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
2629
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
2630
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
2631
|
+
// here using the per-callable return-type converter.
|
|
2632
|
+
/*liftFunc:*/ FfiConverterSequenceString.lift.bind(FfiConverterSequenceString),
|
|
2633
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2634
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2635
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2636
|
+
);
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
/**
|
|
2640
|
+
* Pools in a namespace (JSON resources).
|
|
2641
|
+
*/
|
|
2642
|
+
async listPools(namespace: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array<string>> /*throws*/ {
|
|
2643
|
+
return await uniffiRustCallAsync(
|
|
2644
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2645
|
+
/*rustFutureFunc:*/ () => {
|
|
2646
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_fleet_list_pools(
|
|
2647
|
+
uniffiTypeFleetObjectFactory.clonePointer(this),FfiConverterString.lower(namespace, nativeModule().rustbuffer_alloc)
|
|
2648
|
+
);
|
|
2649
|
+
},
|
|
2650
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
2651
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
2652
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
2653
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
2654
|
+
// Async returns always go through the JS-side converter: the
|
|
2655
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
2656
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
2657
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
2658
|
+
// here using the per-callable return-type converter.
|
|
2659
|
+
/*liftFunc:*/ FfiConverterSequenceString.lift.bind(FfiConverterSequenceString),
|
|
2660
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2661
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2662
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2663
|
+
);
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
/**
|
|
2667
|
+
* Releases a claim.
|
|
2668
|
+
*/
|
|
2669
|
+
async release(sandbox: FleetSandbox, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
|
|
2670
|
+
return await uniffiRustCallAsync(
|
|
2671
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2672
|
+
/*rustFutureFunc:*/ () => {
|
|
2673
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_fleet_release(
|
|
2674
|
+
uniffiTypeFleetObjectFactory.clonePointer(this),FfiConverterTypeFleetSandbox.lower(sandbox, nativeModule().rustbuffer_alloc)
|
|
2675
|
+
);
|
|
2676
|
+
},
|
|
2677
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_void,
|
|
2678
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_void,
|
|
2679
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_void,
|
|
2680
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_void,
|
|
2681
|
+
/*liftFunc:*/ (_v) => {},
|
|
2682
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2683
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2684
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2685
|
+
);
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
|
|
2689
|
+
uniffiDestroy(): void {
|
|
2690
|
+
const ptr = (this as any)[destructorGuardSymbol];
|
|
2691
|
+
if (ptr !== undefined) {
|
|
2692
|
+
const pointer = uniffiTypeFleetObjectFactory.pointer(this);
|
|
2693
|
+
uniffiTypeFleetObjectFactory.freePointer(pointer);
|
|
2694
|
+
uniffiTypeFleetObjectFactory.unbless(ptr);
|
|
2695
|
+
delete (this as any)[destructorGuardSymbol];
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
static instanceOf(obj_: any): obj_ is Fleet {
|
|
2700
|
+
return uniffiTypeFleetObjectFactory.isConcreteType(obj_);
|
|
2701
|
+
}
|
|
2702
|
+
|
|
2703
|
+
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
const uniffiTypeFleetObjectFactory: UniffiObjectFactory<FleetLike> = (() => {
|
|
2707
|
+
|
|
2708
|
+
/// <reference lib="es2021" />
|
|
2709
|
+
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
|
|
2710
|
+
uniffiTypeFleetObjectFactory.freePointer(heldValue);
|
|
2711
|
+
}) : null;
|
|
2712
|
+
|
|
2713
|
+
return {
|
|
2714
|
+
create(pointer: UniffiHandle): FleetLike {
|
|
2715
|
+
const instance = Object.create(Fleet.prototype);
|
|
2716
|
+
instance[pointerLiteralSymbol] = pointer;
|
|
2717
|
+
instance[destructorGuardSymbol] = this.bless(pointer);
|
|
2718
|
+
instance[uniffiTypeNameSymbol] = "Fleet";
|
|
2719
|
+
return instance;
|
|
2720
|
+
},
|
|
2721
|
+
|
|
2722
|
+
|
|
2723
|
+
bless(p: UniffiHandle): UniffiGcObject {
|
|
2724
|
+
const ptr = {
|
|
2725
|
+
p, // make sure this object doesn't get optimized away.
|
|
2726
|
+
markDestroyed: () => undefined,
|
|
2727
|
+
};
|
|
2728
|
+
if (registry) {
|
|
2729
|
+
registry.register(ptr, p, ptr);
|
|
2730
|
+
}
|
|
2731
|
+
return ptr;
|
|
2732
|
+
},
|
|
2733
|
+
|
|
2734
|
+
unbless(ptr_: UniffiGcObject) {
|
|
2735
|
+
if (registry) {
|
|
2736
|
+
registry.unregister(ptr_);
|
|
2737
|
+
}
|
|
2738
|
+
},
|
|
2739
|
+
|
|
2740
|
+
pointer(obj_: FleetLike): UniffiHandle {
|
|
2741
|
+
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
|
|
2742
|
+
throw new UniffiInternalError.UnexpectedNullPointer();
|
|
2743
|
+
}
|
|
2744
|
+
return (obj_ as any)[pointerLiteralSymbol];
|
|
2745
|
+
},
|
|
2746
|
+
|
|
2747
|
+
clonePointer(obj_: FleetLike): UniffiHandle {
|
|
2748
|
+
const pointer = this.pointer(obj_);
|
|
2749
|
+
return uniffiCaller.rustCall(
|
|
2750
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_cua_sdk_fn_clone_fleet(pointer, callStatus),
|
|
2751
|
+
/*liftString:*/ FfiConverterString.lift
|
|
2752
|
+
);
|
|
2753
|
+
},
|
|
2754
|
+
|
|
2755
|
+
freePointer(pointer: UniffiHandle): void {
|
|
2756
|
+
uniffiCaller.rustCall(
|
|
2757
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_cua_sdk_fn_free_fleet(pointer, callStatus),
|
|
2758
|
+
/*liftString:*/ FfiConverterString.lift
|
|
2759
|
+
);
|
|
2760
|
+
},
|
|
2761
|
+
|
|
2762
|
+
isConcreteType(obj_: any): obj_ is FleetLike {
|
|
2763
|
+
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Fleet";
|
|
2764
|
+
},
|
|
2765
|
+
}})();
|
|
2766
|
+
const FfiConverterTypeFleet = new FfiConverterObject(uniffiTypeFleetObjectFactory);
|
|
2767
|
+
|
|
2768
|
+
/**
|
|
2769
|
+
* cua-spacesd over gRPC-Web.
|
|
2770
|
+
*/
|
|
2771
|
+
export interface SpacesdClientLike {
|
|
2772
|
+
|
|
2773
|
+
/**
|
|
2774
|
+
* Any unary `cua.env.v1` RPC with proto3-JSON bodies.
|
|
2775
|
+
*/
|
|
2776
|
+
callJson(method: string, requestJson: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
|
|
2777
|
+
/**
|
|
2778
|
+
* `GetCapabilities`.
|
|
2779
|
+
*/
|
|
2780
|
+
capabilities(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SpacesdCapabilities>;
|
|
2781
|
+
/**
|
|
2782
|
+
* Left click.
|
|
2783
|
+
*/
|
|
2784
|
+
click(x: number, y: number, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
|
|
2785
|
+
/**
|
|
2786
|
+
* Pointer position.
|
|
2787
|
+
*/
|
|
2788
|
+
cursorPosition(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Point>;
|
|
2789
|
+
/**
|
|
2790
|
+
* Clipboard text.
|
|
2791
|
+
*/
|
|
2792
|
+
getClipboard(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
|
|
2793
|
+
/**
|
|
2794
|
+
* `Health` as proto3 JSON.
|
|
2795
|
+
*/
|
|
2796
|
+
health(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
|
|
2797
|
+
/**
|
|
2798
|
+
* Presses a chord.
|
|
2799
|
+
*/
|
|
2800
|
+
hotkey(keys: Array<string>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
|
|
2801
|
+
/**
|
|
2802
|
+
* Moves the pointer.
|
|
2803
|
+
*/
|
|
2804
|
+
moveTo(x: number, y: number, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
|
|
2805
|
+
/**
|
|
2806
|
+
* Presses one key.
|
|
2807
|
+
*/
|
|
2808
|
+
press(keyName: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
|
|
2809
|
+
/**
|
|
2810
|
+
* Runs a command to completion (at most 64 MiB of output).
|
|
2811
|
+
*/
|
|
2812
|
+
run(command: SpacesdCommand, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ProcessOutput>;
|
|
2813
|
+
/**
|
|
2814
|
+
* Captures a display.
|
|
2815
|
+
*/
|
|
2816
|
+
screenshot(options: ScreenshotOptions | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Screenshot>;
|
|
2817
|
+
/**
|
|
2818
|
+
* Scrolls by line deltas.
|
|
2819
|
+
*/
|
|
2820
|
+
scroll(dx: number, dy: number, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
|
|
2821
|
+
/**
|
|
2822
|
+
* Sets clipboard text.
|
|
2823
|
+
*/
|
|
2824
|
+
setClipboard(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<bigint>;
|
|
2825
|
+
/**
|
|
2826
|
+
* Runs `line` with `/bin/sh -c`.
|
|
2827
|
+
*/
|
|
2828
|
+
sh(line: string, timeoutMs: number | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ProcessOutput>;
|
|
2829
|
+
/**
|
|
2830
|
+
* Types text.
|
|
2831
|
+
*/
|
|
2832
|
+
typeText(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* @deprecated Use `SpacesdClientLike` instead.
|
|
2836
|
+
*/
|
|
2837
|
+
export type SpacesdClientInterface = SpacesdClientLike;
|
|
2838
|
+
|
|
2839
|
+
|
|
2840
|
+
/**
|
|
2841
|
+
* cua-spacesd over gRPC-Web.
|
|
2842
|
+
*/
|
|
2843
|
+
export class SpacesdClient extends UniffiAbstractObject implements SpacesdClientLike {
|
|
2844
|
+
|
|
2845
|
+
readonly [uniffiTypeNameSymbol] = "SpacesdClient";
|
|
2846
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
2847
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
2848
|
+
// No primary constructor declared for this class.
|
|
2849
|
+
private constructor(pointer: UniffiHandle) {
|
|
2850
|
+
super();
|
|
2851
|
+
this[pointerLiteralSymbol] = pointer;
|
|
2852
|
+
this[destructorGuardSymbol] = uniffiTypeSpacesdClientObjectFactory.bless(pointer);
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
|
|
2856
|
+
|
|
2857
|
+
|
|
2858
|
+
/**
|
|
2859
|
+
* Any unary `cua.env.v1` RPC with proto3-JSON bodies.
|
|
2860
|
+
*/
|
|
2861
|
+
async callJson(method: string, requestJson: string, asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
|
|
2862
|
+
return await uniffiRustCallAsync(
|
|
2863
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2864
|
+
/*rustFutureFunc:*/ () => {
|
|
2865
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_call_json(
|
|
2866
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterString.lower(method, nativeModule().rustbuffer_alloc),FfiConverterString.lower(requestJson, nativeModule().rustbuffer_alloc)
|
|
2867
|
+
);
|
|
2868
|
+
},
|
|
2869
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
2870
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
2871
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
2872
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
2873
|
+
// Async returns always go through the JS-side converter: the
|
|
2874
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
2875
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
2876
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
2877
|
+
// here using the per-callable return-type converter.
|
|
2878
|
+
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2879
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2880
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2881
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2882
|
+
);
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
/**
|
|
2886
|
+
* `GetCapabilities`.
|
|
2887
|
+
*/
|
|
2888
|
+
async capabilities(asyncOpts_?: { signal: AbortSignal }): Promise<SpacesdCapabilities> /*throws*/ {
|
|
2889
|
+
return await uniffiRustCallAsync(
|
|
2890
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2891
|
+
/*rustFutureFunc:*/ () => {
|
|
2892
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_capabilities(
|
|
2893
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this)
|
|
2894
|
+
);
|
|
2895
|
+
},
|
|
2896
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
2897
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
2898
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
2899
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
2900
|
+
// Async returns always go through the JS-side converter: the
|
|
2901
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
2902
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
2903
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
2904
|
+
// here using the per-callable return-type converter.
|
|
2905
|
+
/*liftFunc:*/ FfiConverterTypeSpacesdCapabilities.lift.bind(FfiConverterTypeSpacesdCapabilities),
|
|
2906
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2907
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2908
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2909
|
+
);
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
/**
|
|
2913
|
+
* Left click.
|
|
2914
|
+
*/
|
|
2915
|
+
async click(x: number, y: number, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
|
|
2916
|
+
return await uniffiRustCallAsync(
|
|
2917
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2918
|
+
/*rustFutureFunc:*/ () => {
|
|
2919
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_click(
|
|
2920
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterFloat64.lower(x, nativeModule().rustbuffer_alloc),FfiConverterFloat64.lower(y, nativeModule().rustbuffer_alloc)
|
|
2921
|
+
);
|
|
2922
|
+
},
|
|
2923
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_void,
|
|
2924
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_void,
|
|
2925
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_void,
|
|
2926
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_void,
|
|
2927
|
+
/*liftFunc:*/ (_v) => {},
|
|
2928
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2929
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2930
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2931
|
+
);
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
/**
|
|
2935
|
+
* Pointer position.
|
|
2936
|
+
*/
|
|
2937
|
+
async cursorPosition(asyncOpts_?: { signal: AbortSignal }): Promise<Point> /*throws*/ {
|
|
2938
|
+
return await uniffiRustCallAsync(
|
|
2939
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2940
|
+
/*rustFutureFunc:*/ () => {
|
|
2941
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_cursor_position(
|
|
2942
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this)
|
|
2943
|
+
);
|
|
2944
|
+
},
|
|
2945
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
2946
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
2947
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
2948
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
2949
|
+
// Async returns always go through the JS-side converter: the
|
|
2950
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
2951
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
2952
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
2953
|
+
// here using the per-callable return-type converter.
|
|
2954
|
+
/*liftFunc:*/ FfiConverterTypePoint.lift.bind(FfiConverterTypePoint),
|
|
2955
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2956
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2957
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2958
|
+
);
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Clipboard text.
|
|
2963
|
+
*/
|
|
2964
|
+
async getClipboard(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
|
|
2965
|
+
return await uniffiRustCallAsync(
|
|
2966
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2967
|
+
/*rustFutureFunc:*/ () => {
|
|
2968
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_get_clipboard(
|
|
2969
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this)
|
|
2970
|
+
);
|
|
2971
|
+
},
|
|
2972
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
2973
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
2974
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
2975
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
2976
|
+
// Async returns always go through the JS-side converter: the
|
|
2977
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
2978
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
2979
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
2980
|
+
// here using the per-callable return-type converter.
|
|
2981
|
+
/*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
|
|
2982
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
2983
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
2984
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
2985
|
+
);
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
/**
|
|
2989
|
+
* `Health` as proto3 JSON.
|
|
2990
|
+
*/
|
|
2991
|
+
async health(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
|
|
2992
|
+
return await uniffiRustCallAsync(
|
|
2993
|
+
/*rustCaller:*/ uniffiCaller,
|
|
2994
|
+
/*rustFutureFunc:*/ () => {
|
|
2995
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_health(
|
|
2996
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this)
|
|
2997
|
+
);
|
|
2998
|
+
},
|
|
2999
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
3000
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
3001
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
3002
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
3003
|
+
// Async returns always go through the JS-side converter: the
|
|
3004
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
3005
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
3006
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
3007
|
+
// here using the per-callable return-type converter.
|
|
3008
|
+
/*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3009
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3010
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3011
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3012
|
+
);
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
/**
|
|
3016
|
+
* Presses a chord.
|
|
3017
|
+
*/
|
|
3018
|
+
async hotkey(keys: Array<string>, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
|
|
3019
|
+
return await uniffiRustCallAsync(
|
|
3020
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3021
|
+
/*rustFutureFunc:*/ () => {
|
|
3022
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_hotkey(
|
|
3023
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterSequenceString.lower(keys, nativeModule().rustbuffer_alloc)
|
|
3024
|
+
);
|
|
3025
|
+
},
|
|
3026
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_void,
|
|
3027
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_void,
|
|
3028
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_void,
|
|
3029
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_void,
|
|
3030
|
+
/*liftFunc:*/ (_v) => {},
|
|
3031
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3032
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3033
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3034
|
+
);
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
/**
|
|
3038
|
+
* Moves the pointer.
|
|
3039
|
+
*/
|
|
3040
|
+
async moveTo(x: number, y: number, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
|
|
3041
|
+
return await uniffiRustCallAsync(
|
|
3042
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3043
|
+
/*rustFutureFunc:*/ () => {
|
|
3044
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_move_to(
|
|
3045
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterFloat64.lower(x, nativeModule().rustbuffer_alloc),FfiConverterFloat64.lower(y, nativeModule().rustbuffer_alloc)
|
|
3046
|
+
);
|
|
3047
|
+
},
|
|
3048
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_void,
|
|
3049
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_void,
|
|
3050
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_void,
|
|
3051
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_void,
|
|
3052
|
+
/*liftFunc:*/ (_v) => {},
|
|
3053
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3054
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3055
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3056
|
+
);
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
/**
|
|
3060
|
+
* Presses one key.
|
|
3061
|
+
*/
|
|
3062
|
+
async press(keyName: string, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
|
|
3063
|
+
return await uniffiRustCallAsync(
|
|
3064
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3065
|
+
/*rustFutureFunc:*/ () => {
|
|
3066
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_press(
|
|
3067
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterString.lower(keyName, nativeModule().rustbuffer_alloc)
|
|
3068
|
+
);
|
|
3069
|
+
},
|
|
3070
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_void,
|
|
3071
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_void,
|
|
3072
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_void,
|
|
3073
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_void,
|
|
3074
|
+
/*liftFunc:*/ (_v) => {},
|
|
3075
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3076
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3077
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3078
|
+
);
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
/**
|
|
3082
|
+
* Runs a command to completion (at most 64 MiB of output).
|
|
3083
|
+
*/
|
|
3084
|
+
async run(command: SpacesdCommand, asyncOpts_?: { signal: AbortSignal }): Promise<ProcessOutput> /*throws*/ {
|
|
3085
|
+
return await uniffiRustCallAsync(
|
|
3086
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3087
|
+
/*rustFutureFunc:*/ () => {
|
|
3088
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_run(
|
|
3089
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterTypeSpacesdCommand.lower(command, nativeModule().rustbuffer_alloc)
|
|
3090
|
+
);
|
|
3091
|
+
},
|
|
3092
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
3093
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
3094
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
3095
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
3096
|
+
// Async returns always go through the JS-side converter: the
|
|
3097
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
3098
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
3099
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
3100
|
+
// here using the per-callable return-type converter.
|
|
3101
|
+
/*liftFunc:*/ FfiConverterTypeProcessOutput.lift.bind(FfiConverterTypeProcessOutput),
|
|
3102
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3103
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3104
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3105
|
+
);
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
/**
|
|
3109
|
+
* Captures a display.
|
|
3110
|
+
*/
|
|
3111
|
+
async screenshot(options: ScreenshotOptions | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<Screenshot> /*throws*/ {
|
|
3112
|
+
return await uniffiRustCallAsync(
|
|
3113
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3114
|
+
/*rustFutureFunc:*/ () => {
|
|
3115
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_screenshot(
|
|
3116
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterOptionalTypeScreenshotOptions.lower(options, nativeModule().rustbuffer_alloc)
|
|
3117
|
+
);
|
|
3118
|
+
},
|
|
3119
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
3120
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
3121
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
3122
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
3123
|
+
// Async returns always go through the JS-side converter: the
|
|
3124
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
3125
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
3126
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
3127
|
+
// here using the per-callable return-type converter.
|
|
3128
|
+
/*liftFunc:*/ FfiConverterTypeScreenshot.lift.bind(FfiConverterTypeScreenshot),
|
|
3129
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3130
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3131
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3132
|
+
);
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
/**
|
|
3136
|
+
* Scrolls by line deltas.
|
|
3137
|
+
*/
|
|
3138
|
+
async scroll(dx: number, dy: number, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
|
|
3139
|
+
return await uniffiRustCallAsync(
|
|
3140
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3141
|
+
/*rustFutureFunc:*/ () => {
|
|
3142
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_scroll(
|
|
3143
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterFloat64.lower(dx, nativeModule().rustbuffer_alloc),FfiConverterFloat64.lower(dy, nativeModule().rustbuffer_alloc)
|
|
3144
|
+
);
|
|
3145
|
+
},
|
|
3146
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_void,
|
|
3147
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_void,
|
|
3148
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_void,
|
|
3149
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_void,
|
|
3150
|
+
/*liftFunc:*/ (_v) => {},
|
|
3151
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3152
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3153
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3154
|
+
);
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
/**
|
|
3158
|
+
* Sets clipboard text.
|
|
3159
|
+
*/
|
|
3160
|
+
async setClipboard(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<bigint> /*throws*/ {
|
|
3161
|
+
return await uniffiRustCallAsync(
|
|
3162
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3163
|
+
/*rustFutureFunc:*/ () => {
|
|
3164
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_set_clipboard(
|
|
3165
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterString.lower(text, nativeModule().rustbuffer_alloc)
|
|
3166
|
+
);
|
|
3167
|
+
},
|
|
3168
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_u64,
|
|
3169
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_u64,
|
|
3170
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_u64,
|
|
3171
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_u64,
|
|
3172
|
+
// Async returns always go through the JS-side converter: the
|
|
3173
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
3174
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
3175
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
3176
|
+
// here using the per-callable return-type converter.
|
|
3177
|
+
/*liftFunc:*/ FfiConverterUInt64.lift.bind(FfiConverterUInt64),
|
|
3178
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3179
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3180
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3181
|
+
);
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
/**
|
|
3185
|
+
* Runs `line` with `/bin/sh -c`.
|
|
3186
|
+
*/
|
|
3187
|
+
async sh(line: string, timeoutMs: number | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<ProcessOutput> /*throws*/ {
|
|
3188
|
+
return await uniffiRustCallAsync(
|
|
3189
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3190
|
+
/*rustFutureFunc:*/ () => {
|
|
3191
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_sh(
|
|
3192
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterString.lower(line, nativeModule().rustbuffer_alloc),FfiConverterOptionalUInt32.lower(timeoutMs, nativeModule().rustbuffer_alloc)
|
|
3193
|
+
);
|
|
3194
|
+
},
|
|
3195
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_rust_buffer,
|
|
3196
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_rust_buffer,
|
|
3197
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_rust_buffer,
|
|
3198
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_rust_buffer,
|
|
3199
|
+
// Async returns always go through the JS-side converter: the
|
|
3200
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
3201
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
3202
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
3203
|
+
// here using the per-callable return-type converter.
|
|
3204
|
+
/*liftFunc:*/ FfiConverterTypeProcessOutput.lift.bind(FfiConverterTypeProcessOutput),
|
|
3205
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3206
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3207
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3208
|
+
);
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
/**
|
|
3212
|
+
* Types text.
|
|
3213
|
+
*/
|
|
3214
|
+
async typeText(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
|
|
3215
|
+
return await uniffiRustCallAsync(
|
|
3216
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3217
|
+
/*rustFutureFunc:*/ () => {
|
|
3218
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_spacesdclient_type_text(
|
|
3219
|
+
uniffiTypeSpacesdClientObjectFactory.clonePointer(this),FfiConverterString.lower(text, nativeModule().rustbuffer_alloc)
|
|
3220
|
+
);
|
|
3221
|
+
},
|
|
3222
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_void,
|
|
3223
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_void,
|
|
3224
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_void,
|
|
3225
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_void,
|
|
3226
|
+
/*liftFunc:*/ (_v) => {},
|
|
3227
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3228
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3229
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3230
|
+
);
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
|
|
3234
|
+
uniffiDestroy(): void {
|
|
3235
|
+
const ptr = (this as any)[destructorGuardSymbol];
|
|
3236
|
+
if (ptr !== undefined) {
|
|
3237
|
+
const pointer = uniffiTypeSpacesdClientObjectFactory.pointer(this);
|
|
3238
|
+
uniffiTypeSpacesdClientObjectFactory.freePointer(pointer);
|
|
3239
|
+
uniffiTypeSpacesdClientObjectFactory.unbless(ptr);
|
|
3240
|
+
delete (this as any)[destructorGuardSymbol];
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
static instanceOf(obj_: any): obj_ is SpacesdClient {
|
|
3245
|
+
return uniffiTypeSpacesdClientObjectFactory.isConcreteType(obj_);
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
|
|
3249
|
+
}
|
|
3250
|
+
|
|
3251
|
+
const uniffiTypeSpacesdClientObjectFactory: UniffiObjectFactory<SpacesdClientLike> = (() => {
|
|
3252
|
+
|
|
3253
|
+
/// <reference lib="es2021" />
|
|
3254
|
+
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
|
|
3255
|
+
uniffiTypeSpacesdClientObjectFactory.freePointer(heldValue);
|
|
3256
|
+
}) : null;
|
|
3257
|
+
|
|
3258
|
+
return {
|
|
3259
|
+
create(pointer: UniffiHandle): SpacesdClientLike {
|
|
3260
|
+
const instance = Object.create(SpacesdClient.prototype);
|
|
3261
|
+
instance[pointerLiteralSymbol] = pointer;
|
|
3262
|
+
instance[destructorGuardSymbol] = this.bless(pointer);
|
|
3263
|
+
instance[uniffiTypeNameSymbol] = "SpacesdClient";
|
|
3264
|
+
return instance;
|
|
3265
|
+
},
|
|
3266
|
+
|
|
3267
|
+
|
|
3268
|
+
bless(p: UniffiHandle): UniffiGcObject {
|
|
3269
|
+
const ptr = {
|
|
3270
|
+
p, // make sure this object doesn't get optimized away.
|
|
3271
|
+
markDestroyed: () => undefined,
|
|
3272
|
+
};
|
|
3273
|
+
if (registry) {
|
|
3274
|
+
registry.register(ptr, p, ptr);
|
|
3275
|
+
}
|
|
3276
|
+
return ptr;
|
|
3277
|
+
},
|
|
3278
|
+
|
|
3279
|
+
unbless(ptr_: UniffiGcObject) {
|
|
3280
|
+
if (registry) {
|
|
3281
|
+
registry.unregister(ptr_);
|
|
3282
|
+
}
|
|
3283
|
+
},
|
|
3284
|
+
|
|
3285
|
+
pointer(obj_: SpacesdClientLike): UniffiHandle {
|
|
3286
|
+
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
|
|
3287
|
+
throw new UniffiInternalError.UnexpectedNullPointer();
|
|
3288
|
+
}
|
|
3289
|
+
return (obj_ as any)[pointerLiteralSymbol];
|
|
3290
|
+
},
|
|
3291
|
+
|
|
3292
|
+
clonePointer(obj_: SpacesdClientLike): UniffiHandle {
|
|
3293
|
+
const pointer = this.pointer(obj_);
|
|
3294
|
+
return uniffiCaller.rustCall(
|
|
3295
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_cua_sdk_fn_clone_spacesdclient(pointer, callStatus),
|
|
3296
|
+
/*liftString:*/ FfiConverterString.lift
|
|
3297
|
+
);
|
|
3298
|
+
},
|
|
3299
|
+
|
|
3300
|
+
freePointer(pointer: UniffiHandle): void {
|
|
3301
|
+
uniffiCaller.rustCall(
|
|
3302
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_cua_sdk_fn_free_spacesdclient(pointer, callStatus),
|
|
3303
|
+
/*liftString:*/ FfiConverterString.lift
|
|
3304
|
+
);
|
|
3305
|
+
},
|
|
3306
|
+
|
|
3307
|
+
isConcreteType(obj_: any): obj_ is SpacesdClientLike {
|
|
3308
|
+
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SpacesdClient";
|
|
3309
|
+
},
|
|
3310
|
+
}})();
|
|
3311
|
+
const FfiConverterTypeSpacesdClient = new FfiConverterObject(uniffiTypeSpacesdClientObjectFactory);
|
|
3312
|
+
|
|
3313
|
+
/**
|
|
3314
|
+
* The cua SDK (browser build).
|
|
3315
|
+
*/
|
|
3316
|
+
export interface CuaLike {
|
|
3317
|
+
|
|
3318
|
+
/**
|
|
3319
|
+
* Fleet control plane.
|
|
3320
|
+
*/
|
|
3321
|
+
fleet() /*throws*/: FleetLike;
|
|
3322
|
+
/**
|
|
3323
|
+
* Connects to cua-spacesd at `url` over gRPC-Web.
|
|
3324
|
+
*/
|
|
3325
|
+
spacesd(url: string, token: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SpacesdClientLike>;
|
|
3326
|
+
}
|
|
3327
|
+
/**
|
|
3328
|
+
* @deprecated Use `CuaLike` instead.
|
|
3329
|
+
*/
|
|
3330
|
+
export type CuaInterface = CuaLike;
|
|
3331
|
+
|
|
3332
|
+
|
|
3333
|
+
/**
|
|
3334
|
+
* The cua SDK (browser build).
|
|
3335
|
+
*/
|
|
3336
|
+
export class Cua extends UniffiAbstractObject implements CuaLike {
|
|
3337
|
+
|
|
3338
|
+
readonly [uniffiTypeNameSymbol] = "Cua";
|
|
3339
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
3340
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
3341
|
+
// No primary constructor declared for this class.
|
|
3342
|
+
private constructor(pointer: UniffiHandle) {
|
|
3343
|
+
super();
|
|
3344
|
+
this[pointerLiteralSymbol] = pointer;
|
|
3345
|
+
this[destructorGuardSymbol] = uniffiTypeCuaObjectFactory.bless(pointer);
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
/**
|
|
3350
|
+
* The browser runtime.
|
|
3351
|
+
*/
|
|
3352
|
+
static embedded(config: CuaConfig): CuaLike {
|
|
3353
|
+
return FfiConverterTypeCua.lift(uniffiCaller.rustCall(
|
|
3354
|
+
/*caller:*/ (callStatus) => {
|
|
3355
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_constructor_cua_embedded(
|
|
3356
|
+
FfiConverterTypeCuaConfig.lower(config, nativeModule().rustbuffer_alloc),
|
|
3357
|
+
callStatus);
|
|
3358
|
+
},
|
|
3359
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3360
|
+
));
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
|
|
3364
|
+
|
|
3365
|
+
/**
|
|
3366
|
+
* Fleet control plane.
|
|
3367
|
+
*/
|
|
3368
|
+
fleet(): FleetLike /*throws*/ {
|
|
3369
|
+
return FfiConverterTypeFleet.lift(uniffiCaller.rustCallWithError(
|
|
3370
|
+
/*liftError:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError),
|
|
3371
|
+
/*caller:*/ (callStatus) => {
|
|
3372
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_cua_fleet(
|
|
3373
|
+
uniffiTypeCuaObjectFactory.clonePointer(this),
|
|
3374
|
+
callStatus);
|
|
3375
|
+
},
|
|
3376
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3377
|
+
));
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
/**
|
|
3381
|
+
* Connects to cua-spacesd at `url` over gRPC-Web.
|
|
3382
|
+
*/
|
|
3383
|
+
async spacesd(url: string, token: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<SpacesdClientLike> /*throws*/ {
|
|
3384
|
+
return await uniffiRustCallAsync(
|
|
3385
|
+
/*rustCaller:*/ uniffiCaller,
|
|
3386
|
+
/*rustFutureFunc:*/ () => {
|
|
3387
|
+
return nativeModule().ubrn_uniffi_cua_sdk_fn_method_cua_spacesd(
|
|
3388
|
+
uniffiTypeCuaObjectFactory.clonePointer(this),FfiConverterString.lower(url, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(token, nativeModule().rustbuffer_alloc)
|
|
3389
|
+
);
|
|
3390
|
+
},
|
|
3391
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_poll_u64,
|
|
3392
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_cancel_u64,
|
|
3393
|
+
/*completeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_complete_u64,
|
|
3394
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_cua_sdk_rust_future_free_u64,
|
|
3395
|
+
// Async returns always go through the JS-side converter: the
|
|
3396
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
3397
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
3398
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
3399
|
+
// here using the per-callable return-type converter.
|
|
3400
|
+
/*liftFunc:*/ FfiConverterTypeSpacesdClient.lift.bind(FfiConverterTypeSpacesdClient),
|
|
3401
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
3402
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
3403
|
+
/*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)
|
|
3404
|
+
);
|
|
3405
|
+
}
|
|
3406
|
+
|
|
3407
|
+
|
|
3408
|
+
uniffiDestroy(): void {
|
|
3409
|
+
const ptr = (this as any)[destructorGuardSymbol];
|
|
3410
|
+
if (ptr !== undefined) {
|
|
3411
|
+
const pointer = uniffiTypeCuaObjectFactory.pointer(this);
|
|
3412
|
+
uniffiTypeCuaObjectFactory.freePointer(pointer);
|
|
3413
|
+
uniffiTypeCuaObjectFactory.unbless(ptr);
|
|
3414
|
+
delete (this as any)[destructorGuardSymbol];
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
static instanceOf(obj_: any): obj_ is Cua {
|
|
3419
|
+
return uniffiTypeCuaObjectFactory.isConcreteType(obj_);
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3422
|
+
|
|
3423
|
+
}
|
|
3424
|
+
|
|
3425
|
+
const uniffiTypeCuaObjectFactory: UniffiObjectFactory<CuaLike> = (() => {
|
|
3426
|
+
|
|
3427
|
+
/// <reference lib="es2021" />
|
|
3428
|
+
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
|
|
3429
|
+
uniffiTypeCuaObjectFactory.freePointer(heldValue);
|
|
3430
|
+
}) : null;
|
|
3431
|
+
|
|
3432
|
+
return {
|
|
3433
|
+
create(pointer: UniffiHandle): CuaLike {
|
|
3434
|
+
const instance = Object.create(Cua.prototype);
|
|
3435
|
+
instance[pointerLiteralSymbol] = pointer;
|
|
3436
|
+
instance[destructorGuardSymbol] = this.bless(pointer);
|
|
3437
|
+
instance[uniffiTypeNameSymbol] = "Cua";
|
|
3438
|
+
return instance;
|
|
3439
|
+
},
|
|
3440
|
+
|
|
3441
|
+
|
|
3442
|
+
bless(p: UniffiHandle): UniffiGcObject {
|
|
3443
|
+
const ptr = {
|
|
3444
|
+
p, // make sure this object doesn't get optimized away.
|
|
3445
|
+
markDestroyed: () => undefined,
|
|
3446
|
+
};
|
|
3447
|
+
if (registry) {
|
|
3448
|
+
registry.register(ptr, p, ptr);
|
|
3449
|
+
}
|
|
3450
|
+
return ptr;
|
|
3451
|
+
},
|
|
3452
|
+
|
|
3453
|
+
unbless(ptr_: UniffiGcObject) {
|
|
3454
|
+
if (registry) {
|
|
3455
|
+
registry.unregister(ptr_);
|
|
3456
|
+
}
|
|
3457
|
+
},
|
|
3458
|
+
|
|
3459
|
+
pointer(obj_: CuaLike): UniffiHandle {
|
|
3460
|
+
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
|
|
3461
|
+
throw new UniffiInternalError.UnexpectedNullPointer();
|
|
3462
|
+
}
|
|
3463
|
+
return (obj_ as any)[pointerLiteralSymbol];
|
|
3464
|
+
},
|
|
3465
|
+
|
|
3466
|
+
clonePointer(obj_: CuaLike): UniffiHandle {
|
|
3467
|
+
const pointer = this.pointer(obj_);
|
|
3468
|
+
return uniffiCaller.rustCall(
|
|
3469
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_cua_sdk_fn_clone_cua(pointer, callStatus),
|
|
3470
|
+
/*liftString:*/ FfiConverterString.lift
|
|
3471
|
+
);
|
|
3472
|
+
},
|
|
3473
|
+
|
|
3474
|
+
freePointer(pointer: UniffiHandle): void {
|
|
3475
|
+
uniffiCaller.rustCall(
|
|
3476
|
+
/*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_cua_sdk_fn_free_cua(pointer, callStatus),
|
|
3477
|
+
/*liftString:*/ FfiConverterString.lift
|
|
3478
|
+
);
|
|
3479
|
+
},
|
|
3480
|
+
|
|
3481
|
+
isConcreteType(obj_: any): obj_ is CuaLike {
|
|
3482
|
+
return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Cua";
|
|
3483
|
+
},
|
|
3484
|
+
}})();
|
|
3485
|
+
const FfiConverterTypeCua = new FfiConverterObject(uniffiTypeCuaObjectFactory);
|
|
3486
|
+
|
|
3487
|
+
// FfiConverter for string | undefined
|
|
3488
|
+
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
|
|
3489
|
+
|
|
3490
|
+
// FfiConverter for FleetSettings | undefined
|
|
3491
|
+
const FfiConverterOptionalTypeFleetSettings = new FfiConverterOptional(FfiConverterTypeFleetSettings);
|
|
3492
|
+
|
|
3493
|
+
// FfiConverter for number | undefined
|
|
3494
|
+
const FfiConverterOptionalInt32 = new FfiConverterOptional(FfiConverterInt32);
|
|
3495
|
+
|
|
3496
|
+
// FfiConverter for bigint | undefined
|
|
3497
|
+
const FfiConverterOptionalInt64 = new FfiConverterOptional(FfiConverterInt64);
|
|
3498
|
+
|
|
3499
|
+
// FfiConverter for Array<string>
|
|
3500
|
+
const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
|
|
3501
|
+
|
|
3502
|
+
// FfiConverter for ExitInfo | undefined
|
|
3503
|
+
const FfiConverterOptionalTypeExitInfo = new FfiConverterOptional(FfiConverterTypeExitInfo);
|
|
3504
|
+
|
|
3505
|
+
// FfiConverter for ImageFormat | undefined
|
|
3506
|
+
const FfiConverterOptionalTypeImageFormat = new FfiConverterOptional(FfiConverterTypeImageFormat);
|
|
3507
|
+
|
|
3508
|
+
// FfiConverter for number | undefined
|
|
3509
|
+
const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
|
|
3510
|
+
|
|
3511
|
+
// FfiConverter for Map<string, string>
|
|
3512
|
+
const FfiConverterMapStringString = new FfiConverterMap(FfiConverterString, FfiConverterString);
|
|
3513
|
+
|
|
3514
|
+
// FfiConverter for Array<SpacesdFeature>
|
|
3515
|
+
const FfiConverterSequenceTypeSpacesdFeature = new FfiConverterArray(FfiConverterTypeSpacesdFeature);
|
|
3516
|
+
|
|
3517
|
+
// FfiConverter for PtySize | undefined
|
|
3518
|
+
const FfiConverterOptionalTypePtySize = new FfiConverterOptional(FfiConverterTypePtySize);
|
|
3519
|
+
|
|
3520
|
+
// FfiConverter for ScreenshotOptions | undefined
|
|
3521
|
+
const FfiConverterOptionalTypeScreenshotOptions = new FfiConverterOptional(FfiConverterTypeScreenshotOptions);
|
|
3522
|
+
|
|
3523
|
+
|
|
3524
|
+
/**
|
|
3525
|
+
* This should be called before anything else.
|
|
3526
|
+
*
|
|
3527
|
+
* It is likely that this is being done for you by the library's `index.ts`.
|
|
3528
|
+
*
|
|
3529
|
+
* It checks versions of uniffi between when the Rust scaffolding was generated
|
|
3530
|
+
* and when the bindings were generated.
|
|
3531
|
+
*
|
|
3532
|
+
* It also initializes the machinery to enable Rust to talk back to Javascript.
|
|
3533
|
+
*/
|
|
3534
|
+
function uniffiEnsureInitialized() {
|
|
3535
|
+
// Get the bindings contract version from our ComponentInterface
|
|
3536
|
+
const bindingsContractVersion = 30;
|
|
3537
|
+
// Get the scaffolding contract version by calling the into the dylib
|
|
3538
|
+
const scaffoldingContractVersion = nativeModule().ubrn_ffi_cua_sdk_uniffi_contract_version();
|
|
3539
|
+
if (bindingsContractVersion !== scaffoldingContractVersion) {
|
|
3540
|
+
throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
|
|
3541
|
+
}
|
|
3542
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_func_cua_sdk_version() !== 62700) {
|
|
3543
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_cua_sdk_version");
|
|
3544
|
+
}
|
|
3545
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_func_error_doc_url() !== 10839) {
|
|
3546
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_error_doc_url");
|
|
3547
|
+
}
|
|
3548
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_constructor_cua_embedded() !== 45489) {
|
|
3549
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_constructor_cua_embedded");
|
|
3550
|
+
}
|
|
3551
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_cua_fleet() !== 47468) {
|
|
3552
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_cua_fleet");
|
|
3553
|
+
}
|
|
3554
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_cua_spacesd() !== 55115) {
|
|
3555
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_cua_spacesd");
|
|
3556
|
+
}
|
|
3557
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_fleet_acquire() !== 37737) {
|
|
3558
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_fleet_acquire");
|
|
3559
|
+
}
|
|
3560
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_fleet_list_claims() !== 29250) {
|
|
3561
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_fleet_list_claims");
|
|
3562
|
+
}
|
|
3563
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_fleet_list_pools() !== 64386) {
|
|
3564
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_fleet_list_pools");
|
|
3565
|
+
}
|
|
3566
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_fleet_release() !== 61023) {
|
|
3567
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_fleet_release");
|
|
3568
|
+
}
|
|
3569
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_call_json() !== 32221) {
|
|
3570
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_call_json");
|
|
3571
|
+
}
|
|
3572
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_capabilities() !== 52681) {
|
|
3573
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_capabilities");
|
|
3574
|
+
}
|
|
3575
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_click() !== 34615) {
|
|
3576
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_click");
|
|
3577
|
+
}
|
|
3578
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_cursor_position() !== 32994) {
|
|
3579
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_cursor_position");
|
|
3580
|
+
}
|
|
3581
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_get_clipboard() !== 29593) {
|
|
3582
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_get_clipboard");
|
|
3583
|
+
}
|
|
3584
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_health() !== 58046) {
|
|
3585
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_health");
|
|
3586
|
+
}
|
|
3587
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_hotkey() !== 26513) {
|
|
3588
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_hotkey");
|
|
3589
|
+
}
|
|
3590
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_move_to() !== 8497) {
|
|
3591
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_move_to");
|
|
3592
|
+
}
|
|
3593
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_press() !== 48859) {
|
|
3594
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_press");
|
|
3595
|
+
}
|
|
3596
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_run() !== 60712) {
|
|
3597
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_run");
|
|
3598
|
+
}
|
|
3599
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_screenshot() !== 23114) {
|
|
3600
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_screenshot");
|
|
3601
|
+
}
|
|
3602
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_scroll() !== 18534) {
|
|
3603
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_scroll");
|
|
3604
|
+
}
|
|
3605
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_set_clipboard() !== 37414) {
|
|
3606
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_set_clipboard");
|
|
3607
|
+
}
|
|
3608
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_sh() !== 11145) {
|
|
3609
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_sh");
|
|
3610
|
+
}
|
|
3611
|
+
if (nativeModule().ubrn_uniffi_cua_sdk_checksum_method_spacesdclient_type_text() !== 18745) {
|
|
3612
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_type_text");
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
export default Object.freeze({
|
|
3618
|
+
initialize: uniffiEnsureInitialized,
|
|
3619
|
+
converters: {
|
|
3620
|
+
FfiConverterTypeCua,
|
|
3621
|
+
FfiConverterTypeCuaConfig,
|
|
3622
|
+
FfiConverterTypeCuaError,
|
|
3623
|
+
FfiConverterTypeExitInfo,
|
|
3624
|
+
FfiConverterTypeFileEntry,
|
|
3625
|
+
FfiConverterTypeFleet,
|
|
3626
|
+
FfiConverterTypeFleetSandbox,
|
|
3627
|
+
FfiConverterTypeFleetSettings,
|
|
3628
|
+
FfiConverterTypeImageFormat,
|
|
3629
|
+
FfiConverterTypeMediaOpenOptions,
|
|
3630
|
+
FfiConverterTypePoint,
|
|
3631
|
+
FfiConverterTypeProcessEvent,
|
|
3632
|
+
FfiConverterTypeProcessEventKind,
|
|
3633
|
+
FfiConverterTypeProcessOutput,
|
|
3634
|
+
FfiConverterTypePtySize,
|
|
3635
|
+
FfiConverterTypeScreenshot,
|
|
3636
|
+
FfiConverterTypeScreenshotOptions,
|
|
3637
|
+
FfiConverterTypeSpacesdCapabilities,
|
|
3638
|
+
FfiConverterTypeSpacesdClient,
|
|
3639
|
+
FfiConverterTypeSpacesdCommand,
|
|
3640
|
+
FfiConverterTypeSpacesdFeature,
|
|
3641
|
+
FfiConverterTypeTransferResult,
|
|
3642
|
+
FfiConverterTypeUploadOptions,
|
|
3643
|
+
}
|
|
3644
|
+
});
|