@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/dist/sdk.d.ts CHANGED
@@ -99,7 +99,7 @@ export declare type MiniAppAuthApi = {
99
99
  };
100
100
 
101
101
  /**
102
- * @capability integrations-and-marketplace
102
+ * @capability miniapp-platform
103
103
  */
104
104
  export declare type MiniAppChannel = {
105
105
  roomId: string;
@@ -143,6 +143,85 @@ export declare type MiniAppCreateSpecialistResult = {
143
143
  isActive: boolean;
144
144
  };
145
145
 
146
+ /** Metadata-only access to host-managed credentials in the active workspace. */
147
+ export declare type MiniAppCredentialsApi = {
148
+ listHttp(): MiniAppMaybePromise<MiniAppHttpCredentialMetadata[]>;
149
+ };
150
+
151
+ /** Host-mediated bounded HTTP(S); browser fetch is not the authority. */
152
+ export declare type MiniAppHttpApi = {
153
+ request(input: MiniAppHttpRequestInput, options?: MiniAppHttpRequestOptions): MiniAppMaybePromise<MiniAppHttpResponse>;
154
+ };
155
+
156
+ /** Metadata-only stored HTTP credential. Secret fields never cross IPC. */
157
+ export declare type MiniAppHttpCredentialMetadata = {
158
+ id: string;
159
+ credentialType: MiniAppHttpCredentialType;
160
+ displayName: string;
161
+ metadataFields: Record<string, string>;
162
+ };
163
+
164
+ export declare type MiniAppHttpCredentialType = 'http_bearer' | 'http_basic' | 'http_header_auth' | 'http_api_key';
165
+
166
+ export declare type MiniAppHttpHeader = {
167
+ name: string;
168
+ value: string;
169
+ };
170
+
171
+ export declare type MiniAppHttpHeaderInput = {
172
+ name: string;
173
+ value: string;
174
+ /** Defaults to true when omitted. */
175
+ enabled?: boolean;
176
+ };
177
+
178
+ export declare type MiniAppHttpQueryInput = {
179
+ name: string;
180
+ value: string;
181
+ /** Defaults to true when omitted. */
182
+ enabled?: boolean;
183
+ };
184
+
185
+ export declare type MiniAppHttpRequestInput = {
186
+ method: string;
187
+ url: string;
188
+ query?: MiniAppHttpQueryInput[];
189
+ headers?: MiniAppHttpHeaderInput[];
190
+ body?: string | null;
191
+ /** Defaults to 30 seconds and is capped by the host at 120 seconds. */
192
+ timeoutMs?: number | null;
193
+ /** Defaults to 5 MiB and is capped by the host at 10 MiB. */
194
+ responseBodyLimitBytes?: number | null;
195
+ /**
196
+ * Defaults to false. The host follows at most ten same-origin redirects;
197
+ * cross-origin redirects require a separate request and grant.
198
+ */
199
+ followRedirects?: boolean | null;
200
+ };
201
+
202
+ export declare type MiniAppHttpRequestOptions = {
203
+ /**
204
+ * Opaque host-managed credential reference. Secret material never enters
205
+ * miniapp JavaScript.
206
+ */
207
+ credentialRef?: string;
208
+ };
209
+
210
+ export declare type MiniAppHttpResponse = {
211
+ finalUrl: string;
212
+ status: number;
213
+ statusText: string;
214
+ /** Ordered entries; duplicate response header names remain separate. */
215
+ headers: MiniAppHttpHeader[];
216
+ bodyText: string | null;
217
+ bodyBase64: string | null;
218
+ bodyKind: 'text' | 'binary';
219
+ bodyTruncated: boolean;
220
+ sizeBytes: number;
221
+ elapsedMs: number;
222
+ contentType: string | null;
223
+ };
224
+
146
225
  /** JSON-compatible values accepted by public miniapp operations. */
147
226
  export declare type MiniAppJsonValue = null | boolean | number | string | MiniAppJsonValue[] | {
148
227
  [key: string]: MiniAppJsonValue;
@@ -234,6 +313,12 @@ export declare type MiniAppPlatformApi = {
234
313
  open(options: OpenNavigationOptions): void | Promise<void>;
235
314
  };
236
315
  chat: MiniAppChatApi;
316
+ storage: MiniAppStorageApi;
317
+ presence: MiniAppPresenceApi;
318
+ /** Desktop host capability; feature-detect before use on portable targets. */
319
+ http?: MiniAppHttpApi;
320
+ /** Desktop host capability; feature-detect before use on portable targets. */
321
+ credentials?: MiniAppCredentialsApi;
237
322
  /** Browser capabilities appear only when the selected target supports them. */
238
323
  auth?: MiniAppAuthApi;
239
324
  vfs?: MiniAppVfsApi;
@@ -242,6 +327,41 @@ export declare type MiniAppPlatformApi = {
242
327
  hasHostHttpRequest?: boolean;
243
328
  };
244
329
 
330
+ export declare type MiniAppPresenceAddress = {
331
+ namespace: string;
332
+ room: string;
333
+ };
334
+
335
+ /**
336
+ * Ephemeral realtime presence scoped by the host to the active workspace and
337
+ * exact package. Participant identity is stamped by the host, not the app.
338
+ */
339
+ export declare type MiniAppPresenceApi = {
340
+ join(options: MiniAppPresenceUpdateOptions): MiniAppMaybePromise<MiniAppPresenceSnapshot>;
341
+ update(options: MiniAppPresenceUpdateOptions): MiniAppMaybePromise<MiniAppPresenceSnapshot>;
342
+ leave(options: MiniAppPresenceAddress): MiniAppMaybePromise<void>;
343
+ subscribe(options: MiniAppPresenceAddress, listener: MiniAppPresenceListener): () => void;
344
+ };
345
+
346
+ export declare type MiniAppPresenceListener = (snapshot: MiniAppPresenceSnapshot) => void;
347
+
348
+ export declare type MiniAppPresenceParticipant = {
349
+ /** Host-derived, ephemeral participant identity. */
350
+ participantId: string;
351
+ displayName: string;
352
+ state: MiniAppJsonValue;
353
+ updatedAtMs: number;
354
+ };
355
+
356
+ export declare type MiniAppPresenceSnapshot = MiniAppPresenceAddress & {
357
+ selfParticipantId: string;
358
+ participants: MiniAppPresenceParticipant[];
359
+ };
360
+
361
+ export declare type MiniAppPresenceUpdateOptions = MiniAppPresenceAddress & {
362
+ state: MiniAppJsonValue;
363
+ };
364
+
245
365
  export declare type MiniAppProject = {
246
366
  id: string;
247
367
  name: string;
@@ -341,6 +461,43 @@ export declare type MiniAppSpecialistTurnResult = {
341
461
  };
342
462
  };
343
463
 
464
+ /** Caller-selected partition inside the host-derived workspace/package scope. */
465
+ export declare type MiniAppStorageAddress = {
466
+ namespace: string;
467
+ key: string;
468
+ };
469
+
470
+ /**
471
+ * Durable, non-secret JSON storage. The host derives workspace and package
472
+ * identity from the authenticated frame; apps control only the namespace and
473
+ * key inside that scope.
474
+ */
475
+ export declare type MiniAppStorageApi = {
476
+ get(options: MiniAppStorageAddress): MiniAppMaybePromise<MiniAppStorageEntry>;
477
+ set(options: MiniAppStorageSetOptions): MiniAppMaybePromise<MiniAppStorageMutationResult>;
478
+ delete(options: MiniAppStorageDeleteOptions): MiniAppMaybePromise<void>;
479
+ };
480
+
481
+ export declare type MiniAppStorageDeleteOptions = MiniAppStorageAddress & {
482
+ expectedRevision: number;
483
+ };
484
+
485
+ export declare type MiniAppStorageEntry = {
486
+ value: MiniAppJsonValue | null;
487
+ /** Null means that no value currently exists at this address. */
488
+ revision: number | null;
489
+ };
490
+
491
+ export declare type MiniAppStorageMutationResult = {
492
+ revision: number;
493
+ };
494
+
495
+ export declare type MiniAppStorageSetOptions = MiniAppStorageAddress & {
496
+ value: MiniAppJsonValue;
497
+ /** Optimistic concurrency token returned by `get`; null creates a missing key. */
498
+ expectedRevision: number | null;
499
+ };
500
+
344
501
  export declare type MiniAppUserProfile = {
345
502
  sub: string;
346
503
  name?: string | null;
package/dist/surface.d.ts CHANGED
@@ -38,7 +38,7 @@ export declare interface TapFederatedSurfaceMountContext {
38
38
  }
39
39
 
40
40
  /**
41
- * @capability integrations-and-marketplace
41
+ * @capability miniapp-platform
42
42
  */
43
43
  /** Declared package-event channel supplied to an isolated UI contribution. */
44
44
  export declare interface TapPackageEventPublisher {