@hasna/recordings 0.4.0 → 0.5.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.
Files changed (58) hide show
  1. package/README.md +56 -6
  2. package/contracts/v1/fixtures.json +1206 -0
  3. package/dist/cli/index.js +28 -7
  4. package/dist/contracts/hosted-v1.d.ts +105 -0
  5. package/dist/contracts/hosted-v1.d.ts.map +1 -0
  6. package/dist/contracts/hosted-v1.js +41 -0
  7. package/dist/contracts/stream-v1.d.ts +117 -0
  8. package/dist/contracts/stream-v1.d.ts.map +1 -0
  9. package/dist/contracts/stream-v1.js +35 -0
  10. package/dist/hosted/index.d.ts +58 -0
  11. package/dist/hosted/index.d.ts.map +1 -0
  12. package/dist/hosted/index.js +266 -0
  13. package/dist/hosted/transport.d.ts +36 -0
  14. package/dist/hosted/transport.d.ts.map +1 -0
  15. package/dist/hosted-v1-aavn7ktb.js +4114 -0
  16. package/dist/hosted-v1-gdr9extc.js +84 -0
  17. package/dist/index.js +27 -6
  18. package/dist/mcp/index.js +27 -6
  19. package/dist/server/index.js +27 -6
  20. package/dist/storage.js +27 -6
  21. package/docs/hosted-sdk.md +71 -0
  22. package/docs/wire-contracts.md +24 -0
  23. package/package.json +27 -6
  24. package/scripts/ci-linux-suite.ts +23 -13
  25. package/scripts/macos_artifact.ts +40 -33
  26. package/scripts/native/prebuilds/darwin-universal/recordings_fs_guard.node +0 -0
  27. package/scripts/native/recordings_fs_guard.c +36 -4
  28. package/scripts/native-core-receipt.py +171 -0
  29. package/scripts/native_fs_guard.ts +2 -0
  30. package/scripts/release-suite-gate.ts +227 -150
  31. package/scripts/resolve_tailscale_cli.sh +24 -3
  32. package/src/native/Recordings/RecordingsLib/BlockingOperation.swift +29 -0
  33. package/src/native/Recordings/RecordingsLib/Info.plist +2 -2
  34. package/src/native/Recordings/RecordingsLib/ProjectStore.swift +4 -4
  35. package/src/native/Recordings/RecordingsLib/RecordingEngine.swift +228 -60
  36. package/src/native/Recordings/RecordingsLib/RecordingPasteTarget.swift +114 -0
  37. package/src/native/Recordings/RecordingsLib/RecordingProvider.swift +13 -3
  38. package/src/native/Recordings/RecordingsTests/BlockingOperationTests.swift +85 -0
  39. package/src/native/Recordings/RecordingsTests/CLIRunnerTests.swift +441 -72
  40. package/src/native/Recordings/RecordingsTests/PipeClosureFixture.swift +215 -0
  41. package/src/native/Recordings/RecordingsTests/ProjectStoreTests.swift +10 -10
  42. package/src/native/Recordings/RecordingsTests/RecordingEngineDeliveryTests.swift +1 -1
  43. package/src/native/Recordings/RecordingsTests/RecordingFrozenPasteTargetTests.swift +50 -0
  44. package/src/native/Recordings/RecordingsTests/RecordingPasteTargetTrackerTests.swift +48 -0
  45. package/src/native/Recordings/RecordingsTests/RecordingProviderTests.swift +115 -2
  46. package/src/native/Recordings/RecordingsTests/RecordingStartTimingTests.swift +93 -21
  47. package/src/native/Recordings/RecordingsTests/TestHomeDirectory.swift +5 -1
  48. package/src/native/Recordings/build.sh +2 -1
  49. package/dist/__tests__/helpers/installer-guard-execution.d.ts +0 -22
  50. package/dist/__tests__/helpers/installer-guard-execution.d.ts.map +0 -1
  51. package/dist/__tests__/helpers/installer-preflight.d.ts +0 -22
  52. package/dist/__tests__/helpers/installer-preflight.d.ts.map +0 -1
  53. package/dist/__tests__/helpers/native-fs-guard.d.ts +0 -2
  54. package/dist/__tests__/helpers/native-fs-guard.d.ts.map +0 -1
  55. package/dist/__tests__/helpers/source-assertions.d.ts +0 -171
  56. package/dist/__tests__/helpers/source-assertions.d.ts.map +0 -1
  57. package/dist/__tests__/preload.d.ts +0 -2
  58. package/dist/__tests__/preload.d.ts.map +0 -1
package/dist/cli/index.js CHANGED
@@ -1919,7 +1919,7 @@ function setAgentFocus(idOrName, projectId, db) {
1919
1919
  // package.json
1920
1920
  var package_default = {
1921
1921
  name: "@hasna/recordings",
1922
- version: "0.4.0",
1922
+ version: "0.5.0",
1923
1923
  type: "module",
1924
1924
  description: "Speech-to-text recording tool with MCP and CLI \u2014 records, transcribes, and optionally enhances text using AI",
1925
1925
  repository: {
@@ -1945,6 +1945,19 @@ var package_default = {
1945
1945
  "./sdk": {
1946
1946
  import: "./dist/sdk/index.js",
1947
1947
  types: "./dist/sdk/index.d.ts"
1948
+ },
1949
+ "./contracts/hosted-v1": {
1950
+ import: "./dist/contracts/hosted-v1.js",
1951
+ types: "./dist/contracts/hosted-v1.d.ts"
1952
+ },
1953
+ "./contracts/stream-v1": {
1954
+ import: "./dist/contracts/stream-v1.js",
1955
+ types: "./dist/contracts/stream-v1.d.ts"
1956
+ },
1957
+ "./contracts/fixtures/v1": "./contracts/v1/fixtures.json",
1958
+ "./hosted": {
1959
+ import: "./dist/hosted/index.js",
1960
+ types: "./dist/hosted/index.d.ts"
1948
1961
  }
1949
1962
  },
1950
1963
  engines: {
@@ -1956,17 +1969,17 @@ var package_default = {
1956
1969
  "build:cli": "bun build src/cli/index.ts --target=bun --outfile=dist/cli/index.js --external=commander --external=chalk --external=openai --external=@aws-sdk/client-s3",
1957
1970
  "build:mcp": "bun build src/mcp/index.ts --target=bun --outfile=dist/mcp/index.js --external=@modelcontextprotocol/sdk --external=openai --external=@aws-sdk/client-s3",
1958
1971
  "build:serve": "bun build src/server/index.ts --target=bun --outfile=dist/server/index.js --external=@modelcontextprotocol/sdk --external=@hasna/contracts --external=openai --external=pg --external=@aws-sdk/client-s3",
1959
- "build:lib": "bun build src/index.ts src/storage.ts src/sdk/index.ts --target=bun --outdir=dist --external=openai --external=@aws-sdk/client-s3",
1972
+ "build:lib": "bun build src/index.ts src/storage.ts src/sdk/index.ts --target=bun --outdir=dist --external=openai --external=@aws-sdk/client-s3 && bun run build:contracts",
1960
1973
  "build:native-fs-guard": "/bin/bash scripts/build_native_fs_guard.sh",
1961
1974
  "generate:sdk": "bun run scripts/generate-sdk.ts",
1962
1975
  migrate: "bun run scripts/migrate.ts",
1963
1976
  typecheck: "tsc --noEmit",
1964
1977
  "typecheck:tcc-contract": "tsc --noEmit -p tsconfig.tcc-contract.json",
1965
- test: "bun test",
1978
+ test: "bun scripts/release-suite-gate.ts --all",
1966
1979
  "verify:ci-suite": "bun scripts/ci-linux-suite.ts --check",
1967
1980
  "verify:ci-suite:run": "bun scripts/ci-linux-suite.ts --verify-run",
1968
1981
  "verify:ci-native": "bun scripts/ci-native-build.ts",
1969
- "test:gated": 'bun scripts/ci-linux-suite.ts --check && RECORDINGS_TEST_TIMEOUT_MS="${RECORDINGS_TEST_TIMEOUT_MS:-120000}" bun test --timeout "${RECORDINGS_TEST_TIMEOUT_MS:-120000}" $(bun scripts/ci-linux-suite.ts --gated)',
1982
+ "test:gated": "bun scripts/release-suite-gate.ts",
1970
1983
  "test:vacuity-battery": 'bun scripts/vacuity-manifest-gen.ts > "${TMPDIR:-/tmp}/vacuity-corrupt-sites.tsv" && bun scripts/vacuity-mutation-battery.ts "${TMPDIR:-/tmp}/vacuity-corrupt-sites.tsv"',
1971
1984
  "test:vacuity-battery:source": "bun scripts/vacuity-mutation-battery.ts scripts/vacuity-manifests/source-side.tsv",
1972
1985
  "test:vacuity-battery:chain": "bun scripts/vacuity-mutation-battery.ts scripts/vacuity-manifests/install-chain.tsv",
@@ -1984,11 +1997,16 @@ var package_default = {
1984
1997
  "prepack:platform-gate": `bash -c 'if [ "$(uname -s)" = Darwin ]; then bun run build:native-fs-guard; else echo "WARN: native fs-guard build skipped on $(uname -s) \u2014 dry-run/CI pack; publish recordings from macOS"; fi'`,
1985
1998
  prepublishOnly: "bun run typecheck && bun run release-suite-gate",
1986
1999
  "release-suite-gate": "bun run scripts/release-suite-gate.ts",
1987
- "typecheck:shortcut-contract": "tsc --noEmit -p tsconfig.test.json"
2000
+ "typecheck:shortcut-contract": "tsc --noEmit -p tsconfig.test.json",
2001
+ "build:contracts": "bun build src/contracts/hosted-v1.ts src/contracts/stream-v1.ts src/hosted/index.ts --target=bun --root src --outdir=dist --splitting --external=@hasna/contracts"
1988
2002
  },
1989
2003
  files: [
1990
2004
  "dist/",
2005
+ "!dist/__tests__/",
1991
2006
  "scripts/",
2007
+ "!scripts/test-recorder-fixtures.ts",
2008
+ "!scripts/**/__pycache__/",
2009
+ "!scripts/**/*.pyc",
1992
2010
  "Dockerfile.package",
1993
2011
  "bun.lock",
1994
2012
  "src/native/Recordings/App/",
@@ -2000,7 +2018,10 @@ var package_default = {
2000
2018
  "src/native/Recordings/build.sh",
2001
2019
  "packaging/macos/",
2002
2020
  "README.md",
2003
- "LICENSE"
2021
+ "LICENSE",
2022
+ "contracts/v1/fixtures.json",
2023
+ "docs/wire-contracts.md",
2024
+ "docs/hosted-sdk.md"
2004
2025
  ],
2005
2026
  dependencies: {
2006
2027
  "@aws-sdk/client-s3": "^3.1007.0",
@@ -7481,7 +7502,7 @@ appCommand.command("permissions").description("Show macOS permission state for H
7481
7502
  installed_app_path: status.installed_app_path,
7482
7503
  installed: status.installed,
7483
7504
  legacy_install_paths: status.legacy_install_paths,
7484
- permission_subject: describeTccAuthorizationSubject(status.installed_app_path),
7505
+ permission_subject: describeTccAuthorizationSubject(status.installed ? status.installed_app_path : null),
7485
7506
  microphone: status.microphone_permission,
7486
7507
  accessibility: status.accessibility_permission,
7487
7508
  app_code_hash: status.app_code_hash,
@@ -0,0 +1,105 @@
1
+ import { type ContractParser, type JSONValue } from "./stream-v1.js";
2
+ export type { ContractParser, ContractResult, JSONValue } from "./stream-v1.js";
3
+ export { ContractValidationError } from "./stream-v1.js";
4
+ export interface HostedRecordingInput {
5
+ id: string;
6
+ sessionId?: string;
7
+ title: string;
8
+ transcript: string;
9
+ durationMs: number;
10
+ }
11
+ export interface HostedRecording extends HostedRecordingInput {
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ provenance?: Record<string, JSONValue>;
15
+ [key: string]: unknown;
16
+ }
17
+ export interface HostedPasteInput {
18
+ id: string;
19
+ recordingId?: string | null;
20
+ text: string;
21
+ destinationAppId?: string;
22
+ destinationAppName?: string;
23
+ status: "attempted" | "confirmed" | "failed";
24
+ occurredAt?: string;
25
+ }
26
+ export interface HostedPasteReceipt extends HostedPasteInput {
27
+ recordingId: string | null;
28
+ occurredAt: string;
29
+ createdAt: string;
30
+ updatedAt: string;
31
+ /** Reported by the client; the server does not independently observe the paste target. */
32
+ evidenceSource: "client_reported";
33
+ [key: string]: unknown;
34
+ }
35
+ export interface HostedAccount {
36
+ id: string;
37
+ displayName: string;
38
+ email: string;
39
+ createdAt: string;
40
+ [key: string]: unknown;
41
+ }
42
+ export interface HostedPageOptions {
43
+ limit?: number;
44
+ before?: string;
45
+ beforeId?: string;
46
+ }
47
+ export interface HostedAccountResponse {
48
+ account: HostedAccount;
49
+ wireVersion?: string;
50
+ capabilities?: string[];
51
+ [key: string]: unknown;
52
+ }
53
+ export interface HostedVersionResponse {
54
+ name: "recordings";
55
+ version: string;
56
+ apiVersion: "v1";
57
+ wireVersion?: string;
58
+ capabilities?: string[];
59
+ [key: string]: unknown;
60
+ }
61
+ export interface HostedHealthResponse {
62
+ status: "ok";
63
+ [key: string]: unknown;
64
+ }
65
+ export interface HostedReadyResponse {
66
+ status: "ready";
67
+ [key: string]: unknown;
68
+ }
69
+ export declare const recordingInputParser: ContractParser<HostedRecordingInput>;
70
+ export declare const recordingParser: ContractParser<HostedRecording>;
71
+ export declare const pasteInputParser: ContractParser<HostedPasteInput>;
72
+ export declare const pasteReceiptParser: ContractParser<HostedPasteReceipt>;
73
+ export declare const pageOptionsParser: ContractParser<HostedPageOptions>;
74
+ export declare const bootstrapInputParser: ContractParser<Record<string, never>>;
75
+ export declare const renameInputParser: ContractParser<{
76
+ title: string;
77
+ }>;
78
+ export declare const accountResponseParser: ContractParser<HostedAccountResponse>;
79
+ export declare const versionResponseParser: ContractParser<HostedVersionResponse>;
80
+ export declare const healthResponseParser: ContractParser<HostedHealthResponse>;
81
+ export declare const readyResponseParser: ContractParser<HostedReadyResponse>;
82
+ export declare const recordingResponseParser: ContractParser<{
83
+ recording: HostedRecording;
84
+ [key: string]: unknown;
85
+ }>;
86
+ export declare const recordingListParser: ContractParser<{
87
+ recordings: HostedRecording[];
88
+ [key: string]: unknown;
89
+ }>;
90
+ export declare const pasteResponseParser: ContractParser<{
91
+ receipt: HostedPasteReceipt;
92
+ [key: string]: unknown;
93
+ }>;
94
+ export declare const pasteListParser: ContractParser<{
95
+ receipts: HostedPasteReceipt[];
96
+ [key: string]: unknown;
97
+ }>;
98
+ export declare const pendingDeletionParser: ContractParser<{
99
+ audioCleanup: {
100
+ state: "pending";
101
+ [key: string]: unknown;
102
+ };
103
+ [key: string]: unknown;
104
+ }>;
105
+ //# sourceMappingURL=hosted-v1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-v1.d.ts","sourceRoot":"","sources":["../../src/contracts/hosted-v1.ts"],"names":[],"mappings":"AACA,OAAO,EAAoE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACvI,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE;AAC/H,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAAG,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE;AACtK,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,gBAAgB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,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAA+D,CAAC;AAC1K,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAA+B,CAAC;AACxI,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC;IAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAA2D,CAAC;AACnK,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC;IAAE,YAAY,EAAE;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAA6E,CAAC"}
@@ -0,0 +1,41 @@
1
+ // @bun
2
+ import {
3
+ accountResponseParser,
4
+ bootstrapInputParser,
5
+ healthResponseParser,
6
+ pageOptionsParser,
7
+ pasteInputParser,
8
+ pasteListParser,
9
+ pasteReceiptParser,
10
+ pasteResponseParser,
11
+ pendingDeletionParser,
12
+ readyResponseParser,
13
+ recordingInputParser,
14
+ recordingListParser,
15
+ recordingParser,
16
+ recordingResponseParser,
17
+ renameInputParser,
18
+ versionResponseParser
19
+ } from "../hosted-v1-gdr9extc.js";
20
+ import {
21
+ ContractValidationError
22
+ } from "../hosted-v1-aavn7ktb.js";
23
+ export {
24
+ versionResponseParser,
25
+ renameInputParser,
26
+ recordingResponseParser,
27
+ recordingParser,
28
+ recordingListParser,
29
+ recordingInputParser,
30
+ readyResponseParser,
31
+ pendingDeletionParser,
32
+ pasteResponseParser,
33
+ pasteReceiptParser,
34
+ pasteListParser,
35
+ pasteInputParser,
36
+ pageOptionsParser,
37
+ healthResponseParser,
38
+ bootstrapInputParser,
39
+ accountResponseParser,
40
+ ContractValidationError
41
+ };
@@ -0,0 +1,117 @@
1
+ /** Public wire values only. Implementations own transport, credentials and session state. */
2
+ export type JSONValue = null | boolean | number | string | JSONValue[] | {
3
+ [key: string]: JSONValue;
4
+ };
5
+ export type ContractResult<T> = {
6
+ success: true;
7
+ data: T;
8
+ } | {
9
+ success: false;
10
+ error: {
11
+ code: "invalid_contract";
12
+ };
13
+ };
14
+ export interface ContractParser<T> {
15
+ parse(value: unknown): T;
16
+ safeParse(value: unknown): ContractResult<T>;
17
+ }
18
+ /** Never retains the rejected input, schema issues, a cause or a server message. */
19
+ export declare class ContractValidationError extends Error {
20
+ readonly code = "invalid_contract";
21
+ constructor();
22
+ }
23
+ export declare const WIRE_VERSION: "1.0";
24
+ export declare const REQUIRED_CAPABILITIES: readonly ["version-negotiation", "pcm-s16le-24000-mono", "audio-ack", "session-authorize"];
25
+ export declare const PCM_FORMAT: Readonly<{
26
+ readonly encoding: "pcm_s16le";
27
+ readonly sampleRateHz: 24000;
28
+ readonly channels: 1;
29
+ }>;
30
+ export declare const MAX_PCM_FRAME_BYTES = 24000;
31
+ export declare const MAX_PCM_BYTES = 86400000;
32
+ export declare const MAX_CONTROL_BYTES = 20000;
33
+ export interface WireMetadata {
34
+ wireVersion: string;
35
+ capabilities: string[];
36
+ }
37
+ export interface StreamStart {
38
+ type: "session.start";
39
+ sessionId: string;
40
+ model?: string;
41
+ language?: string;
42
+ wireVersion?: string;
43
+ capabilities?: string[];
44
+ }
45
+ export type StreamControl = StreamStart | {
46
+ type: "input.finish";
47
+ } | {
48
+ type: "session.cancel";
49
+ } | {
50
+ type: "session.authorize";
51
+ accessToken: string;
52
+ };
53
+ export interface StreamSegment {
54
+ id: string;
55
+ text: string;
56
+ startSecond?: number;
57
+ endSecond?: number;
58
+ [key: string]: unknown;
59
+ }
60
+ export interface StreamTranscript {
61
+ sessionId: string;
62
+ text: string;
63
+ segments?: StreamSegment[];
64
+ provenance?: Record<string, JSONValue>;
65
+ [key: string]: unknown;
66
+ }
67
+ interface EventBase {
68
+ sessionId: string;
69
+ sequence?: number;
70
+ [key: string]: unknown;
71
+ }
72
+ export interface AudioAccepted extends EventBase {
73
+ type: "audio.accepted";
74
+ bytes: number;
75
+ totalBytes: number;
76
+ }
77
+ export type StreamEvent = (EventBase & {
78
+ type: "session.ready";
79
+ format: typeof PCM_FORMAT;
80
+ maxInFlightAudioBytes?: number;
81
+ maxAudioDurationMs?: number;
82
+ expiresAt?: number;
83
+ wireVersion?: string;
84
+ capabilities?: string[];
85
+ }) | AudioAccepted | (EventBase & {
86
+ type: "session.authorized";
87
+ expiresAt: number;
88
+ }) | (EventBase & {
89
+ type: "partial" | "committed";
90
+ segment: StreamSegment;
91
+ }) | (EventBase & {
92
+ type: "final";
93
+ transcript: StreamTranscript;
94
+ recordingId?: string;
95
+ }) | (EventBase & {
96
+ type: "error";
97
+ code: string;
98
+ message?: string;
99
+ requestId?: string;
100
+ });
101
+ export declare const recordingIDParser: ContractParser<string>;
102
+ export declare const wireMetadataParser: ContractParser<WireMetadata>;
103
+ /** Absence is legacy v1. An explicit advertisement must be complete and compatible. */
104
+ export declare function optionalWireMetadata(value: {
105
+ wireVersion?: unknown;
106
+ capabilities?: unknown;
107
+ }): WireMetadata | undefined;
108
+ /** A decoded JSON control object; use parseStreamControlJSON for the byte-limited wire message. */
109
+ export declare const streamControlParser: ContractParser<StreamControl>;
110
+ export declare function parseStreamControlJSON(message: string): StreamControl;
111
+ export declare const streamEventParser: ContractParser<StreamEvent>;
112
+ /** No conversion, copy or cumulative accounting. The caller owns the session's total/buffer limits. */
113
+ export declare const pcmFrameParser: ContractParser<Uint8Array>;
114
+ /** Pure readback check; does not mutate counters or acknowledge unsent audio. */
115
+ export declare function acceptsAudioAcknowledgement(event: AudioAccepted, sentBytes: number, acknowledgedBytes: number): boolean;
116
+ export {};
117
+ //# sourceMappingURL=stream-v1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-v1.d.ts","sourceRoot":"","sources":["../../src/contracts/stream-v1.ts"],"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AE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAIvH"}
@@ -0,0 +1,35 @@
1
+ // @bun
2
+ import {
3
+ ContractValidationError,
4
+ MAX_CONTROL_BYTES,
5
+ MAX_PCM_BYTES,
6
+ MAX_PCM_FRAME_BYTES,
7
+ PCM_FORMAT,
8
+ REQUIRED_CAPABILITIES,
9
+ WIRE_VERSION,
10
+ acceptsAudioAcknowledgement,
11
+ optionalWireMetadata,
12
+ parseStreamControlJSON,
13
+ pcmFrameParser,
14
+ recordingIDParser,
15
+ streamControlParser,
16
+ streamEventParser,
17
+ wireMetadataParser
18
+ } from "../hosted-v1-aavn7ktb.js";
19
+ export {
20
+ wireMetadataParser,
21
+ streamEventParser,
22
+ streamControlParser,
23
+ recordingIDParser,
24
+ pcmFrameParser,
25
+ parseStreamControlJSON,
26
+ optionalWireMetadata,
27
+ acceptsAudioAcknowledgement,
28
+ WIRE_VERSION,
29
+ REQUIRED_CAPABILITIES,
30
+ PCM_FORMAT,
31
+ MAX_PCM_FRAME_BYTES,
32
+ MAX_PCM_BYTES,
33
+ MAX_CONTROL_BYTES,
34
+ ContractValidationError
35
+ };
@@ -0,0 +1,58 @@
1
+ import * as contract from "../contracts/hosted-v1.js";
2
+ import { type ClientOptions, type RequestOptions } from "./transport.js";
3
+ export { RecordingsSDKError, type SDKErrorCode, type CredentialProvider, type ClientOptions, type RequestOptions } from "./transport.js";
4
+ export type { HostedRecordingInput as RecordingInput, HostedRecording as Recording, HostedPasteInput as PasteInput, HostedPasteReceipt as PasteReceipt, HostedAccount as Account, HostedAccountResponse as AccountResponse, HostedPageOptions as PageOptions } from "../contracts/hosted-v1.js";
5
+ export interface Cursor {
6
+ before: string;
7
+ beforeId: string;
8
+ }
9
+ export type DeletionResult = {
10
+ state: "removed";
11
+ } | {
12
+ state: "pending";
13
+ };
14
+ /** Explicit cursor for the last received row. No extra request or inferred total. */
15
+ export declare const recordingCursor: (last: contract.HostedRecording) => Cursor;
16
+ export declare const pasteCursor: (last: contract.HostedPasteReceipt) => Cursor;
17
+ /** Hosted JSON API adapter. No native control, ambient login or automatic retry. */
18
+ export declare class HostedRecordingsClient {
19
+ #private;
20
+ constructor(options: ClientOptions);
21
+ get apiBase(): string;
22
+ health(options?: RequestOptions): Promise<contract.HostedHealthResponse>;
23
+ version(options?: RequestOptions): Promise<contract.HostedVersionResponse>;
24
+ ready(options?: RequestOptions): Promise<contract.HostedReadyResponse>;
25
+ account(options?: RequestOptions): Promise<contract.HostedAccountResponse>;
26
+ /** Caller owns broker OAuth/PKCE. Profile authority comes from the opaque bearer session. */
27
+ bootstrap(options?: RequestOptions): Promise<contract.HostedAccountResponse>;
28
+ logout(options?: RequestOptions): Promise<void>;
29
+ listRecordings(page?: contract.HostedPageOptions, options?: RequestOptions): Promise<{
30
+ [key: string]: unknown;
31
+ recordings: contract.HostedRecording[];
32
+ }>;
33
+ getRecording(id: string, options?: RequestOptions): Promise<{
34
+ [key: string]: unknown;
35
+ recording: contract.HostedRecording;
36
+ }>;
37
+ saveRecording(value: contract.HostedRecordingInput, options?: RequestOptions): Promise<{
38
+ [key: string]: unknown;
39
+ recording: contract.HostedRecording;
40
+ }>;
41
+ renameRecording(id: string, title: string, options?: RequestOptions): Promise<{
42
+ [key: string]: unknown;
43
+ recording: contract.HostedRecording;
44
+ }>;
45
+ /** Pending is durable deletion accepted, not completed audio purge. Repeat explicitly. */
46
+ deleteRecording(id: string, options?: RequestOptions): Promise<DeletionResult>;
47
+ listPasteReceipts(page?: contract.HostedPageOptions, options?: RequestOptions): Promise<{
48
+ [key: string]: unknown;
49
+ receipts: contract.HostedPasteReceipt[];
50
+ }>;
51
+ savePasteReceipt(value: contract.HostedPasteInput, options?: RequestOptions): Promise<{
52
+ [key: string]: unknown;
53
+ receipt: contract.HostedPasteReceipt;
54
+ }>;
55
+ deletePasteReceipt(id: string, options?: RequestOptions): Promise<void>;
56
+ clearPasteHistory(options?: RequestOptions): Promise<void>;
57
+ }
58
+ //# sourceM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