recappi 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -19334,7 +19334,7 @@ function readCliVersion() {
19334
19334
  var CLI_VERSION = readCliVersion();
19335
19335
 
19336
19336
  // src/record.tsx
19337
- import { existsSync } from "fs";
19337
+ import { chmodSync, existsSync, statSync } from "fs";
19338
19338
  import { fileURLToPath } from "url";
19339
19339
  import { render, useInput as useInput2 } from "ink";
19340
19340
 
@@ -19612,6 +19612,7 @@ async function startRecordSession(opts) {
19612
19612
  capabilities: opts.live ? ["recording.capture", "recording.upload", "live_captions.stream"] : ["recording.capture", "recording.upload"]
19613
19613
  })
19614
19614
  );
19615
+ assertSidecarCapabilities(handshake, opts);
19615
19616
  const started = await sidecar.client.startRecording({
19616
19617
  account,
19617
19618
  options: {
@@ -19663,11 +19664,25 @@ async function startRecordSession(opts) {
19663
19664
  throw error51;
19664
19665
  }
19665
19666
  }
19667
+ function assertSidecarCapabilities(handshake, opts) {
19668
+ const capabilities = new Set(handshake.capabilities);
19669
+ const missing = [];
19670
+ if (!capabilities.has("recording.capture")) missing.push("recording.capture");
19671
+ if (opts.live && !capabilities.has("live_captions.stream")) {
19672
+ missing.push("live_captions.stream");
19673
+ }
19674
+ if (missing.length === 0) return;
19675
+ throw cliError("usage.invalid_argument", "Recappi recording helper cannot capture yet.", {
19676
+ hint: `Found ${handshake.sidecar.name} ${handshake.sidecar.version}, but it did not advertise ${missing.join(
19677
+ ", "
19678
+ )}. Upgrade recappi when a helper build with native recording support ships, or set ${SIDECAR_COMMAND_ENV} to a compatible helper.`
19679
+ });
19680
+ }
19666
19681
  function resolveSidecarCommand(opts) {
19667
19682
  const command = opts.sidecarCommand?.trim() || opts.env?.[SIDECAR_COMMAND_ENV]?.trim();
19668
19683
  if (command) return command;
19669
19684
  const bundled = bundledSidecarCommand(process.platform, process.arch);
19670
- if (bundled && existsSync(bundled)) return bundled;
19685
+ if (bundled && existsSync(bundled)) return ensureBundledHelperExecutable(bundled);
19671
19686
  const platform = `${process.platform}-${process.arch}`;
19672
19687
  if (bundled) {
19673
19688
  throw cliError("usage.invalid_argument", "Recappi recording helper is not available.", {
@@ -19678,6 +19693,20 @@ function resolveSidecarCommand(opts) {
19678
19693
  hint: `No bundled helper is registered for ${platform}. Set ${SIDECAR_COMMAND_ENV} to a compatible helper when one is available.`
19679
19694
  });
19680
19695
  }
19696
+ function ensureBundledHelperExecutable(path6) {
19697
+ if (process.platform === "win32") return path6;
19698
+ const mode = statSync(path6).mode;
19699
+ if ((mode & 73) !== 0) return path6;
19700
+ try {
19701
+ chmodSync(path6, mode | 493);
19702
+ } catch (error51) {
19703
+ const message = error51 instanceof Error ? error51.message : String(error51);
19704
+ throw cliError("usage.invalid_argument", "Recappi recording helper is not executable.", {
19705
+ hint: `Could not make bundled helper executable at ${path6}: ${message}. Reinstall recappi, or set ${SIDECAR_COMMAND_ENV} to a compatible helper.`
19706
+ });
19707
+ }
19708
+ return path6;
19709
+ }
19681
19710
  function bundledSidecarCommand(platform, arch) {
19682
19711
  const executable = helperExecutableName(platform);
19683
19712
  if (!executable) return null;