@aiworkbench/vibe-types 0.0.3 → 0.0.5
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 +59 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/index.ts +0 -154
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* The Host injects a bridge object into each mini-app based on
|
|
8
8
|
* the permissions declared in its manifest.json.
|
|
9
9
|
*/
|
|
10
|
-
export type BridgeCapability = "auth" | "api" | "navigation" | "theme" | "toast" | "storage" | "events";
|
|
10
|
+
export type BridgeCapability = "auth" | "api" | "navigation" | "theme" | "toast" | "storage" | "events" | "chat";
|
|
11
11
|
export interface BridgeUser {
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
@@ -52,6 +52,54 @@ export interface EventsBridge {
|
|
|
52
52
|
/** Subscribe once, then auto-unsubscribe. Returns an unsubscribe function. */
|
|
53
53
|
once(event: string, handler: (payload: EventPayload) => void): () => void;
|
|
54
54
|
}
|
|
55
|
+
/** A single part within a chat message. */
|
|
56
|
+
export type ChatPart = {
|
|
57
|
+
type: "text";
|
|
58
|
+
text: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: "data";
|
|
61
|
+
data: unknown;
|
|
62
|
+
} | {
|
|
63
|
+
type: "file";
|
|
64
|
+
file: {
|
|
65
|
+
name: string;
|
|
66
|
+
mimeType: string;
|
|
67
|
+
uri: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/** A server-sent event from the A2A stream. */
|
|
71
|
+
export interface ChatStreamEvent {
|
|
72
|
+
kind: string;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
/** Options for sending a chat message. */
|
|
76
|
+
export interface ChatSendOptions {
|
|
77
|
+
/** Conversation thread identifier. */
|
|
78
|
+
contextId?: string;
|
|
79
|
+
/** Caller-supplied message id. */
|
|
80
|
+
messageId?: string;
|
|
81
|
+
/** Arbitrary metadata forwarded to the agent. */
|
|
82
|
+
metadata?: unknown;
|
|
83
|
+
/** Abort signal to cancel the stream. */
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
}
|
|
86
|
+
/** An async-iterable stream of chat events with an abort handle. */
|
|
87
|
+
export interface ChatStream {
|
|
88
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<ChatStreamEvent>;
|
|
89
|
+
/** Cancel the in-flight stream. */
|
|
90
|
+
abort(): void;
|
|
91
|
+
}
|
|
92
|
+
export interface ChatBridge {
|
|
93
|
+
/**
|
|
94
|
+
* Send a message to an A2A-compatible agent and stream the response.
|
|
95
|
+
*
|
|
96
|
+
* @param serverUrl - Base URL of the A2A agent server.
|
|
97
|
+
* @param parts - Message parts to send.
|
|
98
|
+
* @param options - Optional context, message id, metadata, abort signal.
|
|
99
|
+
* @returns An async-iterable stream of `ChatStreamEvent` objects.
|
|
100
|
+
*/
|
|
101
|
+
send(serverUrl: string, parts: ChatPart[], options?: ChatSendOptions): ChatStream;
|
|
102
|
+
}
|
|
55
103
|
export interface Bridge {
|
|
56
104
|
auth: AuthBridge;
|
|
57
105
|
navigation: NavigationBridge;
|
|
@@ -60,11 +108,20 @@ export interface Bridge {
|
|
|
60
108
|
api: ApiBridge;
|
|
61
109
|
storage: StorageBridge;
|
|
62
110
|
events: EventsBridge;
|
|
111
|
+
chat: ChatBridge;
|
|
63
112
|
}
|
|
64
113
|
/** Props passed to every mini-app component. */
|
|
65
114
|
export interface VibeProps {
|
|
66
115
|
bridge: Bridge;
|
|
67
116
|
}
|
|
117
|
+
export interface VibeApiProxyHostConfig {
|
|
118
|
+
/** Default upstream target used by hosts that support proxy overrides. */
|
|
119
|
+
defaultTarget?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface VibeHostConfig {
|
|
122
|
+
/** Host-managed settings for API proxy configuration. */
|
|
123
|
+
apiProxy?: VibeApiProxyHostConfig;
|
|
124
|
+
}
|
|
68
125
|
/** Manifest schema for a mini-app. */
|
|
69
126
|
export interface VibeManifest {
|
|
70
127
|
id: string;
|
|
@@ -73,6 +130,7 @@ export interface VibeManifest {
|
|
|
73
130
|
permissions: BridgeCapability[];
|
|
74
131
|
description: string;
|
|
75
132
|
entry?: string;
|
|
133
|
+
hostConfig?: VibeHostConfig;
|
|
76
134
|
}
|
|
77
135
|
/** A published mini-app entry in the registry. */
|
|
78
136
|
export interface RegistryEntry extends VibeManifest {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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,GACR,MAAM,CAAC;AAMX,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;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EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CACnC;AAED,sCAAsC;AACtC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IACvC,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;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/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiworkbench/vibe-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
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
|
}
|
|
@@ -19,5 +18,5 @@
|
|
|
19
18
|
"clean": "rm -rf dist",
|
|
20
19
|
"prepublishOnly": "bun run build"
|
|
21
20
|
},
|
|
22
|
-
"files": ["dist"
|
|
21
|
+
"files": ["dist"]
|
|
23
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[];
|