@theaiplatform/miniapp-sdk 0.0.0 → 0.0.2
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 +102 -2
- package/THIRD_PARTY_NOTICES.md +42 -14
- package/config-schema.json +543 -30
- package/dist/config.d.ts +4 -1
- package/dist/index.d.ts +177 -2
- package/dist/index.js +1 -0
- package/dist/mcp.d.ts +27 -0
- package/dist/mcp.js +4 -0
- package/dist/rspack/css-entry-loader.cjs +1 -1
- package/dist/rspack/html-loader.cjs +1 -1
- package/dist/rspack/index.js +252 -5
- package/dist/sdk.d.ts +158 -1
- package/dist/surface.d.ts +1 -1
- package/dist/ui/styles.css +3761 -0
- package/dist/ui/tailwind.css +113 -0
- package/dist/ui/theme.css +335 -0
- package/dist/ui/wasm.d.ts +660 -0
- package/dist/ui/wasm.js +2714 -0
- package/dist/ui.d.ts +986 -0
- package/dist/ui.js +2045 -0
- package/dist/web.d.ts +177 -1
- package/dist/web.js +37 -1
- package/examples/wasm-ui/Cargo.lock +248 -0
- package/examples/wasm-ui/Cargo.toml +18 -0
- package/examples/wasm-ui/README.md +19 -0
- package/examples/wasm-ui/src/lib.rs +190 -0
- package/package.json +52 -3
- package/ui-components.json +64 -0
package/dist/config.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export declare type JsonSchema = {
|
|
|
9
9
|
readonly [key: string]: unknown;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
/** Closed discovery taxonomy accepted by `presentation.categories`. */
|
|
13
|
+
export declare type MiniAppCategory = 'productivity' | 'developer-tools' | 'creativity' | 'communication' | 'data-and-analytics' | 'business' | 'education' | 'media-and-entertainment' | 'utilities' | 'other';
|
|
14
|
+
|
|
12
15
|
export declare type ToolDefinition<TArguments = unknown, TResult = unknown> = {
|
|
13
16
|
displayName?: string;
|
|
14
17
|
description: string;
|
|
@@ -28,7 +31,7 @@ export declare type UIEntrypoint = {
|
|
|
28
31
|
};
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
|
-
* @capability
|
|
34
|
+
* @capability miniapp-platform
|
|
32
35
|
*/
|
|
33
36
|
export declare type UIEntrypointType = 'workspace-left-sidebar' | 'workspace-left-sidebar-item' | 'chat-right-sidebar' | 'chat-right-sidebar-item';
|
|
34
37
|
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export declare type CreateProjectResult = {
|
|
|
28
28
|
|
|
29
29
|
export declare function defineApp<const TConfig extends AppConfig>(config: TConfig): TConfig;
|
|
30
30
|
|
|
31
|
+
/** Preserve the inferred tool signatures for a package-runtime MCP server. */
|
|
32
|
+
export declare function defineMcpServer<const TServer extends McpServerDefinition>(server: TServer): TServer;
|
|
33
|
+
|
|
31
34
|
export declare type GetChannelAccessOptions = {
|
|
32
35
|
workspaceId?: string;
|
|
33
36
|
channelId: string;
|
|
@@ -105,12 +108,27 @@ export declare type ListWorkflowsResult = {
|
|
|
105
108
|
workflows: MiniAppWorkflow[];
|
|
106
109
|
};
|
|
107
110
|
|
|
111
|
+
/** The tools exposed by one package-runtime MCP server. */
|
|
112
|
+
export declare type McpServerDefinition = {
|
|
113
|
+
tools: Record<string, McpServerToolDefinition>;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** One tool implemented by a package-runtime MCP server. */
|
|
117
|
+
export declare type McpServerToolDefinition<TArguments extends MiniAppJsonValue = MiniAppJsonValue, TResult extends MiniAppJsonValue = MiniAppJsonValue> = {
|
|
118
|
+
description: string;
|
|
119
|
+
inputSchema: JsonSchema;
|
|
120
|
+
execute(arguments_: TArguments): MiniAppMaybePromise<TResult>;
|
|
121
|
+
};
|
|
122
|
+
|
|
108
123
|
export declare type MiniAppAuthApi = {
|
|
109
124
|
getUserProfile(): MiniAppMaybePromise<MiniAppUserProfile | null>;
|
|
110
125
|
};
|
|
111
126
|
|
|
127
|
+
/** Closed discovery taxonomy accepted by `presentation.categories`. */
|
|
128
|
+
export declare type MiniAppCategory = 'productivity' | 'developer-tools' | 'creativity' | 'communication' | 'data-and-analytics' | 'business' | 'education' | 'media-and-entertainment' | 'utilities' | 'other';
|
|
129
|
+
|
|
112
130
|
/**
|
|
113
|
-
* @capability
|
|
131
|
+
* @capability miniapp-platform
|
|
114
132
|
*/
|
|
115
133
|
export declare type MiniAppChannel = {
|
|
116
134
|
roomId: string;
|
|
@@ -154,6 +172,85 @@ export declare type MiniAppCreateSpecialistResult = {
|
|
|
154
172
|
isActive: boolean;
|
|
155
173
|
};
|
|
156
174
|
|
|
175
|
+
/** Metadata-only access to host-managed credentials in the active workspace. */
|
|
176
|
+
export declare type MiniAppCredentialsApi = {
|
|
177
|
+
listHttp(): MiniAppMaybePromise<MiniAppHttpCredentialMetadata[]>;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/** Host-mediated bounded HTTP(S); browser fetch is not the authority. */
|
|
181
|
+
export declare type MiniAppHttpApi = {
|
|
182
|
+
request(input: MiniAppHttpRequestInput, options?: MiniAppHttpRequestOptions): MiniAppMaybePromise<MiniAppHttpResponse>;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/** Metadata-only stored HTTP credential. Secret fields never cross IPC. */
|
|
186
|
+
export declare type MiniAppHttpCredentialMetadata = {
|
|
187
|
+
id: string;
|
|
188
|
+
credentialType: MiniAppHttpCredentialType;
|
|
189
|
+
displayName: string;
|
|
190
|
+
metadataFields: Record<string, string>;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export declare type MiniAppHttpCredentialType = 'http_bearer' | 'http_basic' | 'http_header_auth' | 'http_api_key';
|
|
194
|
+
|
|
195
|
+
export declare type MiniAppHttpHeader = {
|
|
196
|
+
name: string;
|
|
197
|
+
value: string;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export declare type MiniAppHttpHeaderInput = {
|
|
201
|
+
name: string;
|
|
202
|
+
value: string;
|
|
203
|
+
/** Defaults to true when omitted. */
|
|
204
|
+
enabled?: boolean;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export declare type MiniAppHttpQueryInput = {
|
|
208
|
+
name: string;
|
|
209
|
+
value: string;
|
|
210
|
+
/** Defaults to true when omitted. */
|
|
211
|
+
enabled?: boolean;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export declare type MiniAppHttpRequestInput = {
|
|
215
|
+
method: string;
|
|
216
|
+
url: string;
|
|
217
|
+
query?: MiniAppHttpQueryInput[];
|
|
218
|
+
headers?: MiniAppHttpHeaderInput[];
|
|
219
|
+
body?: string | null;
|
|
220
|
+
/** Defaults to 30 seconds and is capped by the host at 120 seconds. */
|
|
221
|
+
timeoutMs?: number | null;
|
|
222
|
+
/** Defaults to 5 MiB and is capped by the host at 10 MiB. */
|
|
223
|
+
responseBodyLimitBytes?: number | null;
|
|
224
|
+
/**
|
|
225
|
+
* Defaults to false. The host follows at most ten same-origin redirects;
|
|
226
|
+
* cross-origin redirects require a separate request and grant.
|
|
227
|
+
*/
|
|
228
|
+
followRedirects?: boolean | null;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export declare type MiniAppHttpRequestOptions = {
|
|
232
|
+
/**
|
|
233
|
+
* Opaque host-managed credential reference. Secret material never enters
|
|
234
|
+
* miniapp JavaScript.
|
|
235
|
+
*/
|
|
236
|
+
credentialRef?: string;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export declare type MiniAppHttpResponse = {
|
|
240
|
+
finalUrl: string;
|
|
241
|
+
status: number;
|
|
242
|
+
statusText: string;
|
|
243
|
+
/** Ordered entries; duplicate response header names remain separate. */
|
|
244
|
+
headers: MiniAppHttpHeader[];
|
|
245
|
+
bodyText: string | null;
|
|
246
|
+
bodyBase64: string | null;
|
|
247
|
+
bodyKind: 'text' | 'binary';
|
|
248
|
+
bodyTruncated: boolean;
|
|
249
|
+
sizeBytes: number;
|
|
250
|
+
elapsedMs: number;
|
|
251
|
+
contentType: string | null;
|
|
252
|
+
};
|
|
253
|
+
|
|
157
254
|
/** JSON-compatible values accepted by public miniapp operations. */
|
|
158
255
|
export declare type MiniAppJsonValue = null | boolean | number | string | MiniAppJsonValue[] | {
|
|
159
256
|
[key: string]: MiniAppJsonValue;
|
|
@@ -245,6 +342,12 @@ export declare type MiniAppPlatformApi = {
|
|
|
245
342
|
open(options: OpenNavigationOptions): void | Promise<void>;
|
|
246
343
|
};
|
|
247
344
|
chat: MiniAppChatApi;
|
|
345
|
+
storage: MiniAppStorageApi;
|
|
346
|
+
presence: MiniAppPresenceApi;
|
|
347
|
+
/** Desktop host capability; feature-detect before use on portable targets. */
|
|
348
|
+
http?: MiniAppHttpApi;
|
|
349
|
+
/** Desktop host capability; feature-detect before use on portable targets. */
|
|
350
|
+
credentials?: MiniAppCredentialsApi;
|
|
248
351
|
/** Browser capabilities appear only when the selected target supports them. */
|
|
249
352
|
auth?: MiniAppAuthApi;
|
|
250
353
|
vfs?: MiniAppVfsApi;
|
|
@@ -253,6 +356,41 @@ export declare type MiniAppPlatformApi = {
|
|
|
253
356
|
hasHostHttpRequest?: boolean;
|
|
254
357
|
};
|
|
255
358
|
|
|
359
|
+
export declare type MiniAppPresenceAddress = {
|
|
360
|
+
namespace: string;
|
|
361
|
+
room: string;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Ephemeral realtime presence scoped by the host to the active workspace and
|
|
366
|
+
* exact package. Participant identity is stamped by the host, not the app.
|
|
367
|
+
*/
|
|
368
|
+
export declare type MiniAppPresenceApi = {
|
|
369
|
+
join(options: MiniAppPresenceUpdateOptions): MiniAppMaybePromise<MiniAppPresenceSnapshot>;
|
|
370
|
+
update(options: MiniAppPresenceUpdateOptions): MiniAppMaybePromise<MiniAppPresenceSnapshot>;
|
|
371
|
+
leave(options: MiniAppPresenceAddress): MiniAppMaybePromise<void>;
|
|
372
|
+
subscribe(options: MiniAppPresenceAddress, listener: MiniAppPresenceListener): () => void;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
export declare type MiniAppPresenceListener = (snapshot: MiniAppPresenceSnapshot) => void;
|
|
376
|
+
|
|
377
|
+
export declare type MiniAppPresenceParticipant = {
|
|
378
|
+
/** Host-derived, ephemeral participant identity. */
|
|
379
|
+
participantId: string;
|
|
380
|
+
displayName: string;
|
|
381
|
+
state: MiniAppJsonValue;
|
|
382
|
+
updatedAtMs: number;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export declare type MiniAppPresenceSnapshot = MiniAppPresenceAddress & {
|
|
386
|
+
selfParticipantId: string;
|
|
387
|
+
participants: MiniAppPresenceParticipant[];
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
export declare type MiniAppPresenceUpdateOptions = MiniAppPresenceAddress & {
|
|
391
|
+
state: MiniAppJsonValue;
|
|
392
|
+
};
|
|
393
|
+
|
|
256
394
|
export declare type MiniAppProject = {
|
|
257
395
|
id: string;
|
|
258
396
|
name: string;
|
|
@@ -352,6 +490,43 @@ export declare type MiniAppSpecialistTurnResult = {
|
|
|
352
490
|
};
|
|
353
491
|
};
|
|
354
492
|
|
|
493
|
+
/** Caller-selected partition inside the host-derived workspace/package scope. */
|
|
494
|
+
export declare type MiniAppStorageAddress = {
|
|
495
|
+
namespace: string;
|
|
496
|
+
key: string;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Durable, non-secret JSON storage. The host derives workspace and package
|
|
501
|
+
* identity from the authenticated frame; apps control only the namespace and
|
|
502
|
+
* key inside that scope.
|
|
503
|
+
*/
|
|
504
|
+
export declare type MiniAppStorageApi = {
|
|
505
|
+
get(options: MiniAppStorageAddress): MiniAppMaybePromise<MiniAppStorageEntry>;
|
|
506
|
+
set(options: MiniAppStorageSetOptions): MiniAppMaybePromise<MiniAppStorageMutationResult>;
|
|
507
|
+
delete(options: MiniAppStorageDeleteOptions): MiniAppMaybePromise<void>;
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
export declare type MiniAppStorageDeleteOptions = MiniAppStorageAddress & {
|
|
511
|
+
expectedRevision: number;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
export declare type MiniAppStorageEntry = {
|
|
515
|
+
value: MiniAppJsonValue | null;
|
|
516
|
+
/** Null means that no value currently exists at this address. */
|
|
517
|
+
revision: number | null;
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
export declare type MiniAppStorageMutationResult = {
|
|
521
|
+
revision: number;
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
export declare type MiniAppStorageSetOptions = MiniAppStorageAddress & {
|
|
525
|
+
value: MiniAppJsonValue;
|
|
526
|
+
/** Optimistic concurrency token returned by `get`; null creates a missing key. */
|
|
527
|
+
expectedRevision: number | null;
|
|
528
|
+
};
|
|
529
|
+
|
|
355
530
|
export declare type MiniAppUserProfile = {
|
|
356
531
|
sub: string;
|
|
357
532
|
name?: string | null;
|
|
@@ -455,7 +630,7 @@ export declare type UIEntrypoint = {
|
|
|
455
630
|
};
|
|
456
631
|
|
|
457
632
|
/**
|
|
458
|
-
* @capability
|
|
633
|
+
* @capability miniapp-platform
|
|
459
634
|
*/
|
|
460
635
|
export declare type UIEntrypointType = 'workspace-left-sidebar' | 'workspace-left-sidebar-item' | 'chat-right-sidebar' | 'chat-right-sidebar-item';
|
|
461
636
|
|
package/dist/index.js
CHANGED
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Preserve the inferred tool signatures for a package-runtime MCP server. */
|
|
2
|
+
export declare function defineMcpServer<const TServer extends McpServerDefinition>(server: TServer): TServer;
|
|
3
|
+
|
|
4
|
+
declare type JsonSchema = {
|
|
5
|
+
readonly [key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** The tools exposed by one package-runtime MCP server. */
|
|
9
|
+
export declare type McpServerDefinition = {
|
|
10
|
+
tools: Record<string, McpServerToolDefinition>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** One tool implemented by a package-runtime MCP server. */
|
|
14
|
+
export declare type McpServerToolDefinition<TArguments extends MiniAppJsonValue = MiniAppJsonValue, TResult extends MiniAppJsonValue = MiniAppJsonValue> = {
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema: JsonSchema;
|
|
17
|
+
execute(arguments_: TArguments): MiniAppMaybePromise<TResult>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** JSON-compatible values accepted by public miniapp operations. */
|
|
21
|
+
declare type MiniAppJsonValue = null | boolean | number | string | MiniAppJsonValue[] | {
|
|
22
|
+
[key: string]: MiniAppJsonValue;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
declare type MiniAppMaybePromise<T> = T | Promise<T>;
|
|
26
|
+
|
|
27
|
+
export { }
|
package/dist/mcp.js
ADDED