@viji-dev/core 0.19.0 → 0.21.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.
@@ -32,7 +32,10 @@
32
32
  * Note for consumers filtering on `capabilities.video`: the flag means the
33
33
  * scene reads the video *image* (pixels/texture). Shader scenes that consume
34
34
  * only CV result uniforms report `cv.*` without `video`, so a "reacts to the
35
- * camera" filter should test `video || any cv key`.
35
+ * camera" filter should test `video || any cv key`. Consumers that need to
36
+ * know *which* slot the scene reads (main stream, compositor streams, or an
37
+ * external device) read `capabilities.sources` (0.20.0); the top-level flags
38
+ * keep their 0.19.0 meaning (a shader `u_device{i}` still sets `video`).
36
39
  *
37
40
  * @param sceneCode - The artist's scene code (native, p5, or shader), raw
38
41
  * @returns The complete static analysis — the worker's ack payload
@@ -86,7 +89,8 @@ declare interface SceneAnalysisData {
86
89
  *
87
90
  * The input keys here are pinned to {@link INPUT_CAPABILITY_KEYS} and the `cv`
88
91
  * keys to {@link CV_FEATURE_KEYS} by a compile-time guard (below), so this shape
89
- * cannot drift from the runtime vocabulary.
92
+ * cannot drift from the runtime vocabulary. `parameters`, `cv`, and `sources`
93
+ * are the declared-only members outside the per-frame input vocabulary.
90
94
  */
91
95
  declare interface SceneCapabilities {
92
96
  /** Scene reads audio analysis (volume, bands, beat, FFT/waveform, or audio streams). */
@@ -122,6 +126,67 @@ declare interface SceneCapabilities {
122
126
  /** Scene uses body segmentation. */
123
127
  segmentation: boolean;
124
128
  };
129
+ /**
130
+ * Which input **source** each capability reads, for host routing UIs (e.g. a
131
+ * controller deciding whether a phone camera belongs in the main slot or a
132
+ * device slot). Declared-only (static analysis, like the flags above) and
133
+ * inclusive-biased; not part of the per-frame {@link INPUT_CAPABILITY_KEYS}
134
+ * vocabulary (same standing as `parameters` and `cv`).
135
+ *
136
+ * - `main`: the host's primary stream, index 0 (`viji.video` / `viji.audio`,
137
+ * `u_video*` / `u_audio*`).
138
+ * - `streams`: host-side additional compositor inputs, indices 1-99
139
+ * (`viji.videoStreams` / `viji.audioStreams`, `u_videoStream*` /
140
+ * `u_audioStream*`). Not routable from a controller; they set neither
141
+ * `main` nor `device`.
142
+ * - `device`: an external device slot, indices 100+ (`viji.devices[i].video`
143
+ * / `.audio` / `.motion` / `.orientation`, `u_device{i}*`, `u_deviceCount`,
144
+ * `u_externalDeviceCount`).
145
+ *
146
+ * Native/p5 scenes reach device members through a `.video` / `.audio` /
147
+ * `.motion` / `.orientation` token after `viji.devices`. When a scene
148
+ * references `viji.devices` but no such token is visible (destructuring,
149
+ * `viji.devices.length`), all three `device` booleans report `true`: the
150
+ * analyzer never hides a source a scene may use.
151
+ */
152
+ sources: {
153
+ /** Video image source. */
154
+ video: {
155
+ /**
156
+ * Main camera. Shader scenes also report `true` when any `cv.*` flag is
157
+ * set (CV runs on the main stream only; no device-CV uniforms exist).
158
+ * Native/p5 CV `enable*` calls do NOT imply this: device cameras expose
159
+ * the same CV surface (`viji.devices[i].video.cv`).
160
+ */
161
+ main: boolean;
162
+ /** Additional compositor video streams (`viji.videoStreams`, `u_videoStream*`). */
163
+ streams: boolean;
164
+ /** External device cameras (`viji.devices[i].video`, `u_device{i}`, `u_deviceCount`). */
165
+ device: boolean;
166
+ };
167
+ /** Audio analysis source. */
168
+ audio: {
169
+ /** Main microphone / audio input (`viji.audio`, `u_audio*`). */
170
+ main: boolean;
171
+ /** Additional compositor audio streams (`viji.audioStreams`, `u_audioStream*`). */
172
+ streams: boolean;
173
+ /**
174
+ * External device audio (`viji.devices[i].audio`). Always `false` for
175
+ * shader scenes: no device-audio uniform family exists.
176
+ */
177
+ device: boolean;
178
+ };
179
+ /** Motion / orientation sensor source. */
180
+ sensors: {
181
+ /** The host machine's own sensors (`viji.device`, `u_deviceAcceleration` and family). */
182
+ internal: boolean;
183
+ /**
184
+ * External device sensors (`viji.devices[i].motion` / `.orientation`,
185
+ * `u_device{i}Acceleration` and family, `u_externalDeviceCount`).
186
+ */
187
+ device: boolean;
188
+ };
189
+ };
125
190
  }
126
191
 
127
192
  export { }
@@ -1,4 +1,4 @@
1
- import { a as n } from "./scene-analysis-2Ov0HS52.js";
1
+ import { a as n } from "./scene-analysis-C7cAsqhv.js";
2
2
  export {
3
3
  n as analyzeScene
4
4
  };
package/package.json CHANGED
@@ -1,117 +1,117 @@
1
- {
2
- "name": "@viji-dev/core",
3
- "version": "0.19.0",
4
- "description": "Universal execution engine for Viji Creative scenes",
5
- "type": "module",
6
- "sideEffects": false,
7
- "main": "./dist/index.js",
8
- "module": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "import": "./dist/index.js",
13
- "types": "./dist/index.d.ts"
14
- },
15
- "./scene-analysis": {
16
- "import": "./dist/scene-analysis.js",
17
- "types": "./dist/scene-analysis.d.ts"
18
- },
19
- "./param-inference": {
20
- "import": "./dist/param-inference.js",
21
- "types": "./dist/param-inference.d.ts"
22
- },
23
- "./package.json": "./package.json",
24
- "./artist-global": {
25
- "types": "./dist/artist-global.d.ts"
26
- },
27
- "./artist-dts": {
28
- "import": "./dist/artist-dts.js",
29
- "types": "./dist/artist-dts.d.ts"
30
- },
31
- "./artist-jsdoc": {
32
- "types": "./dist/artist-jsdoc.d.ts"
33
- },
34
- "./artist-js-ambient": {
35
- "types": "./dist/artist-js-ambient.d.ts"
36
- },
37
- "./artist-dts-p5": {
38
- "import": "./dist/artist-dts-p5.js",
39
- "types": "./dist/artist-dts-p5.d.ts"
40
- },
41
- "./artist-global-p5": {
42
- "types": "./dist/artist-global-p5.d.ts"
43
- },
44
- "./shader-uniforms": {
45
- "import": "./dist/shader-uniforms.js",
46
- "types": "./dist/shader-uniforms.d.ts"
47
- },
48
- "./docs-api": {
49
- "import": "./dist/docs-api.js",
50
- "types": "./dist/docs-api.d.ts"
51
- }
52
- },
53
- "files": [
54
- "dist/*.js",
55
- "dist/*.d.ts",
56
- "dist/assets",
57
- "!dist/**/*.map",
58
- "README.md"
59
- ],
60
- "scripts": {
61
- "audio-lab": "vite --config audio-lab/vite.config.mjs",
62
- "prebuild": "node scripts/prebuild-clean.mjs && node scripts/sync-version.mjs",
63
- "version": "npm run build && git add -A",
64
- "build": "vite build && node scripts/copy-tasks-assets.mjs && node scripts/minify-dist.mjs && node scripts/build-artist-types.mjs && node scripts/lint-artist-types-drift.mjs && node scripts/build-docs-api.mjs",
65
- "build:docs": "node scripts/build-docs-api.mjs",
66
- "lint:ai-prompts-drift": "node scripts/lint-ai-prompts-drift.mjs",
67
- "dev": "node scripts/sync-version.mjs && vite build --watch",
68
- "integration": "vite --config integration-example/vite.config.ts",
69
- "test": "vitest",
70
- "test:run": "vitest run",
71
- "test:coverage": "vitest --coverage",
72
- "type-check": "tsc --noEmit",
73
- "lint": "eslint src --ext .ts"
74
- },
75
- "keywords": [
76
- "viji",
77
- "creative",
78
- "webgl",
79
- "audio-reactive",
80
- "canvas",
81
- "webworker"
82
- ],
83
- "author": "Viji Team",
84
- "license": "SEE LICENSE IN LICENSE",
85
- "devDependencies": {
86
- "@types/node": "^20.0.0",
87
- "@types/p5": "^1.7.6",
88
- "@typescript-eslint/eslint-plugin": "^6.0.0",
89
- "@typescript-eslint/parser": "^6.0.0",
90
- "@vitest/coverage-v8": "^1.0.0",
91
- "@webgpu/types": "0.1.72",
92
- "dts-bundle-generator": "^9.5.1",
93
- "eslint": "^8.0.0",
94
- "github-slugger": "^2.0.0",
95
- "happy-dom": "^18.0.1",
96
- "mdast-util-to-string": "^4.0.0",
97
- "remark-parse": "^11.0.0",
98
- "typescript": "^5.0.0",
99
- "unified": "^11.0.5",
100
- "vite": "^5.0.0",
101
- "vite-plugin-dts": "^3.0.0",
102
- "vitest": "^1.0.0"
103
- },
104
- "engines": {
105
- "node": ">=18.0.0"
106
- },
107
- "dependencies": {
108
- "@mediapipe/tasks-vision": "^0.10.20",
109
- "@noble/ciphers": "2.3.0",
110
- "@noble/curves": "^2.2.0",
111
- "@noble/hashes": "2.2.0",
112
- "acorn": "8.15.0",
113
- "essentia.js": "^0.1.3",
114
- "fft.js": "^4.0.4",
115
- "sucrase": "^3.35.1"
116
- }
117
- }
1
+ {
2
+ "name": "@viji-dev/core",
3
+ "version": "0.21.0",
4
+ "description": "Universal execution engine for Viji Creative scenes",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ },
15
+ "./scene-analysis": {
16
+ "import": "./dist/scene-analysis.js",
17
+ "types": "./dist/scene-analysis.d.ts"
18
+ },
19
+ "./param-inference": {
20
+ "import": "./dist/param-inference.js",
21
+ "types": "./dist/param-inference.d.ts"
22
+ },
23
+ "./package.json": "./package.json",
24
+ "./artist-global": {
25
+ "types": "./dist/artist-global.d.ts"
26
+ },
27
+ "./artist-dts": {
28
+ "import": "./dist/artist-dts.js",
29
+ "types": "./dist/artist-dts.d.ts"
30
+ },
31
+ "./artist-jsdoc": {
32
+ "types": "./dist/artist-jsdoc.d.ts"
33
+ },
34
+ "./artist-js-ambient": {
35
+ "types": "./dist/artist-js-ambient.d.ts"
36
+ },
37
+ "./artist-dts-p5": {
38
+ "import": "./dist/artist-dts-p5.js",
39
+ "types": "./dist/artist-dts-p5.d.ts"
40
+ },
41
+ "./artist-global-p5": {
42
+ "types": "./dist/artist-global-p5.d.ts"
43
+ },
44
+ "./shader-uniforms": {
45
+ "import": "./dist/shader-uniforms.js",
46
+ "types": "./dist/shader-uniforms.d.ts"
47
+ },
48
+ "./docs-api": {
49
+ "import": "./dist/docs-api.js",
50
+ "types": "./dist/docs-api.d.ts"
51
+ }
52
+ },
53
+ "files": [
54
+ "dist/*.js",
55
+ "dist/*.d.ts",
56
+ "dist/assets",
57
+ "!dist/**/*.map",
58
+ "README.md"
59
+ ],
60
+ "scripts": {
61
+ "audio-lab": "vite --config audio-lab/vite.config.mjs",
62
+ "prebuild": "node scripts/prebuild-clean.mjs && node scripts/sync-version.mjs",
63
+ "version": "npm run build && git add -A",
64
+ "build": "vite build && node scripts/copy-tasks-assets.mjs && node scripts/minify-dist.mjs && node scripts/build-artist-types.mjs && node scripts/lint-artist-types-drift.mjs && node scripts/build-docs-api.mjs",
65
+ "build:docs": "node scripts/build-docs-api.mjs",
66
+ "lint:ai-prompts-drift": "node scripts/lint-ai-prompts-drift.mjs",
67
+ "dev": "node scripts/sync-version.mjs && vite build --watch",
68
+ "integration": "vite --config integration-example/vite.config.ts",
69
+ "test": "vitest",
70
+ "test:run": "vitest run",
71
+ "test:coverage": "vitest --coverage",
72
+ "type-check": "tsc --noEmit",
73
+ "lint": "eslint src --ext .ts"
74
+ },
75
+ "keywords": [
76
+ "viji",
77
+ "creative",
78
+ "webgl",
79
+ "audio-reactive",
80
+ "canvas",
81
+ "webworker"
82
+ ],
83
+ "author": "Viji Team",
84
+ "license": "SEE LICENSE IN LICENSE",
85
+ "devDependencies": {
86
+ "@types/node": "^20.0.0",
87
+ "@types/p5": "^1.7.6",
88
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
89
+ "@typescript-eslint/parser": "^6.0.0",
90
+ "@vitest/coverage-v8": "^1.0.0",
91
+ "@webgpu/types": "0.1.72",
92
+ "dts-bundle-generator": "^9.5.1",
93
+ "eslint": "^8.0.0",
94
+ "github-slugger": "^2.0.0",
95
+ "happy-dom": "^18.0.1",
96
+ "mdast-util-to-string": "^4.0.0",
97
+ "remark-parse": "^11.0.0",
98
+ "typescript": "^5.0.0",
99
+ "unified": "^11.0.5",
100
+ "vite": "^5.0.0",
101
+ "vite-plugin-dts": "^3.0.0",
102
+ "vitest": "^1.0.0"
103
+ },
104
+ "engines": {
105
+ "node": ">=18.0.0"
106
+ },
107
+ "dependencies": {
108
+ "@mediapipe/tasks-vision": "^0.10.20",
109
+ "@noble/ciphers": "2.3.0",
110
+ "@noble/curves": "^2.2.0",
111
+ "@noble/hashes": "2.2.0",
112
+ "acorn": "8.15.0",
113
+ "essentia.js": "^0.1.3",
114
+ "fft.js": "^4.0.4",
115
+ "sucrase": "^3.35.1"
116
+ }
117
+ }