@vosjs/studio-core 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 vosso
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @vosso/studio-core
2
+
3
+ The studio's editing model. This package holds the product opinions that turn a raw
4
+ screen recording into an editable, re-renderable video: the `ProjectDoc` schema,
5
+ the element-aware auto-zoom planner, and the lowering that compiles a doc down to
6
+ a vos composition.
7
+
8
+ It is pure logic — no DOM, no React, no vos-render dependency. The generic
9
+ editing mechanisms (patch store, edit classifier, editor-bridge client, timeline
10
+ view-model) live in the open-source [`@vosjs/editor`](https://www.npmjs.com/package/@vosjs/editor);
11
+ what stays here is studio-specific. Consumed in-source by the vosso web app and bundled
12
+ into [`@vosso/vos-plugin`](../vos-plugin). MIT.
13
+
14
+ ## The pipeline
15
+
16
+ ```
17
+ RecordingArtifact ──projectFromArtifact──▶ ProjectDoc ──lowerToComposition──▶ { config, data, duration }
18
+ (footage + (normalize capture (editable (constant program +
19
+ cursor track) space, plan zoom) document) ctx.data — live edits)
20
+ ```
21
+
22
+ - **`projectFromArtifact(artifact)`** — build the initial `ProjectDoc` from a
23
+ recording: normalize the capture space (`normalizeCaptureSpace`, viewport crop
24
+ for window takes), then seed auto-zoom.
25
+ - **`planAutoZoom(doc, options)`** — element-aware zoom planner. Emits
26
+ `source: 'auto'` spans from click/dwell clusters; honors the wand contract
27
+ (never touches `source: 'manual'` spans). Camera dynamics come from a named
28
+ style preset (`ZOOM_STYLES` — glide / focus / cinema / snappy / cut).
29
+ - **`lowerToComposition(doc)`** — lower the doc to a **constant** vos program
30
+ plus a `ctx.data` payload. Zoom spans expand into an output-time keyframe
31
+ track; trims, speed, cursor follow, click effects, and audio envelopes all bake
32
+ into `data`. Because the program string is constant, edits replay live via
33
+ `SET_DATA`/`SET_DURATION` — nothing recompiles for a retime or a zoom tweak.
34
+
35
+ ## Key exports
36
+
37
+ | Area | Exports |
38
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
39
+ | Ingest | `projectFromArtifact` |
40
+ | Capture space | `normalizeCaptureSpace`, `deriveViewportCrop`, `docToCropSpace`, `docToFullSpace`, `CAPTURE_COVERAGE_MIN`, `WINDOW_FOCUS_MIN` |
41
+ | Planner | `planAutoZoom`, `smoothCursor` |
42
+ | Zoom styles | `ZOOM_STYLES`, `DEFAULT_ZOOM_STYLE`, `resolveZoomStyle` |
43
+ | Lowering | `lowerToComposition`, `zoomTrackFromDoc`, `followFocusEvents`, `extractClicks`, `ratedSegments` |
44
+ | Layout / focus | `computeCardLayout`, `docCardLayout`, `focusBounds`, `clampFocus`, `recommendedExportResolution` |
45
+ | Audio | `clipEnvelope`, `duckCurve`, `computePeaks`, `computeMicRms` |
46
+ | Timeline lanes | `zoomLane`, `speedLane`, `camLane`, `audioLane`, `videoLane` |
47
+
48
+ See [`src/types.ts`](src/types.ts) for the full `ProjectDoc` shape.
49
+
50
+ ## Design rules
51
+
52
+ - **Never bake doc values into the program string.** The program is a structural
53
+ hash; all editable state travels in `ctx.data`. Baking values breaks live editing.
54
+ - **Lowering is deterministic.** No stateful springs or wall-clock — `seek(t)` must
55
+ be a pure function of `t`, so cursor follow, click effects, and zoom are all
56
+ computed from the doc up front.
57
+ - **Source-anchored spans.** Zoom and speed spans are anchored in source time and
58
+ follow footage through trims; the lowering remaps them to output time.
59
+
60
+ ## Development
61
+
62
+ ```bash
63
+ pnpm --filter @vosso/studio-core test # vitest
64
+ pnpm --filter @vosso/studio-core typecheck
65
+ ```
66
+
67
+ The `__tests__` suite pins the invariants that are easy to break — capture-space
68
+ fail-closed matrix, zoom keyframe expansion, click extraction, layout↔ON_FRAME
69
+ parity. Extend them when touching lowering.