recappi 0.1.5 → 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
@@ -16330,7 +16330,7 @@ function date4(params) {
16330
16330
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
16331
16331
  config(en_default());
16332
16332
 
16333
- // ../../packages/contracts/src/index.ts
16333
+ // ../packages/contracts/src/index.ts
16334
16334
  var CLI_SCHEMA_VERSION = "2026-06-25";
16335
16335
  function toJsonSchema(schema) {
16336
16336
  return external_exports.toJSONSchema(schema, { target: "draft-2020-12" });
@@ -17764,6 +17764,7 @@ var RecappiApiClient = class {
17764
17764
  this.env = opts.env ?? process.env;
17765
17765
  this.homeDir = opts.homeDir;
17766
17766
  }
17767
+ auth;
17767
17768
  fetchImpl;
17768
17769
  sleep;
17769
17770
  env;
@@ -19333,6 +19334,8 @@ function readCliVersion() {
19333
19334
  var CLI_VERSION = readCliVersion();
19334
19335
 
19335
19336
  // src/record.tsx
19337
+ import { chmodSync, existsSync, statSync } from "fs";
19338
+ import { fileURLToPath } from "url";
19336
19339
  import { render, useInput as useInput2 } from "ink";
19337
19340
 
19338
19341
  // src/sidecar.ts
@@ -19521,6 +19524,7 @@ function defaultSidecarHandshakeParams(params) {
19521
19524
  init_LiveCaptionsScreen();
19522
19525
  import { jsx as jsx3 } from "react/jsx-runtime";
19523
19526
  var SIDECAR_COMMAND_ENV = "RECAPPI_MINI_SIDECAR";
19527
+ var SIDECAR_HELPER_NAME = "RecappiMiniSidecar";
19524
19528
  async function recordViaSidecar(opts) {
19525
19529
  let liveRenderer;
19526
19530
  let session;
@@ -19608,6 +19612,7 @@ async function startRecordSession(opts) {
19608
19612
  capabilities: opts.live ? ["recording.capture", "recording.upload", "live_captions.stream"] : ["recording.capture", "recording.upload"]
19609
19613
  })
19610
19614
  );
19615
+ assertSidecarCapabilities(handshake, opts);
19611
19616
  const started = await sidecar.client.startRecording({
19612
19617
  account,
19613
19618
  options: {
@@ -19659,14 +19664,59 @@ async function startRecordSession(opts) {
19659
19664
  throw error51;
19660
19665
  }
19661
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
+ }
19662
19681
  function resolveSidecarCommand(opts) {
19663
19682
  const command = opts.sidecarCommand?.trim() || opts.env?.[SIDECAR_COMMAND_ENV]?.trim();
19664
- if (!command) {
19665
- throw cliError("usage.invalid_argument", "Missing Recappi Mini sidecar command.", {
19666
- hint: `Pass --sidecar-command, or set ${SIDECAR_COMMAND_ENV} to the Mini sidecar executable.`
19683
+ if (command) return command;
19684
+ const bundled = bundledSidecarCommand(process.platform, process.arch);
19685
+ if (bundled && existsSync(bundled)) return ensureBundledHelperExecutable(bundled);
19686
+ const platform = `${process.platform}-${process.arch}`;
19687
+ if (bundled) {
19688
+ throw cliError("usage.invalid_argument", "Recappi recording helper is not available.", {
19689
+ hint: `Expected bundled helper for ${platform} at ${bundled}. Reinstall recappi, or set ${SIDECAR_COMMAND_ENV} to a compatible helper.`
19690
+ });
19691
+ }
19692
+ throw cliError("usage.invalid_argument", "Recappi recording is not supported on this platform yet.", {
19693
+ hint: `No bundled helper is registered for ${platform}. Set ${SIDECAR_COMMAND_ENV} to a compatible helper when one is available.`
19694
+ });
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.`
19667
19706
  });
19668
19707
  }
19669
- return command;
19708
+ return path6;
19709
+ }
19710
+ function bundledSidecarCommand(platform, arch) {
19711
+ const executable = helperExecutableName(platform);
19712
+ if (!executable) return null;
19713
+ const packageRoot = new URL("..", import.meta.url);
19714
+ return fileURLToPath(new URL(`helpers/${platform}-${arch}/${executable}`, packageRoot));
19715
+ }
19716
+ function helperExecutableName(platform) {
19717
+ if (platform === "darwin") return SIDECAR_HELPER_NAME;
19718
+ if (platform === "win32") return `${SIDECAR_HELPER_NAME}.exe`;
19719
+ return null;
19670
19720
  }
19671
19721
  function persistArtifacts(artifacts, account, opts) {
19672
19722
  if (artifacts.length === 0) return;