@vtxdeo/protocol 1.2.6 → 3.2.1

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/README.md CHANGED
@@ -1,62 +1,28 @@
1
1
  # @vtxdeo/protocol
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@vtx/protocol.svg)](https://www.npmjs.com/package/@vtx/protocol)
3
+ [![npm version](https://img.shields.io/npm/v/@vtxdeo/protocol.svg)](https://www.npmjs.com/package/@vtxdeo/protocol)
4
4
 
5
- **Official WIT interface definitions for VTX Project plugins.**
5
+ **Official WIT interface definitions for VTX Project.**
6
6
 
7
- This package contains the raw `vtx.wit` definitions required to compile JavaScript/TypeScript code into VTX-compatible WebAssembly components.
7
+ This package contains the raw `.wit` definitions used by the VTX ecosystem. It is intended for use by build tools, CLIs, and SDKs that need to reference the official protocol contract.
8
+
9
+ > **Note**: This package does **not** contain the CLI tool or runtime bindings.
10
+ > * To build plugins, use the **VTX CLI**.
11
+ > * To write plugins, use the **VTX SDK**.
8
12
 
9
13
  ## Installation
10
14
 
11
15
  ```bash
12
- npm install @vtx/protocol --save-dev
16
+ npm install @vtxdeo/protocol --save-dev
13
17
 
14
18
  ```
15
19
 
16
20
  ## Usage
17
21
 
18
- ### 1. Programmatic Usage (Build Scripts)
19
-
20
- This package exports the absolute path to the `vtx.wit` file.
21
-
22
22
  ```javascript
23
- import { witPath, witDir } from '@vtx/protocol';
24
- // or: const { witPath } = require('@vtx/protocol');
25
-
26
- console.log(witPath);
27
- // Output example: /Users/dev/project/node_modules/@vtx/protocol/wit/vtx.wit
28
-
29
- ```
30
-
31
- ### 2. Using with `jco` (CLI)
32
-
33
- You can use the path directly in your CLI commands to componentize your application:
34
-
35
- ```bash
36
- # Example: Transpile JS to Component
37
- jco componentize app.js \
38
- --wit "$(node -p "require('@vtx/protocol').witPath")" \
39
- --world plugin \
40
- --out plugin.wasm
41
-
42
- ```
43
-
44
- ### 3. Using with `componentize-js` (API)
45
-
46
- ```javascript
47
- import { componentize } from '@bytecodealliance/componentize-js';
48
- import { witPath } from '@vtx/protocol';
49
- import { readFile } from 'node:fs/promises';
50
-
51
- const source = await readFile('app.js', 'utf8');
52
-
53
- const { component } = await componentize(source, {
54
- witPath: witPath, // Pass the path directly
55
- world: 'plugin',
56
- });
57
-
58
- ```
23
+ const { witPath, witDir } = require('@vtxdeo/protocol');
59
24
 
60
- ## Versioning
25
+ console.log(`Protocol definition is located at: ${witPath}`);
26
+ // Output: .../node_modules/@vtxdeo/protocol/wit/vtx.wit
61
27
 
62
- The version of this package matches the version of the `vtx:api` WIT definition.
28
+ ```
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export const witPath: string;
2
+ export const witDir: string;
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@vtxdeo/protocol",
3
- "version": "1.2.6",
4
- "description": "WIT definitions for VTX plugins",
3
+ "version": "3.2.1",
4
+ "description": "WIT interface definitions for VTX plugins",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
6
7
  "files": [
7
8
  "index.js",
9
+ "index.d.ts",
8
10
  "wit/"
9
11
  ],
10
12
  "scripts": {
11
13
  "prepublishOnly": "cp -r ../../wit ./"
12
- }
13
- }
14
+ },
15
+ "dependencies": {},
16
+ "devDependencies": {}
17
+ }
package/wit/vtx.wit CHANGED
@@ -58,12 +58,25 @@ interface types {
58
58
  }
59
59
  }
60
60
 
61
+ interface ffmpeg {
62
+ use stream-io.{buffer};
63
+
64
+ record transcode-params {
65
+ profile: string,
66
+ input-id: string,
67
+ args: list<string>,
68
+ }
69
+
70
+ execute: func(params: transcode-params) -> result<buffer, string>;
71
+ }
72
+
61
73
  world plugin {
62
74
  use types.{http-request, http-response, manifest};
63
75
  use auth-types.{user-context};
64
76
 
65
77
  import stream-io;
66
78
  import sql;
79
+ import ffmpeg;
67
80
 
68
81
  export handle: func(req: http-request) -> http-response;
69
82