@aiworkbench/vibe-types 0.0.2 → 0.0.4
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/dist/index.d.ts +92 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +0 -0
- package/package.json +4 -4
- package/src/index.ts +0 -154
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aiworkbench/vibe-types
|
|
3
|
+
*
|
|
4
|
+
* Bridge interface — the contract between the Host application
|
|
5
|
+
* and micro-frontend mini-apps.
|
|
6
|
+
*
|
|
7
|
+
* The Host injects a bridge object into each mini-app based on
|
|
8
|
+
* the permissions declared in its manifest.json.
|
|
9
|
+
*/
|
|
10
|
+
export type BridgeCapability = "auth" | "api" | "navigation" | "theme" | "toast" | "storage" | "events";
|
|
11
|
+
export interface BridgeUser {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
email?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AuthBridge {
|
|
17
|
+
getUser(): BridgeUser;
|
|
18
|
+
getToken(): Promise<string>;
|
|
19
|
+
}
|
|
20
|
+
export interface NavigationBridge {
|
|
21
|
+
navigate(path: string): void;
|
|
22
|
+
}
|
|
23
|
+
export interface ThemeBridge {
|
|
24
|
+
current(): "light" | "dark";
|
|
25
|
+
}
|
|
26
|
+
export interface ToastBridge {
|
|
27
|
+
show(message: string, options?: {
|
|
28
|
+
type?: "info" | "success" | "error";
|
|
29
|
+
}): void;
|
|
30
|
+
}
|
|
31
|
+
export interface ApiBridge {
|
|
32
|
+
fetch(endpoint: string, options?: RequestInit): Promise<Response>;
|
|
33
|
+
}
|
|
34
|
+
export interface StorageBridge {
|
|
35
|
+
/** Get a value by key. Returns null if not found. */
|
|
36
|
+
get(key: string): Promise<string | null>;
|
|
37
|
+
/** Set a key-value pair. */
|
|
38
|
+
set(key: string, value: string): Promise<void>;
|
|
39
|
+
/** Remove a key. */
|
|
40
|
+
remove(key: string): Promise<void>;
|
|
41
|
+
/** List all keys in this mini-app's namespace. */
|
|
42
|
+
keys(): Promise<string[]>;
|
|
43
|
+
}
|
|
44
|
+
export interface EventPayload {
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
export interface EventsBridge {
|
|
48
|
+
/** Emit an event to the host. */
|
|
49
|
+
emit(event: string, payload?: EventPayload): void;
|
|
50
|
+
/** Subscribe to events from the host. Returns an unsubscribe function. */
|
|
51
|
+
on(event: string, handler: (payload: EventPayload) => void): () => void;
|
|
52
|
+
/** Subscribe once, then auto-unsubscribe. Returns an unsubscribe function. */
|
|
53
|
+
once(event: string, handler: (payload: EventPayload) => void): () => void;
|
|
54
|
+
}
|
|
55
|
+
export interface Bridge {
|
|
56
|
+
auth: AuthBridge;
|
|
57
|
+
navigation: NavigationBridge;
|
|
58
|
+
theme: ThemeBridge;
|
|
59
|
+
toast: ToastBridge;
|
|
60
|
+
api: ApiBridge;
|
|
61
|
+
storage: StorageBridge;
|
|
62
|
+
events: EventsBridge;
|
|
63
|
+
}
|
|
64
|
+
/** Props passed to every mini-app component. */
|
|
65
|
+
export interface VibeProps {
|
|
66
|
+
bridge: Bridge;
|
|
67
|
+
}
|
|
68
|
+
/** Manifest schema for a mini-app. */
|
|
69
|
+
export interface VibeManifest {
|
|
70
|
+
id: string;
|
|
71
|
+
version: string;
|
|
72
|
+
framework: "react" | "vue" | "vanilla";
|
|
73
|
+
permissions: BridgeCapability[];
|
|
74
|
+
description: string;
|
|
75
|
+
entry?: string;
|
|
76
|
+
}
|
|
77
|
+
/** A published mini-app entry in the registry. */
|
|
78
|
+
export interface RegistryEntry extends VibeManifest {
|
|
79
|
+
/** URL to the ES module bundle on storage. */
|
|
80
|
+
bundleUrl: string;
|
|
81
|
+
/** SRI hash (sha384-…). */
|
|
82
|
+
integrity: string;
|
|
83
|
+
/** Raw bundle size in bytes. */
|
|
84
|
+
bundleSizeBytes?: number;
|
|
85
|
+
/** ISO 8601 publish timestamp. */
|
|
86
|
+
publishedAt: string;
|
|
87
|
+
/** Publisher identity (e.g. GitHub username). */
|
|
88
|
+
publishedBy: string;
|
|
89
|
+
}
|
|
90
|
+
/** An environment's apps.json file — an array of published entries. */
|
|
91
|
+
export type RegistryManifest = RegistryEntry[];
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,KAAK,GACL,YAAY,GACZ,OAAO,GACP,OAAO,GACP,SAAS,GACT,QAAQ,CAAC;AAMb,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,IAAI,UAAU,CAAC;IACtB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAMD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAMD,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,OAAO,GAAG,MAAM,CAAC;CAC7B;AAMD,MAAM,WAAW,WAAW;IAC1B,IAAI,CACF,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;KAAE,GAChD,IAAI,CAAC;CACT;AAMD,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACnE;AAMD,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,GAAG,CAAC,G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AS,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IACvC,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,kDAAkD;AAClD,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,uEAAuE;AACvE,MAAM,MAAM,gBAAgB,GAAG,aAAa,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiworkbench/vibe-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"publishConfig": { "access": "public" },
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"bun": "./src/index.ts",
|
|
11
10
|
"import": "./dist/index.js",
|
|
12
11
|
"types": "./dist/index.d.ts"
|
|
13
12
|
}
|
|
@@ -16,7 +15,8 @@
|
|
|
16
15
|
"build": "bun build ./src/index.ts --outdir ./dist --target=node && tsc --emitDeclarationOnly",
|
|
17
16
|
"dev": "tsc --watch --emitDeclarationOnly",
|
|
18
17
|
"type-check": "tsc --noEmit",
|
|
19
|
-
"clean": "rm -rf dist"
|
|
18
|
+
"clean": "rm -rf dist",
|
|
19
|
+
"prepublishOnly": "bun run build"
|
|
20
20
|
},
|
|
21
|
-
"files": ["dist"
|
|
21
|
+
"files": ["dist"]
|
|
22
22
|
}
|
package/src/index.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @aiworkbench/vibe-types
|
|
3
|
-
*
|
|
4
|
-
* Bridge interface — the contract between the Host application
|
|
5
|
-
* and micro-frontend mini-apps.
|
|
6
|
-
*
|
|
7
|
-
* The Host injects a bridge object into each mini-app based on
|
|
8
|
-
* the permissions declared in its manifest.json.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
// Capability type
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
|
|
15
|
-
export type BridgeCapability =
|
|
16
|
-
| "auth"
|
|
17
|
-
| "api"
|
|
18
|
-
| "navigation"
|
|
19
|
-
| "theme"
|
|
20
|
-
| "toast"
|
|
21
|
-
| "storage"
|
|
22
|
-
| "events";
|
|
23
|
-
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
// Auth
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
|
|
28
|
-
export interface BridgeUser {
|
|
29
|
-
id: string;
|
|
30
|
-
name: string;
|
|
31
|
-
email?: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface AuthBridge {
|
|
35
|
-
getUser(): BridgeUser;
|
|
36
|
-
getToken(): Promise<string>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// ---------------------------------------------------------------------------
|
|
40
|
-
// Navigation
|
|
41
|
-
// ---------------------------------------------------------------------------
|
|
42
|
-
|
|
43
|
-
export interface NavigationBridge {
|
|
44
|
-
navigate(path: string): void;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ---------------------------------------------------------------------------
|
|
48
|
-
// Theme
|
|
49
|
-
// ---------------------------------------------------------------------------
|
|
50
|
-
|
|
51
|
-
export interface ThemeBridge {
|
|
52
|
-
current(): "light" | "dark";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ---------------------------------------------------------------------------
|
|
56
|
-
// Toast
|
|
57
|
-
// ---------------------------------------------------------------------------
|
|
58
|
-
|
|
59
|
-
export interface ToastBridge {
|
|
60
|
-
show(
|
|
61
|
-
message: string,
|
|
62
|
-
options?: { type?: "info" | "success" | "error" },
|
|
63
|
-
): void;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
// API
|
|
68
|
-
// ---------------------------------------------------------------------------
|
|
69
|
-
|
|
70
|
-
export interface ApiBridge {
|
|
71
|
-
fetch(endpoint: string, options?: RequestInit): Promise<Response>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// ---------------------------------------------------------------------------
|
|
75
|
-
// Storage — namespaced key-value persistence
|
|
76
|
-
// ---------------------------------------------------------------------------
|
|
77
|
-
|
|
78
|
-
export interface StorageBridge {
|
|
79
|
-
/** Get a value by key. Returns null if not found. */
|
|
80
|
-
get(key: string): Promise<string | null>;
|
|
81
|
-
/** Set a key-value pair. */
|
|
82
|
-
set(key: string, value: string): Promise<void>;
|
|
83
|
-
/** Remove a key. */
|
|
84
|
-
remove(key: string): Promise<void>;
|
|
85
|
-
/** List all keys in this mini-app's namespace. */
|
|
86
|
-
keys(): Promise<string[]>;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ---------------------------------------------------------------------------
|
|
90
|
-
// Events — typed pub/sub between mini-app and host
|
|
91
|
-
// ---------------------------------------------------------------------------
|
|
92
|
-
|
|
93
|
-
export interface EventPayload {
|
|
94
|
-
[key: string]: unknown;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface EventsBridge {
|
|
98
|
-
/** Emit an event to the host. */
|
|
99
|
-
emit(event: string, payload?: EventPayload): void;
|
|
100
|
-
/** Subscribe to events from the host. Returns an unsubscribe function. */
|
|
101
|
-
on(event: string, handler: (payload: EventPayload) => void): () => void;
|
|
102
|
-
/** Subscribe once, then auto-unsubscribe. Returns an unsubscribe function. */
|
|
103
|
-
once(event: string, handler: (payload: EventPayload) => void): () => void;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// ---------------------------------------------------------------------------
|
|
107
|
-
// Composite Bridge
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
|
|
110
|
-
export interface Bridge {
|
|
111
|
-
auth: AuthBridge;
|
|
112
|
-
navigation: NavigationBridge;
|
|
113
|
-
theme: ThemeBridge;
|
|
114
|
-
toast: ToastBridge;
|
|
115
|
-
api: ApiBridge;
|
|
116
|
-
storage: StorageBridge;
|
|
117
|
-
events: EventsBridge;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** Props passed to every mini-app component. */
|
|
121
|
-
export interface VibeProps {
|
|
122
|
-
bridge: Bridge;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** Manifest schema for a mini-app. */
|
|
126
|
-
export interface VibeManifest {
|
|
127
|
-
id: string;
|
|
128
|
-
version: string;
|
|
129
|
-
framework: "react" | "vue" | "vanilla";
|
|
130
|
-
permissions: BridgeCapability[];
|
|
131
|
-
description: string;
|
|
132
|
-
entry?: string;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// ---------------------------------------------------------------------------
|
|
136
|
-
// Registry — published mini-app metadata
|
|
137
|
-
// ---------------------------------------------------------------------------
|
|
138
|
-
|
|
139
|
-
/** A published mini-app entry in the registry. */
|
|
140
|
-
export interface RegistryEntry extends VibeManifest {
|
|
141
|
-
/** URL to the ES module bundle on storage. */
|
|
142
|
-
bundleUrl: string;
|
|
143
|
-
/** SRI hash (sha384-…). */
|
|
144
|
-
integrity: string;
|
|
145
|
-
/** Raw bundle size in bytes. */
|
|
146
|
-
bundleSizeBytes?: number;
|
|
147
|
-
/** ISO 8601 publish timestamp. */
|
|
148
|
-
publishedAt: string;
|
|
149
|
-
/** Publisher identity (e.g. GitHub username). */
|
|
150
|
-
publishedBy: string;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** An environment's apps.json file — an array of published entries. */
|
|
154
|
-
export type RegistryManifest = RegistryEntry[];
|