@trycua/cua-driver 0.37.0 → 0.39.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 CHANGED
@@ -201,6 +201,15 @@ for its generation, observe unexpected termination with
201
201
  Rust host also closes a parent-liveness pipe on normal destruction so the daemon
202
202
  cannot remain orphaned after a host crash.
203
203
 
204
+ For startup troubleshooting, create the host with
205
+ `EmbeddedCuaDriverHost.withOptions()` and set `captureStderr: true`. After a
206
+ failed start, `lastDiagnostics()` returns the generation-scoped final 65,536
207
+ bytes, exit code, and truncation state; a successful start clears the previous
208
+ diagnostics. Captured text is raw child stderr and can contain application data,
209
+ so do not place secrets in daemon stderr or forward diagnostics to telemetry.
210
+ When `inheritStderr` is also enabled, the host tees output on a bounded
211
+ best-effort path so a blocked terminal cannot stop diagnostic collection.
212
+
204
213
  The npm package installs one optional native package selected for the current
205
214
  OS and CPU. It does not bundle the `cua-driver` executable: ship that executable
206
215
  outside ASAR, preserve its executable bit, and sign it before signing and
@@ -141,13 +141,20 @@ export type ActionResult = {
141
141
  * or a call that keeps the user's window where it is).
142
142
  */
143
143
  nextCall?: ActionNextCall;
144
+ /**
145
+ * Present only when the `fast_path` config key is `on`: the check cost,
146
+ * the target class and the changed regions since the last read, as one
147
+ * JSON object. Absent when the flag is off, so default results are
148
+ * unchanged.
149
+ */
150
+ fastPath?: string;
144
151
  };
145
152
  /**
146
153
  * Generated factory for {@link ActionResult} record objects.
147
154
  */
148
155
  export declare const ActionResult: Readonly<{
149
- create: (partial: Partial<ActionResult> & Required<Omit<ActionResult, "hint" | "delivery" | "evidence" | "escalation" | "summary" | "error" | "nextCall">>) => ActionResult;
150
- new: (partial: Partial<ActionResult> & Required<Omit<ActionResult, "hint" | "delivery" | "evidence" | "escalation" | "summary" | "error" | "nextCall">>) => ActionResult;
156
+ create: (partial: Partial<ActionResult> & Required<Omit<ActionResult, "hint" | "delivery" | "evidence" | "escalation" | "summary" | "error" | "nextCall" | "fastPath">>) => ActionResult;
157
+ new: (partial: Partial<ActionResult> & Required<Omit<ActionResult, "hint" | "delivery" | "evidence" | "escalation" | "summary" | "error" | "nextCall" | "fastPath">>) => ActionResult;
151
158
  defaults: () => Partial<ActionResult>;
152
159
  }>;
153
160
  export type AppInfo = {
@@ -428,7 +428,8 @@ const FfiConverterTypeActionResult = (() => {
428
428
  summary: FfiConverterOptionalString.read(from),
429
429
  error: FfiConverterOptionalTypeActionError.read(from),
430
430
  hint: FfiConverterOptionalString.read(from),
431
- nextCall: FfiConverterOptionalTypeActionNextCall.read(from)
431
+ nextCall: FfiConverterOptionalTypeActionNextCall.read(from),
432
+ fastPath: FfiConverterOptionalString.read(from)
432
433
  };
433
434
  }
434
435
  write(value, into) {
@@ -441,6 +442,7 @@ const FfiConverterTypeActionResult = (() => {
441
442
  FfiConverterOptionalTypeActionError.write(value.error, into);
442
443
  FfiConverterOptionalString.write(value.hint, into);
443
444
  FfiConverterOptionalTypeActionNextCall.write(value.nextCall, into);
445
+ FfiConverterOptionalString.write(value.fastPath, into);
444
446
  }
445
447
  allocationSize(value) {
446
448
  return FfiConverterTypeActionEffect.allocationSize(value.effect) +
@@ -451,7 +453,8 @@ const FfiConverterTypeActionResult = (() => {
451
453
  FfiConverterOptionalString.allocationSize(value.summary) +
452
454
  FfiConverterOptionalTypeActionError.allocationSize(value.error) +
453
455
  FfiConverterOptionalString.allocationSize(value.hint) +
454
- FfiConverterOptionalTypeActionNextCall.allocationSize(value.nextCall);
456
+ FfiConverterOptionalTypeActionNextCall.allocationSize(value.nextCall) +
457
+ FfiConverterOptionalString.allocationSize(value.fastPath);
455
458
  }
456
459
  }
457
460
  ;
@@ -181,6 +181,7 @@ interface NativeModuleInterface {
181
181
  uniffi_cua_driver_sdk_fn_constructor_embeddedcuadriverhost_new(binaryPath: Uint8Array, hostBundleId: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
182
182
  uniffi_cua_driver_sdk_fn_constructor_embeddedcuadriverhost_with_options(options: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
183
183
  uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_connection(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
184
+ uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_last_diagnostics(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
184
185
  uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_restart(uniffiSelf: bigint): bigint;
185
186
  uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_start(uniffiSelf: bigint): bigint;
186
187
  uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_state(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
@@ -308,6 +309,7 @@ interface NativeModuleInterface {
308
309
  uniffi_cua_driver_sdk_checksum_constructor_embeddedcuadriverhost_new(): number;
309
310
  uniffi_cua_driver_sdk_checksum_constructor_embeddedcuadriverhost_with_options(): number;
310
311
  uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_connection(): number;
312
+ uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_last_diagnostics(): number;
311
313
  uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_restart(): number;
312
314
  uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_start(): number;
313
315
  uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_state(): number;
@@ -917,6 +917,11 @@ const DEFINITIONS = {
917
917
  ret: FfiType.RustBuffer,
918
918
  hasRustCallStatus: true,
919
919
  },
920
+ "uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_last_diagnostics": {
921
+ args: [FfiType.Handle],
922
+ ret: FfiType.RustBuffer,
923
+ hasRustCallStatus: true,
924
+ },
920
925
  "uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_restart": {
921
926
  args: [FfiType.Handle],
922
927
  ret: FfiType.Handle,
@@ -1552,6 +1557,11 @@ const DEFINITIONS = {
1552
1557
  ret: FfiType.UInt16,
1553
1558
  hasRustCallStatus: false,
1554
1559
  },
1560
+ "uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_last_diagnostics": {
1561
+ args: [],
1562
+ ret: FfiType.UInt16,
1563
+ hasRustCallStatus: false,
1564
+ },
1555
1565
  "uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_restart": {
1556
1566
  args: [],
1557
1567
  ret: FfiType.UInt16,
@@ -1239,6 +1239,20 @@ export declare const EmbeddedDriverConnection: Readonly<{
1239
1239
  new: (partial: Partial<EmbeddedDriverConnection> & Required<Omit<EmbeddedDriverConnection, never>>) => EmbeddedDriverConnection;
1240
1240
  defaults: () => Partial<EmbeddedDriverConnection>;
1241
1241
  }>;
1242
+ export type EmbeddedDriverDiagnostics = {
1243
+ lifecyclePhase: string;
1244
+ exitCode?: number;
1245
+ stderrTail: string;
1246
+ stderrTruncated: boolean;
1247
+ };
1248
+ /**
1249
+ * Generated factory for {@link EmbeddedDriverDiagnostics} record objects.
1250
+ */
1251
+ export declare const EmbeddedDriverDiagnostics: Readonly<{
1252
+ create: (partial: Partial<EmbeddedDriverDiagnostics> & Required<Omit<EmbeddedDriverDiagnostics, "exitCode">>) => EmbeddedDriverDiagnostics;
1253
+ new: (partial: Partial<EmbeddedDriverDiagnostics> & Required<Omit<EmbeddedDriverDiagnostics, "exitCode">>) => EmbeddedDriverDiagnostics;
1254
+ defaults: () => Partial<EmbeddedDriverDiagnostics>;
1255
+ }>;
1242
1256
  export type EmbeddedDriverExit = {
1243
1257
  generation: string;
1244
1258
  code?: number;
@@ -1275,13 +1289,14 @@ export type EmbeddedDriverHostOptions = {
1275
1289
  environment: Array<EmbeddedEnvironmentVariable>;
1276
1290
  inheritStderr: boolean;
1277
1291
  noOverlay: boolean;
1292
+ captureStderr: boolean;
1278
1293
  };
1279
1294
  /**
1280
1295
  * Generated factory for {@link EmbeddedDriverHostOptions} record objects.
1281
1296
  */
1282
1297
  export declare const EmbeddedDriverHostOptions: Readonly<{
1283
- create: (partial: Partial<EmbeddedDriverHostOptions> & Required<Omit<EmbeddedDriverHostOptions, "socketPath" | "permissionMode" | "startupTimeoutMs" | "shutdownTimeoutMs" | "capabilityManifestPath" | "approveCapabilityManifest" | "sessionPolicyPath" | "noOverlay">>) => EmbeddedDriverHostOptions;
1284
- new: (partial: Partial<EmbeddedDriverHostOptions> & Required<Omit<EmbeddedDriverHostOptions, "socketPath" | "permissionMode" | "startupTimeoutMs" | "shutdownTimeoutMs" | "capabilityManifestPath" | "approveCapabilityManifest" | "sessionPolicyPath" | "noOverlay">>) => EmbeddedDriverHostOptions;
1298
+ create: (partial: Partial<EmbeddedDriverHostOptions> & Required<Omit<EmbeddedDriverHostOptions, "socketPath" | "permissionMode" | "startupTimeoutMs" | "shutdownTimeoutMs" | "capabilityManifestPath" | "approveCapabilityManifest" | "sessionPolicyPath" | "noOverlay" | "captureStderr">>) => EmbeddedDriverHostOptions;
1299
+ new: (partial: Partial<EmbeddedDriverHostOptions> & Required<Omit<EmbeddedDriverHostOptions, "socketPath" | "permissionMode" | "startupTimeoutMs" | "shutdownTimeoutMs" | "capabilityManifestPath" | "approveCapabilityManifest" | "sessionPolicyPath" | "noOverlay" | "captureStderr">>) => EmbeddedDriverHostOptions;
1285
1300
  defaults: () => Partial<EmbeddedDriverHostOptions>;
1286
1301
  }>;
1287
1302
  /**
@@ -4072,6 +4087,7 @@ export declare class DriverServiceTransportImpl extends UniffiAbstractObject imp
4072
4087
  }
4073
4088
  export interface EmbeddedCuaDriverHostLike {
4074
4089
  connection(): EmbeddedDriverConnection | undefined;
4090
+ lastDiagnostics(): EmbeddedDriverDiagnostics | undefined;
4075
4091
  restart(asyncOpts_?: {
4076
4092
  signal: AbortSignal;
4077
4093
  }): Promise<EmbeddedDriverConnection>;
@@ -4097,6 +4113,7 @@ export declare class EmbeddedCuaDriverHost extends UniffiAbstractObject implemen
4097
4113
  constructor(binaryPath: string, hostBundleId: string);
4098
4114
  static withOptions(options: EmbeddedDriverHostOptions): EmbeddedCuaDriverHostLike;
4099
4115
  connection(): EmbeddedDriverConnection | undefined;
4116
+ lastDiagnostics(): EmbeddedDriverDiagnostics | undefined;
4100
4117
  restart(asyncOpts_?: {
4101
4118
  signal: AbortSignal;
4102
4119
  }): Promise<EmbeddedDriverConnection>;
@@ -4542,6 +4559,13 @@ declare const _default: Readonly<{
4542
4559
  lift(value: UniffiByteArray): EmbeddedDriverConnection;
4543
4560
  lower(value: EmbeddedDriverConnection, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
4544
4561
  };
4562
+ FfiConverterTypeEmbeddedDriverDiagnostics: {
4563
+ read(from: RustBuffer): EmbeddedDriverDiagnostics;
4564
+ write(value: EmbeddedDriverDiagnostics, into: RustBuffer): void;
4565
+ allocationSize(value: EmbeddedDriverDiagnostics): number;
4566
+ lift(value: UniffiByteArray): EmbeddedDriverDiagnostics;
4567
+ lower(value: EmbeddedDriverDiagnostics, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
4568
+ };
4545
4569
  FfiConverterTypeEmbeddedDriverError: {
4546
4570
  read(from: RustBuffer): EmbeddedDriverError;
4547
4571
  write(value: EmbeddedDriverError, into: RustBuffer): void;
@@ -2124,6 +2124,46 @@ const FfiConverterTypeEmbeddedDriverConnection = (() => {
2124
2124
  ;
2125
2125
  return new FFIConverter();
2126
2126
  })();
2127
+ /**
2128
+ * Generated factory for {@link EmbeddedDriverDiagnostics} record objects.
2129
+ */
2130
+ export const EmbeddedDriverDiagnostics = (() => {
2131
+ const defaults = () => ({});
2132
+ const create = (() => {
2133
+ return uniffiCreateRecord(defaults);
2134
+ })();
2135
+ return Object.freeze({
2136
+ create,
2137
+ new: create,
2138
+ defaults: () => Object.freeze(defaults()),
2139
+ });
2140
+ })();
2141
+ const FfiConverterTypeEmbeddedDriverDiagnostics = (() => {
2142
+ class FFIConverter extends AbstractFfiConverterByteArray {
2143
+ read(from) {
2144
+ return {
2145
+ lifecyclePhase: FfiConverterString.read(from),
2146
+ exitCode: FfiConverterOptionalInt32.read(from),
2147
+ stderrTail: FfiConverterString.read(from),
2148
+ stderrTruncated: FfiConverterBool.read(from)
2149
+ };
2150
+ }
2151
+ write(value, into) {
2152
+ FfiConverterString.write(value.lifecyclePhase, into);
2153
+ FfiConverterOptionalInt32.write(value.exitCode, into);
2154
+ FfiConverterString.write(value.stderrTail, into);
2155
+ FfiConverterBool.write(value.stderrTruncated, into);
2156
+ }
2157
+ allocationSize(value) {
2158
+ return FfiConverterString.allocationSize(value.lifecyclePhase) +
2159
+ FfiConverterOptionalInt32.allocationSize(value.exitCode) +
2160
+ FfiConverterString.allocationSize(value.stderrTail) +
2161
+ FfiConverterBool.allocationSize(value.stderrTruncated);
2162
+ }
2163
+ }
2164
+ ;
2165
+ return new FFIConverter();
2166
+ })();
2127
2167
  /**
2128
2168
  * Generated factory for {@link EmbeddedDriverExit} record objects.
2129
2169
  */
@@ -2198,7 +2238,8 @@ export const EmbeddedDriverHostOptions = (() => {
2198
2238
  const defaults = () => ({
2199
2239
  capabilityManifestPath: undefined,
2200
2240
  approveCapabilityManifest: false,
2201
- noOverlay: false
2241
+ noOverlay: false,
2242
+ captureStderr: false
2202
2243
  });
2203
2244
  const create = (() => {
2204
2245
  return uniffiCreateRecord(defaults);
@@ -2226,7 +2267,8 @@ const FfiConverterTypeEmbeddedDriverHostOptions = (() => {
2226
2267
  dangerouslyBypassApprovals: FfiConverterBool.read(from),
2227
2268
  environment: FfiConverterSequenceTypeEmbeddedEnvironmentVariable.read(from),
2228
2269
  inheritStderr: FfiConverterBool.read(from),
2229
- noOverlay: FfiConverterBool.read(from)
2270
+ noOverlay: FfiConverterBool.read(from),
2271
+ captureStderr: FfiConverterBool.read(from)
2230
2272
  };
2231
2273
  }
2232
2274
  write(value, into) {
@@ -2244,6 +2286,7 @@ const FfiConverterTypeEmbeddedDriverHostOptions = (() => {
2244
2286
  FfiConverterSequenceTypeEmbeddedEnvironmentVariable.write(value.environment, into);
2245
2287
  FfiConverterBool.write(value.inheritStderr, into);
2246
2288
  FfiConverterBool.write(value.noOverlay, into);
2289
+ FfiConverterBool.write(value.captureStderr, into);
2247
2290
  }
2248
2291
  allocationSize(value) {
2249
2292
  return FfiConverterString.allocationSize(value.binaryPath) +
@@ -2259,7 +2302,8 @@ const FfiConverterTypeEmbeddedDriverHostOptions = (() => {
2259
2302
  FfiConverterBool.allocationSize(value.dangerouslyBypassApprovals) +
2260
2303
  FfiConverterSequenceTypeEmbeddedEnvironmentVariable.allocationSize(value.environment) +
2261
2304
  FfiConverterBool.allocationSize(value.inheritStderr) +
2262
- FfiConverterBool.allocationSize(value.noOverlay);
2305
+ FfiConverterBool.allocationSize(value.noOverlay) +
2306
+ FfiConverterBool.allocationSize(value.captureStderr);
2263
2307
  }
2264
2308
  }
2265
2309
  ;
@@ -7175,6 +7219,20 @@ export class EmbeddedCuaDriverHost extends UniffiAbstractObject {
7175
7219
  },
7176
7220
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
7177
7221
  }
7222
+ lastDiagnostics() {
7223
+ return ((__rb) => {
7224
+ try {
7225
+ return FfiConverterOptionalTypeEmbeddedDriverDiagnostics.lift(__rb);
7226
+ }
7227
+ finally {
7228
+ nativeModule().rustbuffer_free(__rb);
7229
+ }
7230
+ })(uniffiCaller.rustCall(
7231
+ /*caller:*/ (callStatus) => {
7232
+ return nativeModule().uniffi_cua_driver_sdk_fn_method_embeddedcuadriverhost_last_diagnostics(uniffiTypeEmbeddedCuaDriverHostObjectFactory.clonePointer(this), callStatus);
7233
+ },
7234
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
7235
+ }
7178
7236
  async restart(asyncOpts_) {
7179
7237
  const __stack = uniffiIsDebug ? new Error().stack : undefined;
7180
7238
  try {
@@ -7547,6 +7605,8 @@ const FfiConverterOptionalTypeVerifyStateOutput = new FfiConverterOptional(FfiCo
7547
7605
  const FfiConverterSequenceTypeCursorMotionSample = new FfiConverterArray(FfiConverterTypeCursorMotionSample);
7548
7606
  // FfiConverter for EmbeddedDriverConnection | undefined
7549
7607
  const FfiConverterOptionalTypeEmbeddedDriverConnection = new FfiConverterOptional(FfiConverterTypeEmbeddedDriverConnection);
7608
+ // FfiConverter for EmbeddedDriverDiagnostics | undefined
7609
+ const FfiConverterOptionalTypeEmbeddedDriverDiagnostics = new FfiConverterOptional(FfiConverterTypeEmbeddedDriverDiagnostics);
7550
7610
  // FfiConverter for CursorMotionSpec | undefined
7551
7611
  const FfiConverterOptionalTypeCursorMotionSpec = new FfiConverterOptional(FfiConverterTypeCursorMotionSpec);
7552
7612
  // FfiConverter for DriverOptions | undefined
@@ -7902,6 +7962,9 @@ function uniffiEnsureInitialized() {
7902
7962
  if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_connection() !== 44467) {
7903
7963
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_connection");
7904
7964
  }
7965
+ if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_last_diagnostics() !== 57979) {
7966
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_last_diagnostics");
7967
+ }
7905
7968
  if (nativeModule().uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_restart() !== 27248) {
7906
7969
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_driver_sdk_checksum_method_embeddedcuadriverhost_restart");
7907
7970
  }
@@ -7996,6 +8059,7 @@ export default Object.freeze({
7996
8059
  FfiConverterTypeDriverServiceTransportError,
7997
8060
  FfiConverterTypeEmbeddedCuaDriverHost,
7998
8061
  FfiConverterTypeEmbeddedDriverConnection,
8062
+ FfiConverterTypeEmbeddedDriverDiagnostics,
7999
8063
  FfiConverterTypeEmbeddedDriverError,
8000
8064
  FfiConverterTypeEmbeddedDriverExit,
8001
8065
  FfiConverterTypeEmbeddedDriverHostOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycua/cua-driver",
3
- "version": "0.37.0",
3
+ "version": "0.39.0",
4
4
  "description": "Rust-backed Cua Driver SDK and embedded Node host",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -44,11 +44,11 @@
44
44
  "@ubjs/node": "0.31.0-3"
45
45
  },
46
46
  "optionalDependencies": {
47
- "@trycua/cua-driver-darwin-arm64": "0.37.0",
48
- "@trycua/cua-driver-darwin-x64": "0.37.0",
49
- "@trycua/cua-driver-linux-arm64-gnu": "0.37.0",
50
- "@trycua/cua-driver-linux-x64-gnu": "0.37.0",
51
- "@trycua/cua-driver-win32-arm64-msvc": "0.37.0",
52
- "@trycua/cua-driver-win32-x64-msvc": "0.37.0"
47
+ "@trycua/cua-driver-darwin-arm64": "0.39.0",
48
+ "@trycua/cua-driver-darwin-x64": "0.39.0",
49
+ "@trycua/cua-driver-linux-arm64-gnu": "0.39.0",
50
+ "@trycua/cua-driver-linux-x64-gnu": "0.39.0",
51
+ "@trycua/cua-driver-win32-arm64-msvc": "0.39.0",
52
+ "@trycua/cua-driver-win32-x64-msvc": "0.39.0"
53
53
  }
54
54
  }