@vibesdotdev/runtime-plugin-types 0.0.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 +3 -0
- package/SPEC.md +14 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
- package/src/index.ts +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# runtime-plugin-types
|
|
2
|
+
|
|
3
|
+
Houses the daemon command-handler interface types (`CommandHandler`, `RuntimeCommandDeps`, `RuntimeCommandPayload`, `RuntimeCommandResult`, etc.) that both `runtime-plugin` and `storage` depend on. This breaks the `storage → runtime-plugin` import cycle by giving both packages a shared dependency on this leaf package instead.
|
package/SPEC.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @vibesdotdev/runtime-plugin-types
|
|
2
|
+
|
|
3
|
+
Owns the daemon command-handler interface types used by both `@vibesdotdev/runtime-plugin` and `@vibesdotdev/storage`.
|
|
4
|
+
|
|
5
|
+
## Types
|
|
6
|
+
|
|
7
|
+
- `CommandHandler` — function signature for daemon command handlers
|
|
8
|
+
- `RuntimeCommandDeps` — deps injected into handlers (runtime instance, subscription manager, health getter)
|
|
9
|
+
- `RuntimeCommandEnvelope` — IPC envelope shape
|
|
10
|
+
- `RuntimeCommandPayload` — `Record<string, unknown>`
|
|
11
|
+
- `RuntimeCommandResult` — result shape with `success: boolean`
|
|
12
|
+
- `SubscriptionManager` — SSE connection manager interface
|
|
13
|
+
- `SubscriptionChannel` — supported subscription channel names
|
|
14
|
+
- `SSEEvent` — SSE event payload shape
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime daemon command-handler type contracts.
|
|
3
|
+
*
|
|
4
|
+
* These types define the contract between the runtime-plugin daemon
|
|
5
|
+
* and external packages (like storage) that register command handlers.
|
|
6
|
+
* Shared by all command handlers: health, query, read, invoke, subscribe,
|
|
7
|
+
* doctor, and storage's sync handlers.
|
|
8
|
+
*/
|
|
9
|
+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
10
|
+
import type { RuntimeDaemonHealth } from '@vibesdotdev/runtime-plugin/daemon/protocol/schemas';
|
|
11
|
+
/**
|
|
12
|
+
* Supported subscription channels
|
|
13
|
+
*/
|
|
14
|
+
export type SubscriptionChannel = 'storage' | 'config' | 'lifecycle' | 'activity' | 'all';
|
|
15
|
+
/**
|
|
16
|
+
* SSE event payload sent to clients
|
|
17
|
+
*/
|
|
18
|
+
export interface SSEEvent {
|
|
19
|
+
type: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Subscription manager interface.
|
|
24
|
+
* Tracks active SSE connections and routes events.
|
|
25
|
+
*/
|
|
26
|
+
export interface SubscriptionManager {
|
|
27
|
+
activeCount(): number;
|
|
28
|
+
closeAll(): void;
|
|
29
|
+
handleSubscribe(req: Request): Response;
|
|
30
|
+
broadcast?(channel: SubscriptionChannel, event: SSEEvent): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Dependencies injected into runtime command handlers.
|
|
34
|
+
*/
|
|
35
|
+
export interface RuntimeCommandDeps {
|
|
36
|
+
runtime: VibesRuntime;
|
|
37
|
+
subscriptionManager: SubscriptionManager;
|
|
38
|
+
getHealth: () => Promise<RuntimeDaemonHealth>;
|
|
39
|
+
}
|
|
40
|
+
export interface RuntimeCommandEnvelope {
|
|
41
|
+
type: 'runtime-command';
|
|
42
|
+
command: string;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
export type RuntimeCommandPayload = Record<string, unknown>;
|
|
46
|
+
export interface RuntimeCommandResult {
|
|
47
|
+
success: boolean;
|
|
48
|
+
error?: string;
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Command handler function signature.
|
|
53
|
+
*/
|
|
54
|
+
export type CommandHandler = (message: RuntimeCommandPayload, deps: RuntimeCommandDeps) => Promise<RuntimeCommandResult>;
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAC;AAE/F;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,KAAK,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,WAAW,IAAI,MAAM,CAAC;IACtB,QAAQ,IAAI,IAAI,CAAC;IACjB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAAC;IACxC,SAAS,CAAC,CAAC,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,YAAY,CAAC;IACtB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,SAAS,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAC5B,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,kBAAkB,KACpB,OAAO,CAAC,oBAAoB,CAAC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime daemon command-handler type contracts.
|
|
3
|
+
*
|
|
4
|
+
* These types define the contract between the runtime-plugin daemon
|
|
5
|
+
* and external packages (like storage) that register command handlers.
|
|
6
|
+
* Shared by all command handlers: health, query, read, invoke, subscribe,
|
|
7
|
+
* doctor, and storage's sync handlers.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibesdotdev/runtime-plugin-types",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"bun": "./src/index.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org",
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/vibesdotdev/monorepo.git",
|
|
22
|
+
"directory": "packages/runtime-plugin-types"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@vibesdotdev/runtime": "0.0.1"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"check": "bun --bun tsc -p tsconfig.json --noEmit",
|
|
29
|
+
"build": "tsc -p tsconfig.json"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"src",
|
|
35
|
+
"bin",
|
|
36
|
+
"README.md",
|
|
37
|
+
"SPEC.md",
|
|
38
|
+
"LICENSE",
|
|
39
|
+
"!src/**/__tests__/**",
|
|
40
|
+
"!src/**/__stubs__/**",
|
|
41
|
+
"!src/**/*.test.ts",
|
|
42
|
+
"!src/**/*.test.tsx",
|
|
43
|
+
"!src/**/*.spec.ts",
|
|
44
|
+
"!src/**/*.spec.tsx",
|
|
45
|
+
"!dist/**/__tests__/**",
|
|
46
|
+
"!dist/**/__stubs__/**",
|
|
47
|
+
"!dist/**/*.test.js",
|
|
48
|
+
"!dist/**/*.test.js.map",
|
|
49
|
+
"!dist/**/*.test.d.ts",
|
|
50
|
+
"!dist/**/*.test.d.ts.map",
|
|
51
|
+
"!dist/**/*.spec.js",
|
|
52
|
+
"!dist/**/*.spec.js.map",
|
|
53
|
+
"!dist/**/*.spec.d.ts",
|
|
54
|
+
"!dist/**/*.spec.d.ts.map"
|
|
55
|
+
],
|
|
56
|
+
"vibes": {
|
|
57
|
+
"visibility": "public-framework"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime daemon command-handler type contracts.
|
|
3
|
+
*
|
|
4
|
+
* These types define the contract between the runtime-plugin daemon
|
|
5
|
+
* and external packages (like storage) that register command handlers.
|
|
6
|
+
* Shared by all command handlers: health, query, read, invoke, subscribe,
|
|
7
|
+
* doctor, and storage's sync handlers.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
11
|
+
import type { RuntimeDaemonHealth } from '@vibesdotdev/runtime-plugin/daemon/protocol/schemas';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Supported subscription channels
|
|
15
|
+
*/
|
|
16
|
+
export type SubscriptionChannel = 'storage' | 'config' | 'lifecycle' | 'activity' | 'all';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* SSE event payload sent to clients
|
|
20
|
+
*/
|
|
21
|
+
export interface SSEEvent {
|
|
22
|
+
type: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Subscription manager interface.
|
|
28
|
+
* Tracks active SSE connections and routes events.
|
|
29
|
+
*/
|
|
30
|
+
export interface SubscriptionManager {
|
|
31
|
+
activeCount(): number;
|
|
32
|
+
closeAll(): void;
|
|
33
|
+
handleSubscribe(req: Request): Response;
|
|
34
|
+
broadcast?(channel: SubscriptionChannel, event: SSEEvent): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Dependencies injected into runtime command handlers.
|
|
39
|
+
*/
|
|
40
|
+
export interface RuntimeCommandDeps {
|
|
41
|
+
runtime: VibesRuntime;
|
|
42
|
+
subscriptionManager: SubscriptionManager;
|
|
43
|
+
getHealth: () => Promise<RuntimeDaemonHealth>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface RuntimeCommandEnvelope {
|
|
47
|
+
type: 'runtime-command';
|
|
48
|
+
command: string;
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type RuntimeCommandPayload = Record<string, unknown>;
|
|
53
|
+
|
|
54
|
+
export interface RuntimeCommandResult {
|
|
55
|
+
success: boolean;
|
|
56
|
+
error?: string;
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Command handler function signature.
|
|
62
|
+
*/
|
|
63
|
+
export type CommandHandler = (
|
|
64
|
+
message: RuntimeCommandPayload,
|
|
65
|
+
deps: RuntimeCommandDeps
|
|
66
|
+
) => Promise<RuntimeCommandResult>;
|