@vibesdotdev/media 0.0.0-stage → 1.0.0-rc.3
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/LICENSE +18 -0
- package/README.md +95 -2
- package/dist/analyzers/frame-guard.d.ts +6 -0
- package/dist/analyzers/frame-guard.d.ts.map +1 -0
- package/dist/analyzers/frame-guard.js +10 -0
- package/dist/analyzers/frame-guard.js.map +1 -0
- package/dist/analyzers/motion-math.d.ts +66 -0
- package/dist/analyzers/motion-math.d.ts.map +1 -0
- package/dist/analyzers/motion-math.js +356 -0
- package/dist/analyzers/motion-math.js.map +1 -0
- package/dist/analyzers/reference-motion-analyzer.impl.d.ts +23 -0
- package/dist/analyzers/reference-motion-analyzer.impl.d.ts.map +1 -0
- package/dist/analyzers/reference-motion-analyzer.impl.js +69 -0
- package/dist/analyzers/reference-motion-analyzer.impl.js.map +1 -0
- package/dist/analyzers/reference-motion.descriptor.d.ts +11 -0
- package/dist/analyzers/reference-motion.descriptor.d.ts.map +1 -0
- package/dist/analyzers/reference-motion.descriptor.js +21 -0
- package/dist/analyzers/reference-motion.descriptor.js.map +1 -0
- package/dist/capture-client.d.ts +34 -0
- package/dist/capture-client.d.ts.map +1 -0
- package/dist/capture-client.js +163 -0
- package/dist/capture-client.js.map +1 -0
- package/dist/config/media.uploads.config.descriptor.d.ts +27 -0
- package/dist/config/media.uploads.config.descriptor.d.ts.map +1 -0
- package/dist/config/media.uploads.config.descriptor.js +46 -0
- package/dist/config/media.uploads.config.descriptor.js.map +1 -0
- package/dist/config/uploads.d.ts +11 -0
- package/dist/config/uploads.d.ts.map +1 -0
- package/dist/config/uploads.js +25 -0
- package/dist/config/uploads.js.map +1 -0
- package/dist/docs/artifact-references.docs.descriptor.d.ts +4 -0
- package/dist/docs/artifact-references.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/artifact-references.docs.descriptor.js +69 -0
- package/dist/docs/artifact-references.docs.descriptor.js.map +1 -0
- package/dist/docs/image-transform.docs.descriptor.d.ts +4 -0
- package/dist/docs/image-transform.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/image-transform.docs.descriptor.js +52 -0
- package/dist/docs/image-transform.docs.descriptor.js.map +1 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/capture-provider.d.ts +33 -0
- package/dist/interfaces/capture-provider.d.ts.map +1 -0
- package/dist/interfaces/capture-provider.js +10 -0
- package/dist/interfaces/capture-provider.js.map +1 -0
- package/dist/interfaces/image-transformer.d.ts +7 -0
- package/dist/interfaces/image-transformer.d.ts.map +1 -0
- package/dist/interfaces/image-transformer.js +2 -0
- package/dist/interfaces/image-transformer.js.map +1 -0
- package/dist/interfaces/index.d.ts +7 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +5 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/motion-analyzer.d.ts +55 -0
- package/dist/interfaces/motion-analyzer.d.ts.map +1 -0
- package/dist/interfaces/motion-analyzer.js +14 -0
- package/dist/interfaces/motion-analyzer.js.map +1 -0
- package/dist/kinds/capture.d.ts +58 -0
- package/dist/kinds/capture.d.ts.map +1 -0
- package/dist/kinds/capture.js +34 -0
- package/dist/kinds/capture.js.map +1 -0
- package/dist/kinds/image-transform.d.ts +91 -0
- package/dist/kinds/image-transform.d.ts.map +1 -0
- package/dist/kinds/image-transform.js +12 -0
- package/dist/kinds/image-transform.js.map +1 -0
- package/dist/kinds/index.d.ts +10 -0
- package/dist/kinds/index.d.ts.map +1 -0
- package/dist/kinds/index.js +7 -0
- package/dist/kinds/index.js.map +1 -0
- package/dist/kinds/motion.d.ts +57 -0
- package/dist/kinds/motion.d.ts.map +1 -0
- package/dist/kinds/motion.js +34 -0
- package/dist/kinds/motion.js.map +1 -0
- package/dist/media.plugin.d.ts +23 -0
- package/dist/media.plugin.d.ts.map +1 -0
- package/dist/media.plugin.js +48 -0
- package/dist/media.plugin.js.map +1 -0
- package/dist/schemas/artifact-reference.d.ts +59 -0
- package/dist/schemas/artifact-reference.d.ts.map +1 -0
- package/dist/schemas/artifact-reference.js +77 -0
- package/dist/schemas/artifact-reference.js.map +1 -0
- package/dist/schemas/capture-descriptor.d.ts +71 -0
- package/dist/schemas/capture-descriptor.d.ts.map +1 -0
- package/dist/schemas/capture-descriptor.js +74 -0
- package/dist/schemas/capture-descriptor.js.map +1 -0
- package/dist/schemas/capture-options.d.ts +51 -0
- package/dist/schemas/capture-options.d.ts.map +1 -0
- package/dist/schemas/capture-options.js +68 -0
- package/dist/schemas/capture-options.js.map +1 -0
- package/dist/schemas/capture-parse.d.ts +10 -0
- package/dist/schemas/capture-parse.d.ts.map +1 -0
- package/dist/schemas/capture-parse.js +30 -0
- package/dist/schemas/capture-parse.js.map +1 -0
- package/dist/schemas/capture-state.d.ts +77 -0
- package/dist/schemas/capture-state.d.ts.map +1 -0
- package/dist/schemas/capture-state.js +25 -0
- package/dist/schemas/capture-state.js.map +1 -0
- package/dist/schemas/image-transform.d.ts +269 -0
- package/dist/schemas/image-transform.d.ts.map +1 -0
- package/dist/schemas/image-transform.js +161 -0
- package/dist/schemas/image-transform.js.map +1 -0
- package/dist/schemas/index.d.ts +20 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +17 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/motion-analysis.d.ts +187 -0
- package/dist/schemas/motion-analysis.d.ts.map +1 -0
- package/dist/schemas/motion-analysis.js +213 -0
- package/dist/schemas/motion-analysis.js.map +1 -0
- package/dist/schemas/motion-descriptor.d.ts +53 -0
- package/dist/schemas/motion-descriptor.d.ts.map +1 -0
- package/dist/schemas/motion-descriptor.js +47 -0
- package/dist/schemas/motion-descriptor.js.map +1 -0
- package/dist/schemas/motion-frame.d.ts +63 -0
- package/dist/schemas/motion-frame.d.ts.map +1 -0
- package/dist/schemas/motion-frame.js +86 -0
- package/dist/schemas/motion-frame.js.map +1 -0
- package/dist/schemas/opaque-id.d.ts +10 -0
- package/dist/schemas/opaque-id.d.ts.map +1 -0
- package/dist/schemas/opaque-id.js +24 -0
- package/dist/schemas/opaque-id.js.map +1 -0
- package/dist/schemas/sharing-state.d.ts +43 -0
- package/dist/schemas/sharing-state.d.ts.map +1 -0
- package/dist/schemas/sharing-state.js +11 -0
- package/dist/schemas/sharing-state.js.map +1 -0
- package/dist/svelte/CaptureLoader.svelte +29 -0
- package/dist/svelte/CaptureLoader.svelte.d.ts +11 -0
- package/dist/svelte/CaptureLoader.svelte.d.ts.map +1 -0
- package/dist/svelte/CapturePanel.svelte +189 -0
- package/dist/svelte/CapturePanel.svelte.d.ts +12 -0
- package/dist/svelte/CapturePanel.svelte.d.ts.map +1 -0
- package/dist/svelte/MediaUploader.svelte +109 -0
- package/dist/svelte/MediaUploader.svelte.d.ts +5 -0
- package/dist/svelte/MediaUploader.svelte.d.ts.map +1 -0
- package/dist/svelte/capture-parse.d.ts +2 -0
- package/dist/svelte/capture-parse.d.ts.map +1 -0
- package/dist/svelte/capture-parse.js +1 -0
- package/dist/svelte/failure-message.d.ts +2 -0
- package/dist/svelte/failure-message.d.ts.map +1 -0
- package/dist/svelte/failure-message.js +1 -0
- package/dist/svelte/index.d.ts +8 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +6 -0
- package/dist/svelte/runtime-log.d.ts +14 -0
- package/dist/svelte/runtime-log.d.ts.map +1 -0
- package/dist/svelte/runtime-log.js +19 -0
- package/dist/svelte/runtime.d.ts +9 -0
- package/dist/svelte/runtime.d.ts.map +1 -0
- package/dist/svelte/runtime.js +27 -0
- package/dist/svelte/sharing/README.md +38 -0
- package/dist/svelte/sharing/components/ShareButton.svelte +57 -0
- package/dist/svelte/sharing/components/ShareButton.svelte.d.ts +11 -0
- package/dist/svelte/sharing/components/ShareButton.svelte.d.ts.map +1 -0
- package/dist/svelte/sharing/components/ShareDialog.svelte +222 -0
- package/dist/svelte/sharing/components/ShareDialog.svelte.d.ts +8 -0
- package/dist/svelte/sharing/components/ShareDialog.svelte.d.ts.map +1 -0
- package/dist/svelte/sharing/components/ShareLoader.svelte +19 -0
- package/dist/svelte/sharing/components/ShareLoader.svelte.d.ts +7 -0
- package/dist/svelte/sharing/components/ShareLoader.svelte.d.ts.map +1 -0
- package/dist/svelte/sharing/index.d.ts +20 -0
- package/dist/svelte/sharing/index.d.ts.map +1 -0
- package/dist/svelte/sharing/index.js +19 -0
- package/dist/svelte/sharing/runtime.d.ts +44 -0
- package/dist/svelte/sharing/runtime.d.ts.map +1 -0
- package/dist/svelte/sharing/runtime.js +81 -0
- package/dist/svelte/sharing/state.svelte.d.ts +28 -0
- package/dist/svelte/sharing/state.svelte.d.ts.map +1 -0
- package/dist/svelte/sharing/state.svelte.js +101 -0
- package/dist/svelte/sharing/styles.css +8 -0
- package/dist/svelte/state.svelte.d.ts +38 -0
- package/dist/svelte/state.svelte.d.ts.map +1 -0
- package/dist/svelte/state.svelte.js +102 -0
- package/dist/svelte/styles.css +2 -0
- package/dist/svelte/uploader.d.ts +17 -0
- package/dist/svelte/uploader.d.ts.map +1 -0
- package/dist/svelte/uploader.js +9 -0
- package/dist/uploads/adapters/local/index.d.ts +9 -0
- package/dist/uploads/adapters/local/index.d.ts.map +1 -0
- package/dist/uploads/adapters/local/index.js +12 -0
- package/dist/uploads/adapters/local/index.js.map +1 -0
- package/dist/uploads/adapters/local/local-storage.descriptor.d.ts +24 -0
- package/dist/uploads/adapters/local/local-storage.descriptor.d.ts.map +1 -0
- package/dist/uploads/adapters/local/local-storage.descriptor.js +20 -0
- package/dist/uploads/adapters/local/local-storage.descriptor.js.map +1 -0
- package/dist/uploads/adapters/local/local-storage.impl.d.ts +123 -0
- package/dist/uploads/adapters/local/local-storage.impl.d.ts.map +1 -0
- package/dist/uploads/adapters/local/local-storage.impl.js +231 -0
- package/dist/uploads/adapters/local/local-storage.impl.js.map +1 -0
- package/dist/uploads/adapters/local/uploads-adapter-local.plugin.d.ts +9 -0
- package/dist/uploads/adapters/local/uploads-adapter-local.plugin.d.ts.map +1 -0
- package/dist/uploads/adapters/local/uploads-adapter-local.plugin.js +41 -0
- package/dist/uploads/adapters/local/uploads-adapter-local.plugin.js.map +1 -0
- package/dist/uploads/client/helper.d.ts +26 -0
- package/dist/uploads/client/helper.d.ts.map +1 -0
- package/dist/uploads/client/helper.js +27 -0
- package/dist/uploads/client/helper.js.map +1 -0
- package/dist/uploads/client/index.d.ts +11 -0
- package/dist/uploads/client/index.d.ts.map +1 -0
- package/dist/uploads/client/index.js +9 -0
- package/dist/uploads/client/index.js.map +1 -0
- package/dist/uploads/client/sharing-client.d.ts +45 -0
- package/dist/uploads/client/sharing-client.d.ts.map +1 -0
- package/dist/uploads/client/sharing-client.js +153 -0
- package/dist/uploads/client/sharing-client.js.map +1 -0
- package/dist/uploads/client/uploads-client.d.ts +200 -0
- package/dist/uploads/client/uploads-client.d.ts.map +1 -0
- package/dist/uploads/client/uploads-client.js +487 -0
- package/dist/uploads/client/uploads-client.js.map +1 -0
- package/dist/uploads/docs/uploads.docs.descriptor.d.ts +4 -0
- package/dist/uploads/docs/uploads.docs.descriptor.d.ts.map +1 -0
- package/dist/uploads/docs/uploads.docs.descriptor.js +65 -0
- package/dist/uploads/docs/uploads.docs.descriptor.js.map +1 -0
- package/dist/uploads/docs/uploads.share-links.docs.descriptor.d.ts +22 -0
- package/dist/uploads/docs/uploads.share-links.docs.descriptor.d.ts.map +1 -0
- package/dist/uploads/docs/uploads.share-links.docs.descriptor.js +86 -0
- package/dist/uploads/docs/uploads.share-links.docs.descriptor.js.map +1 -0
- package/dist/uploads/index.d.ts +12 -0
- package/dist/uploads/index.d.ts.map +1 -0
- package/dist/uploads/index.js +13 -0
- package/dist/uploads/index.js.map +1 -0
- package/dist/uploads/schemas/common.d.ts +135 -0
- package/dist/uploads/schemas/common.d.ts.map +1 -0
- package/dist/uploads/schemas/common.js +152 -0
- package/dist/uploads/schemas/common.js.map +1 -0
- package/dist/uploads/schemas/forms.d.ts +59 -0
- package/dist/uploads/schemas/forms.d.ts.map +1 -0
- package/dist/uploads/schemas/forms.js +41 -0
- package/dist/uploads/schemas/forms.js.map +1 -0
- package/dist/uploads/schemas/index.d.ts +18 -0
- package/dist/uploads/schemas/index.d.ts.map +1 -0
- package/dist/uploads/schemas/index.js +13 -0
- package/dist/uploads/schemas/index.js.map +1 -0
- package/dist/uploads/schemas/records.d.ts +81 -0
- package/dist/uploads/schemas/records.d.ts.map +1 -0
- package/dist/uploads/schemas/records.js +82 -0
- package/dist/uploads/schemas/records.js.map +1 -0
- package/dist/uploads/schemas/requests.d.ts +32 -0
- package/dist/uploads/schemas/requests.d.ts.map +1 -0
- package/dist/uploads/schemas/requests.js +30 -0
- package/dist/uploads/schemas/requests.js.map +1 -0
- package/dist/uploads/schemas/shares.d.ts +67 -0
- package/dist/uploads/schemas/shares.d.ts.map +1 -0
- package/dist/uploads/schemas/shares.js +39 -0
- package/dist/uploads/schemas/shares.js.map +1 -0
- package/dist/uploads/server/backend.d.ts +8 -0
- package/dist/uploads/server/backend.d.ts.map +1 -0
- package/dist/uploads/server/backend.js +11 -0
- package/dist/uploads/server/backend.js.map +1 -0
- package/dist/uploads/server/config.d.ts +5 -0
- package/dist/uploads/server/config.d.ts.map +1 -0
- package/dist/uploads/server/config.js +38 -0
- package/dist/uploads/server/config.js.map +1 -0
- package/dist/uploads/server/service.d.ts +77 -0
- package/dist/uploads/server/service.d.ts.map +1 -0
- package/dist/uploads/server/service.js +152 -0
- package/dist/uploads/server/service.js.map +1 -0
- package/dist/uploads/server/storage-client.d.ts +11 -0
- package/dist/uploads/server/storage-client.d.ts.map +1 -0
- package/dist/uploads/server/storage-client.js +23 -0
- package/dist/uploads/server/storage-client.js.map +1 -0
- package/dist/uploads/server/storage.d.ts +40 -0
- package/dist/uploads/server/storage.d.ts.map +1 -0
- package/dist/uploads/server/storage.js +59 -0
- package/dist/uploads/server/storage.js.map +1 -0
- package/dist/uploads/uploads.plugin.d.ts +11 -0
- package/dist/uploads/uploads.plugin.d.ts.map +1 -0
- package/dist/uploads/uploads.plugin.js +89 -0
- package/dist/uploads/uploads.plugin.js.map +1 -0
- package/dist/utils/attempt.d.ts +27 -0
- package/dist/utils/attempt.d.ts.map +1 -0
- package/dist/utils/attempt.js +39 -0
- package/dist/utils/attempt.js.map +1 -0
- package/dist/utils/failure-message.d.ts +8 -0
- package/dist/utils/failure-message.d.ts.map +1 -0
- package/dist/utils/failure-message.js +28 -0
- package/dist/utils/failure-message.js.map +1 -0
- package/package.json +257 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `media/motion` Kind
|
|
3
|
+
*
|
|
4
|
+
* Runtime-kind definition for temporal-perception providers. Descriptors are
|
|
5
|
+
* resolved by `id` and filtered by `hardware` scope, mirroring `media/capture`.
|
|
6
|
+
* The reference provider (pure TS) declares both `consumer` and `cloud`, so a
|
|
7
|
+
* bare `runtime.query('media/motion')` resolves it in any scope; an accelerated
|
|
8
|
+
* provider registered for a narrower scope wins there.
|
|
9
|
+
*/
|
|
10
|
+
import { MotionAnalyzerDescriptorSchema } from "../schemas/motion-descriptor.js";
|
|
11
|
+
/** Kind id consumers pass to `runtime.query()`. */
|
|
12
|
+
export const MEDIA_MOTION_KIND_ID = 'media/motion';
|
|
13
|
+
/** Id of the built-in pure-TS reference analyzer that ships with this package. */
|
|
14
|
+
export const MEDIA_MOTION_REFERENCE_ID = 'media.motion.reference';
|
|
15
|
+
/**
|
|
16
|
+
* Runtime-kind shape for `media/motion`.
|
|
17
|
+
*
|
|
18
|
+
* Resolution: keep candidates whose `hardware` includes the active scope's
|
|
19
|
+
* hardware; return the first. Callers disambiguate by `id` via
|
|
20
|
+
* `runtime.query('media/motion').withId('...')`.
|
|
21
|
+
*/
|
|
22
|
+
export const mediaMotionKind = {
|
|
23
|
+
id: MEDIA_MOTION_KIND_ID,
|
|
24
|
+
descriptorSchema: MotionAnalyzerDescriptorSchema,
|
|
25
|
+
resolve(candidates, scope) {
|
|
26
|
+
if (candidates.length === 0)
|
|
27
|
+
return undefined;
|
|
28
|
+
const matching = candidates.filter((d) => d.hardware.includes(scope.hardware));
|
|
29
|
+
if (matching.length === 0)
|
|
30
|
+
return undefined;
|
|
31
|
+
return matching[0];
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=motion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.js","sourceRoot":"","sources":["../../src/kinds/motion.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACN,8BAA8B,EAE9B,MAAM,iCAAiC,CAAC;AAGzC,mDAAmD;AACnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAuB,CAAC;AAE5D,kFAAkF;AAClF,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAiC,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,EAAE,EAAE,oBAAoB;IACxB,gBAAgB,EAAE,8BAA8B;IAEhD,OAAO,CACN,UAAsC,EACtC,KAA2B;QAE3B,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAC9C,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/E,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAC5C,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Plugin
|
|
3
|
+
*
|
|
4
|
+
* Registers the media capture, image-transform, and motion runtime kinds. Provider packages
|
|
5
|
+
* (e.g. `@vibesdotdev/bridge`) register their own descriptors +
|
|
6
|
+
* implementations against this kind via their own plugins.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import mediaPlugin from '@vibesdotdev/media/plugin';
|
|
11
|
+
*
|
|
12
|
+
* await runtime.registerPlugin(mediaPlugin);
|
|
13
|
+
*
|
|
14
|
+
* const screen = await runtime
|
|
15
|
+
* .query('media/capture')
|
|
16
|
+
* .withId('bridge.screen')
|
|
17
|
+
* .resolve();
|
|
18
|
+
* const shot = await (screen as CaptureProvider).capture();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const _default: import("@vibesdotdev/kernel").RuntimePlugin;
|
|
22
|
+
export default _default;
|
|
23
|
+
//# sourceMappingURL=media.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.plugin.d.ts","sourceRoot":"","sources":["../src/media.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAUH,wBA0BG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Plugin
|
|
3
|
+
*
|
|
4
|
+
* Registers the media capture, image-transform, and motion runtime kinds. Provider packages
|
|
5
|
+
* (e.g. `@vibesdotdev/bridge`) register their own descriptors +
|
|
6
|
+
* implementations against this kind via their own plugins.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import mediaPlugin from '@vibesdotdev/media/plugin';
|
|
11
|
+
*
|
|
12
|
+
* await runtime.registerPlugin(mediaPlugin);
|
|
13
|
+
*
|
|
14
|
+
* const screen = await runtime
|
|
15
|
+
* .query('media/capture')
|
|
16
|
+
* .withId('bridge.screen')
|
|
17
|
+
* .resolve();
|
|
18
|
+
* const shot = await (screen as CaptureProvider).capture();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import { createRuntimePlugin, createRuntimeAsset, loader } from '@vibesdotdev/kernel';
|
|
22
|
+
import { mediaCaptureKind } from "./kinds/capture.js";
|
|
23
|
+
import { mediaMotionKind, MEDIA_MOTION_REFERENCE_ID } from "./kinds/motion.js";
|
|
24
|
+
import { mediaImageTransformKind } from "./kinds/image-transform.js";
|
|
25
|
+
import referenceMotionDescriptor from "./analyzers/reference-motion.descriptor.js";
|
|
26
|
+
import artifactReferencesDocsDescriptor from "./docs/artifact-references.docs.descriptor.js";
|
|
27
|
+
import imageTransformDocsDescriptor from "./docs/image-transform.docs.descriptor.js";
|
|
28
|
+
export default createRuntimePlugin({
|
|
29
|
+
id: 'media',
|
|
30
|
+
name: 'Media',
|
|
31
|
+
dependencies: ['runtime-client'],
|
|
32
|
+
description: 'Runtime kinds for media capture, image transformation, and temporal perception. Environment providers register capture and image implementations; the pure-TS reference motion analyzer ships here.',
|
|
33
|
+
kinds: [mediaCaptureKind, mediaImageTransformKind, mediaMotionKind],
|
|
34
|
+
// The reference motion analyzer is pure computation, so — unlike capture,
|
|
35
|
+
// whose impls live in provider packages — its descriptor + loader ship with
|
|
36
|
+
// the kind itself. It resolves in any scope (`consumer` + `cloud`).
|
|
37
|
+
descriptors: [
|
|
38
|
+
createRuntimeAsset({ id: 'media.capture', kind: 'runtime/client', name: 'Media Capture' }),
|
|
39
|
+
referenceMotionDescriptor,
|
|
40
|
+
artifactReferencesDocsDescriptor,
|
|
41
|
+
imageTransformDocsDescriptor
|
|
42
|
+
],
|
|
43
|
+
loaders: [
|
|
44
|
+
loader('media.capture', { kind: 'runtime/client' }, () => import('./capture-client.js')),
|
|
45
|
+
loader(MEDIA_MOTION_REFERENCE_ID, { kind: 'media/motion' }, () => import('./analyzers/reference-motion-analyzer.impl.js'))
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=media.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.plugin.js","sourceRoot":"","sources":["../src/media.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,yBAAyB,MAAM,4CAA4C,CAAC;AACnF,OAAO,gCAAgC,MAAM,+CAA+C,CAAC;AAC7F,OAAO,4BAA4B,MAAM,2CAA2C,CAAC;AAErF,eAAe,mBAAmB,CAAC;IAClC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,CAAC,gBAAgB,CAAC;IAChC,WAAW,EACV,qMAAqM;IACtM,KAAK,EAAE,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,eAAe,CAAC;IAEnE,0EAA0E;IAC1E,4EAA4E;IAC5E,oEAAoE;IACpE,WAAW,EAAE;QACZ,kBAAkB,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;QAC1F,yBAAyB;QACzB,gCAAgC;QAChC,4BAA4B;KAC5B;IAED,OAAO,EAAE;QACR,MAAM,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QACxF,MAAM,CACL,yBAAyB,EACzB,EAAE,IAAI,EAAE,cAAc,EAAE,EACxB,GAAG,EAAE,CAAC,MAAM,CAAC,+CAA+C,CAAC,CAC7D;KACD;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Media types with a native instrument in the creative suite.
|
|
4
|
+
*
|
|
5
|
+
* This describes the artifact's representation, not its storage provider or
|
|
6
|
+
* generation modality. Add a value only when a real consumer can present and
|
|
7
|
+
* resolve it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MediaArtifactTypeSchema: z.ZodEnum<{
|
|
10
|
+
image: "image";
|
|
11
|
+
audio: "audio";
|
|
12
|
+
video: "video";
|
|
13
|
+
transcript: "transcript";
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* The application and collection that canonically resolve an artifact.
|
|
17
|
+
*
|
|
18
|
+
* A collection is an owner-local resource name, not a URL. Consumers resolve
|
|
19
|
+
* the app origin through config/environment and use the owning feature client.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MediaArtifactOwnerSchema: z.ZodObject<{
|
|
22
|
+
appId: z.ZodString;
|
|
23
|
+
collection: z.ZodString;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
/**
|
|
26
|
+
* Stable, storage-neutral identity for one exact media artifact revision.
|
|
27
|
+
*
|
|
28
|
+
* URLs and byte-store paths are intentionally absent: they expire, leak
|
|
29
|
+
* provider details, and cannot enforce owner authorization. The owning app
|
|
30
|
+
* resolves this opaque identity to an authorized preview/download.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MediaArtifactReferenceSchema: z.ZodObject<{
|
|
33
|
+
kind: z.ZodLiteral<"media/artifact-ref">;
|
|
34
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
35
|
+
owner: z.ZodObject<{
|
|
36
|
+
appId: z.ZodString;
|
|
37
|
+
collection: z.ZodString;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
artifactId: z.ZodString;
|
|
40
|
+
revisionId: z.ZodString;
|
|
41
|
+
mediaType: z.ZodEnum<{
|
|
42
|
+
image: "image";
|
|
43
|
+
audio: "audio";
|
|
44
|
+
video: "video";
|
|
45
|
+
transcript: "transcript";
|
|
46
|
+
}>;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
export type MediaArtifactType = z.infer<typeof MediaArtifactTypeSchema>;
|
|
49
|
+
export type MediaArtifactOwner = z.infer<typeof MediaArtifactOwnerSchema>;
|
|
50
|
+
export type MediaArtifactReference = z.infer<typeof MediaArtifactReferenceSchema>;
|
|
51
|
+
export declare function createMediaArtifactReference(input: Omit<MediaArtifactReference, 'kind' | 'schemaVersion'>): MediaArtifactReference;
|
|
52
|
+
/**
|
|
53
|
+
* Compare the complete stable identity of two artifact revisions.
|
|
54
|
+
*
|
|
55
|
+
* Deliberately does not accept partial references: authorization and lineage
|
|
56
|
+
* checks must never collapse to "same id" or "same revision".
|
|
57
|
+
*/
|
|
58
|
+
export declare function isSameMediaArtifactReference(left: MediaArtifactReference, right: MediaArtifactReference): boolean;
|
|
59
|
+
//# sourceMappingURL=artifact-reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-reference.d.ts","sourceRoot":"","sources":["../../src/schemas/artifact-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;EAAoD,CAAC;AAEzF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;kBASnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;kBAOvC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,eAAe,CAAC,GAC3D,sBAAsB,CAiBxB;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,IAAI,EAAE,sBAAsB,EAC5B,KAAK,EAAE,sBAAsB,GAC3B,OAAO,CAUT"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
3
|
+
import { OpaqueMediaIdSchema } from "./opaque-id.js";
|
|
4
|
+
/**
|
|
5
|
+
* Media types with a native instrument in the creative suite.
|
|
6
|
+
*
|
|
7
|
+
* This describes the artifact's representation, not its storage provider or
|
|
8
|
+
* generation modality. Add a value only when a real consumer can present and
|
|
9
|
+
* resolve it.
|
|
10
|
+
*/
|
|
11
|
+
export const MediaArtifactTypeSchema = z.enum(['image', 'audio', 'video', 'transcript']);
|
|
12
|
+
/**
|
|
13
|
+
* The application and collection that canonically resolve an artifact.
|
|
14
|
+
*
|
|
15
|
+
* A collection is an owner-local resource name, not a URL. Consumers resolve
|
|
16
|
+
* the app origin through config/environment and use the owning feature client.
|
|
17
|
+
*/
|
|
18
|
+
export const MediaArtifactOwnerSchema = z.strictObject({
|
|
19
|
+
appId: z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1)
|
|
22
|
+
.regex(/^[a-z][a-z0-9-]*$/, 'Owner app ids use lower-kebab-case'),
|
|
23
|
+
collection: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.regex(/^[a-z][a-z0-9-]*$/, 'Owner collections use lower-kebab-case')
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Stable, storage-neutral identity for one exact media artifact revision.
|
|
30
|
+
*
|
|
31
|
+
* URLs and byte-store paths are intentionally absent: they expire, leak
|
|
32
|
+
* provider details, and cannot enforce owner authorization. The owning app
|
|
33
|
+
* resolves this opaque identity to an authorized preview/download.
|
|
34
|
+
*/
|
|
35
|
+
export const MediaArtifactReferenceSchema = z.strictObject({
|
|
36
|
+
kind: z.literal('media/artifact-ref'),
|
|
37
|
+
schemaVersion: z.literal(1),
|
|
38
|
+
owner: MediaArtifactOwnerSchema,
|
|
39
|
+
artifactId: OpaqueMediaIdSchema,
|
|
40
|
+
revisionId: OpaqueMediaIdSchema,
|
|
41
|
+
mediaType: MediaArtifactTypeSchema
|
|
42
|
+
});
|
|
43
|
+
export function createMediaArtifactReference(input) {
|
|
44
|
+
const parsed = MediaArtifactReferenceSchema.safeParse({
|
|
45
|
+
kind: 'media/artifact-ref',
|
|
46
|
+
schemaVersion: 1,
|
|
47
|
+
...input
|
|
48
|
+
});
|
|
49
|
+
if (parsed.success)
|
|
50
|
+
return parsed.data;
|
|
51
|
+
const badId = parsed.error.issues.find((issue) => issue.path[0] === 'artifactId' || issue.path[0] === 'revisionId');
|
|
52
|
+
if (badId) {
|
|
53
|
+
throw new CapabilityError('A media artifact id is not an opaque token.', 'INVALID_INPUT', {
|
|
54
|
+
reason: 'media-artifact-id-invalid',
|
|
55
|
+
retryable: false,
|
|
56
|
+
details: { field: String(badId.path[0]) },
|
|
57
|
+
cause: parsed.error
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
throw parsed.error;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Compare the complete stable identity of two artifact revisions.
|
|
64
|
+
*
|
|
65
|
+
* Deliberately does not accept partial references: authorization and lineage
|
|
66
|
+
* checks must never collapse to "same id" or "same revision".
|
|
67
|
+
*/
|
|
68
|
+
export function isSameMediaArtifactReference(left, right) {
|
|
69
|
+
return (left.kind === right.kind &&
|
|
70
|
+
left.schemaVersion === right.schemaVersion &&
|
|
71
|
+
left.owner.appId === right.owner.appId &&
|
|
72
|
+
left.owner.collection === right.owner.collection &&
|
|
73
|
+
left.artifactId === right.artifactId &&
|
|
74
|
+
left.revisionId === right.revisionId &&
|
|
75
|
+
left.mediaType === right.mediaType);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=artifact-reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-reference.js","sourceRoot":"","sources":["../../src/schemas/artifact-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,YAAY,CAAC;IACtD,KAAK,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,KAAK,CAAC,mBAAmB,EAAE,oCAAoC,CAAC;IAClE,UAAU,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,KAAK,CAAC,mBAAmB,EAAE,wCAAwC,CAAC;CACtE,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC1D,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACrC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,KAAK,EAAE,wBAAwB;IAC/B,UAAU,EAAE,mBAAmB;IAC/B,UAAU,EAAE,mBAAmB;IAC/B,SAAS,EAAE,uBAAuB;CAClC,CAAC,CAAC;AAMH,MAAM,UAAU,4BAA4B,CAC3C,KAA6D;IAE7D,MAAM,MAAM,GAAG,4BAA4B,CAAC,SAAS,CAAC;QACrD,IAAI,EAAE,oBAAoB;QAC1B,aAAa,EAAE,CAAC;QAChB,GAAG,KAAK;KACR,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,YAAY,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC;IACpH,IAAI,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,eAAe,CAAC,6CAA6C,EAAE,eAAe,EAAE;YACzF,MAAM,EAAE,2BAA2B;YACnC,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;YACzC,KAAK,EAAE,MAAM,CAAC,KAAK;SACnB,CAAC,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,CAAC,KAAK,CAAC;AACpB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC3C,IAA4B,EAC5B,KAA6B;IAE7B,OAAO,CACN,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;QACxB,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;QAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK;QACtC,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,KAAK,CAAC,UAAU;QAChD,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;QACpC,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;QACpC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,CAClC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Capture Descriptor Schema
|
|
3
|
+
*
|
|
4
|
+
* Schema for `media/capture` kind descriptors. A descriptor declares a
|
|
5
|
+
* capturable surface (screen, camera, microphone snapshot) that some
|
|
6
|
+
* provider package (e.g. `@vibesdotdev/bridge`) implements.
|
|
7
|
+
*
|
|
8
|
+
* The provider implementation is resolved by the runtime via descriptor `id`
|
|
9
|
+
* and `hardware` scope; consumers never import the provider directly.
|
|
10
|
+
*/
|
|
11
|
+
import * as z from 'zod/v4';
|
|
12
|
+
/**
|
|
13
|
+
* Capturable surface kinds.
|
|
14
|
+
*
|
|
15
|
+
* Open enum: callers may declare additional surfaces (e.g. `'window'`,
|
|
16
|
+
* `'region'`) as string literals. The runtime resolves by `id` first, so
|
|
17
|
+
* unknown surface values do not block resolution — they describe the
|
|
18
|
+
* descriptor for downstream consumers to filter.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CaptureSurfaceSchema: z.ZodUnion<readonly [z.ZodLiteral<"screen">, z.ZodLiteral<"camera">, z.ZodLiteral<"microphone-snapshot">, z.ZodString]>;
|
|
21
|
+
export type CaptureSurface = z.infer<typeof CaptureSurfaceSchema>;
|
|
22
|
+
/**
|
|
23
|
+
* Hardware classes a capture provider can run against.
|
|
24
|
+
*
|
|
25
|
+
* - `consumer` — runs against the user's local machine (FFI, native daemon).
|
|
26
|
+
* - `cloud` — runs against a remote capture service.
|
|
27
|
+
*/
|
|
28
|
+
export declare const CaptureHardwareSchema: z.ZodUnion<readonly [z.ZodLiteral<"consumer">, z.ZodLiteral<"cloud">, z.ZodString]>;
|
|
29
|
+
export type CaptureHardware = z.infer<typeof CaptureHardwareSchema>;
|
|
30
|
+
/**
|
|
31
|
+
* Capture output format.
|
|
32
|
+
*
|
|
33
|
+
* Open enum: providers may emit codec-specific formats not enumerated
|
|
34
|
+
* here. Consumers should branch on the value rather than assume the
|
|
35
|
+
* enumerated set is exhaustive.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CaptureFormatSchema: z.ZodUnion<readonly [z.ZodLiteral<"png">, z.ZodLiteral<"jpeg">, z.ZodLiteral<"webm">, z.ZodLiteral<"rgb">, z.ZodLiteral<"yuv">, z.ZodLiteral<"mp4">, z.ZodLiteral<"wav">, z.ZodString]>;
|
|
38
|
+
export type CaptureFormat = z.infer<typeof CaptureFormatSchema>;
|
|
39
|
+
/**
|
|
40
|
+
* `media/capture` descriptor.
|
|
41
|
+
*
|
|
42
|
+
* Identifies a capturable surface owned by some provider package. The
|
|
43
|
+
* provider registers a matching implementation that satisfies the
|
|
44
|
+
* `CaptureProvider` interface.
|
|
45
|
+
*/
|
|
46
|
+
export declare const CaptureDescriptorSchema: z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
description: z.ZodOptional<z.ZodString>;
|
|
50
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
capabilityId: z.ZodOptional<z.ZodString>;
|
|
53
|
+
requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
54
|
+
optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
55
|
+
config: z.ZodOptional<z.ZodUnknown>;
|
|
56
|
+
retention: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
57
|
+
maxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
cascadeFrom: z.ZodOptional<z.ZodString>;
|
|
61
|
+
ageField: z.ZodOptional<z.ZodString>;
|
|
62
|
+
reason: z.ZodString;
|
|
63
|
+
enforcedBy: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$strip>]>>;
|
|
65
|
+
kind: z.ZodLiteral<"media/capture">;
|
|
66
|
+
surface: z.ZodUnion<readonly [z.ZodLiteral<"screen">, z.ZodLiteral<"camera">, z.ZodLiteral<"microphone-snapshot">, z.ZodString]>;
|
|
67
|
+
hardware: z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"consumer">, z.ZodLiteral<"cloud">, z.ZodString]>>;
|
|
68
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type CaptureDescriptor = z.infer<typeof CaptureDescriptorSchema>;
|
|
71
|
+
//# sourceMappingURL=capture-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-descriptor.d.ts","sourceRoot":"","sources":["../../src/schemas/capture-descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,yHAK/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,qFAIhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,yLAS9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;iBAclC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Capture Descriptor Schema
|
|
3
|
+
*
|
|
4
|
+
* Schema for `media/capture` kind descriptors. A descriptor declares a
|
|
5
|
+
* capturable surface (screen, camera, microphone snapshot) that some
|
|
6
|
+
* provider package (e.g. `@vibesdotdev/bridge`) implements.
|
|
7
|
+
*
|
|
8
|
+
* The provider implementation is resolved by the runtime via descriptor `id`
|
|
9
|
+
* and `hardware` scope; consumers never import the provider directly.
|
|
10
|
+
*/
|
|
11
|
+
import * as z from 'zod/v4';
|
|
12
|
+
import { RuntimeDescriptorSchema } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
13
|
+
/**
|
|
14
|
+
* Capturable surface kinds.
|
|
15
|
+
*
|
|
16
|
+
* Open enum: callers may declare additional surfaces (e.g. `'window'`,
|
|
17
|
+
* `'region'`) as string literals. The runtime resolves by `id` first, so
|
|
18
|
+
* unknown surface values do not block resolution — they describe the
|
|
19
|
+
* descriptor for downstream consumers to filter.
|
|
20
|
+
*/
|
|
21
|
+
export const CaptureSurfaceSchema = z.union([
|
|
22
|
+
z.literal('screen'),
|
|
23
|
+
z.literal('camera'),
|
|
24
|
+
z.literal('microphone-snapshot'),
|
|
25
|
+
z.string().min(1)
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* Hardware classes a capture provider can run against.
|
|
29
|
+
*
|
|
30
|
+
* - `consumer` — runs against the user's local machine (FFI, native daemon).
|
|
31
|
+
* - `cloud` — runs against a remote capture service.
|
|
32
|
+
*/
|
|
33
|
+
export const CaptureHardwareSchema = z.union([
|
|
34
|
+
z.literal('consumer'),
|
|
35
|
+
z.literal('cloud'),
|
|
36
|
+
z.string().min(1)
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* Capture output format.
|
|
40
|
+
*
|
|
41
|
+
* Open enum: providers may emit codec-specific formats not enumerated
|
|
42
|
+
* here. Consumers should branch on the value rather than assume the
|
|
43
|
+
* enumerated set is exhaustive.
|
|
44
|
+
*/
|
|
45
|
+
export const CaptureFormatSchema = z.union([
|
|
46
|
+
z.literal('png'),
|
|
47
|
+
z.literal('jpeg'),
|
|
48
|
+
z.literal('webm'),
|
|
49
|
+
z.literal('rgb'),
|
|
50
|
+
z.literal('yuv'),
|
|
51
|
+
z.literal('mp4'),
|
|
52
|
+
z.literal('wav'),
|
|
53
|
+
z.string().min(1)
|
|
54
|
+
]);
|
|
55
|
+
/**
|
|
56
|
+
* `media/capture` descriptor.
|
|
57
|
+
*
|
|
58
|
+
* Identifies a capturable surface owned by some provider package. The
|
|
59
|
+
* provider registers a matching implementation that satisfies the
|
|
60
|
+
* `CaptureProvider` interface.
|
|
61
|
+
*/
|
|
62
|
+
export const CaptureDescriptorSchema = RuntimeDescriptorSchema.extend({
|
|
63
|
+
kind: z.literal('media/capture'),
|
|
64
|
+
/** Capturable surface this descriptor exposes. */
|
|
65
|
+
surface: CaptureSurfaceSchema,
|
|
66
|
+
/**
|
|
67
|
+
* Hardware classes the provider supports. Inherited from
|
|
68
|
+
* `RuntimeDescriptorSchema.hardware`; refined here to the typed enum.
|
|
69
|
+
*/
|
|
70
|
+
hardware: z.array(CaptureHardwareSchema).min(1),
|
|
71
|
+
/** Whether the descriptor is currently enabled for resolution. */
|
|
72
|
+
enabled: z.boolean().default(true)
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=capture-descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-descriptor.js","sourceRoot":"","sources":["../../src/schemas/capture-descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACnB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACnB,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC;IAChC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACjB,CAAC,CAAC;AAIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5C,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IACrB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACjB,CAAC,CAAC;AAIH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC1C,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAChB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAChB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAChB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAChB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAChB,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACjB,CAAC,CAAC;AAIH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IACrE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IAEhC,kDAAkD;IAClD,OAAO,EAAE,oBAAoB;IAE7B;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAE/C,kEAAkE;IAClE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture Options + Result Schemas
|
|
3
|
+
*
|
|
4
|
+
* Runtime shapes for what a `CaptureProvider.capture()` call accepts and
|
|
5
|
+
* returns, and the source listing returned by `listSources()`.
|
|
6
|
+
*/
|
|
7
|
+
import * as z from 'zod/v4';
|
|
8
|
+
/**
|
|
9
|
+
* Optional options passed to `CaptureProvider.capture()`.
|
|
10
|
+
*
|
|
11
|
+
* Providers may ignore fields they do not understand. `sourceId` is the
|
|
12
|
+
* canonical identifier returned by `listSources()`; consumers should pass
|
|
13
|
+
* exactly what they received.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CaptureOptionsSchema: z.ZodObject<{
|
|
16
|
+
sourceId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
17
|
+
format: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"png">, z.ZodLiteral<"jpeg">, z.ZodLiteral<"webm">, z.ZodLiteral<"rgb">, z.ZodLiteral<"yuv">, z.ZodLiteral<"mp4">, z.ZodLiteral<"wav">, z.ZodString]>>;
|
|
18
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type CaptureOptions = z.infer<typeof CaptureOptionsSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* Result of a successful capture.
|
|
25
|
+
*
|
|
26
|
+
* `data` is the raw bytes of the encoded payload in `format`. Width /
|
|
27
|
+
* height / durationMs are populated by providers that can infer them;
|
|
28
|
+
* consumers must not assume they are present.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CaptureResultSchema: z.ZodObject<{
|
|
31
|
+
data: z.ZodInstanceOf<Uint8Array<ArrayBuffer>>;
|
|
32
|
+
format: z.ZodUnion<readonly [z.ZodLiteral<"png">, z.ZodLiteral<"jpeg">, z.ZodLiteral<"webm">, z.ZodLiteral<"rgb">, z.ZodLiteral<"yuv">, z.ZodLiteral<"mp4">, z.ZodLiteral<"wav">, z.ZodString]>;
|
|
33
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
timestampMs: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export type CaptureResult = z.infer<typeof CaptureResultSchema>;
|
|
39
|
+
/**
|
|
40
|
+
* A capturable source returned by `listSources()` (e.g. a display, a
|
|
41
|
+
* camera, an audio device).
|
|
42
|
+
*/
|
|
43
|
+
export declare const CaptureSourceSchema: z.ZodObject<{
|
|
44
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
isPrimary: z.ZodDefault<z.ZodBoolean>;
|
|
47
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type CaptureSource = z.infer<typeof CaptureSourceSchema>;
|
|
51
|
+
//# sourceMappingURL=capture-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-options.d.ts","sourceRoot":"","sources":["../../src/schemas/capture-options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;iBAkB/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;;iBAkB9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;iBAe9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture Options + Result Schemas
|
|
3
|
+
*
|
|
4
|
+
* Runtime shapes for what a `CaptureProvider.capture()` call accepts and
|
|
5
|
+
* returns, and the source listing returned by `listSources()`.
|
|
6
|
+
*/
|
|
7
|
+
import * as z from 'zod/v4';
|
|
8
|
+
import { CaptureFormatSchema } from "./capture-descriptor.js";
|
|
9
|
+
/**
|
|
10
|
+
* Optional options passed to `CaptureProvider.capture()`.
|
|
11
|
+
*
|
|
12
|
+
* Providers may ignore fields they do not understand. `sourceId` is the
|
|
13
|
+
* canonical identifier returned by `listSources()`; consumers should pass
|
|
14
|
+
* exactly what they received.
|
|
15
|
+
*/
|
|
16
|
+
export const CaptureOptionsSchema = z.object({
|
|
17
|
+
/** Source identifier from `listSources()`. Defaults to the provider's primary source. */
|
|
18
|
+
sourceId: z.union([z.string(), z.number()]).optional(),
|
|
19
|
+
/** Desired output format. Provider chooses a sensible default if omitted. */
|
|
20
|
+
format: CaptureFormatSchema.optional(),
|
|
21
|
+
/** Scale multiplier applied to the captured surface (1.0 = native). */
|
|
22
|
+
scale: z.number().positive().optional(),
|
|
23
|
+
/** Codec quality hint, 1-100 for lossy formats. */
|
|
24
|
+
quality: z.number().int().min(1).max(100).optional(),
|
|
25
|
+
/**
|
|
26
|
+
* Capture duration in milliseconds, for video/audio surfaces. Still
|
|
27
|
+
* surfaces (e.g. `screen`) ignore this field.
|
|
28
|
+
*/
|
|
29
|
+
durationMs: z.number().int().positive().optional()
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Result of a successful capture.
|
|
33
|
+
*
|
|
34
|
+
* `data` is the raw bytes of the encoded payload in `format`. Width /
|
|
35
|
+
* height / durationMs are populated by providers that can infer them;
|
|
36
|
+
* consumers must not assume they are present.
|
|
37
|
+
*/
|
|
38
|
+
export const CaptureResultSchema = z.object({
|
|
39
|
+
/** Raw encoded payload bytes. */
|
|
40
|
+
data: z.instanceof(Uint8Array),
|
|
41
|
+
/** Encoding format of `data`. */
|
|
42
|
+
format: CaptureFormatSchema,
|
|
43
|
+
/** Pixel width of the captured frame, if applicable. */
|
|
44
|
+
width: z.number().int().positive().optional(),
|
|
45
|
+
/** Pixel height of the captured frame, if applicable. */
|
|
46
|
+
height: z.number().int().positive().optional(),
|
|
47
|
+
/** Duration of the captured clip in milliseconds, for video/audio formats. */
|
|
48
|
+
durationMs: z.number().int().nonnegative().optional(),
|
|
49
|
+
/** Provider-supplied timestamp (epoch ms) when the capture was taken. */
|
|
50
|
+
timestampMs: z.number().int().nonnegative().optional()
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* A capturable source returned by `listSources()` (e.g. a display, a
|
|
54
|
+
* camera, an audio device).
|
|
55
|
+
*/
|
|
56
|
+
export const CaptureSourceSchema = z.object({
|
|
57
|
+
/** Stable source identifier accepted by `capture({ sourceId })`. */
|
|
58
|
+
id: z.union([z.string(), z.number()]),
|
|
59
|
+
/** Human-readable label. */
|
|
60
|
+
name: z.string(),
|
|
61
|
+
/** Whether this is the provider's primary / default source. */
|
|
62
|
+
isPrimary: z.boolean().default(false),
|
|
63
|
+
/** Native width of the source, when known. */
|
|
64
|
+
width: z.number().int().positive().optional(),
|
|
65
|
+
/** Native height of the source, when known. */
|
|
66
|
+
height: z.number().int().positive().optional()
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=capture-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-options.js","sourceRoot":"","sources":["../../src/schemas/capture-options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,yFAAyF;IACzF,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IAEtD,6EAA6E;IAC7E,MAAM,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IAEtC,uEAAuE;IACvE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAEvC,mDAAmD;IACnD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAEpD;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC;AAIH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,iCAAiC;IACjC,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;IAE9B,iCAAiC;IACjC,MAAM,EAAE,mBAAmB;IAE3B,wDAAwD;IACxD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAE7C,yDAAyD;IACzD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAE9C,8EAA8E;IAC9E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAErD,yEAAyE;IACzE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,oEAAoE;IACpE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAErC,4BAA4B;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAEhB,+DAA+D;IAC/D,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAErC,8CAA8C;IAC9C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAE7C,+CAA+C;IAC/C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CaptureResult, type CaptureSource } from './capture-options.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A capture provider's `capture()` answer, parsed by the capture schema before
|
|
4
|
+
* the page uses it. A provider is plugin code: bytes, format and geometry are
|
|
5
|
+
* checked here, and the refusal carries the schema failure as its cause only.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseCaptureResult(value: unknown): CaptureResult;
|
|
8
|
+
/** A capture provider's `listSources()` answer, parsed by the source schema. */
|
|
9
|
+
export declare function parseCaptureSources(value: unknown): CaptureSource[];
|
|
10
|
+
//# sourceMappingURL=capture-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-parse.d.ts","sourceRoot":"","sources":["../../src/schemas/capture-parse.ts"],"names":[],"mappings":"AAEA,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,MAAM,sBAAsB,CAAC;AAY9B;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAIhE;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,EAAE,CAInE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
3
|
+
import { CaptureResultSchema, CaptureSourceSchema } from "./capture-options.js";
|
|
4
|
+
const CaptureSourcesSchema = z.array(CaptureSourceSchema);
|
|
5
|
+
function invalid(message, cause) {
|
|
6
|
+
return new CapabilityError(message, 'INTERNAL', {
|
|
7
|
+
reason: 'media-capture-result-invalid',
|
|
8
|
+
retryable: false,
|
|
9
|
+
cause
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A capture provider's `capture()` answer, parsed by the capture schema before
|
|
14
|
+
* the page uses it. A provider is plugin code: bytes, format and geometry are
|
|
15
|
+
* checked here, and the refusal carries the schema failure as its cause only.
|
|
16
|
+
*/
|
|
17
|
+
export function parseCaptureResult(value) {
|
|
18
|
+
const parsed = CaptureResultSchema.safeParse(value);
|
|
19
|
+
if (!parsed.success)
|
|
20
|
+
throw invalid('The capture provider returned a result this package does not accept.', parsed.error);
|
|
21
|
+
return parsed.data;
|
|
22
|
+
}
|
|
23
|
+
/** A capture provider's `listSources()` answer, parsed by the source schema. */
|
|
24
|
+
export function parseCaptureSources(value) {
|
|
25
|
+
const parsed = CaptureSourcesSchema.safeParse(value);
|
|
26
|
+
if (!parsed.success)
|
|
27
|
+
throw invalid('The capture provider listed sources this package does not accept.', parsed.error);
|
|
28
|
+
return parsed.data;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=capture-parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-parse.js","sourceRoot":"","sources":["../../src/schemas/capture-parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EAGnB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAE1D,SAAS,OAAO,CAAC,OAAe,EAAE,KAAiB;IAClD,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE;QAC/C,MAAM,EAAE,8BAA8B;QACtC,SAAS,EAAE,KAAK;QAChB,KAAK;KACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAChD,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,OAAO,CAAC,sEAAsE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACzH,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,MAAM,MAAM,GAAG,oBAAoB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrD,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,OAAO,CAAC,mEAAmE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACtH,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC"}
|