@theaiplatform/miniapp-sdk 0.2.4 → 0.3.0
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 +22 -0
- package/config-schema.json +1 -26
- package/dist/index.d.ts +72 -0
- package/dist/rspack/index.js +497 -10
- package/dist/sdk.d.ts +72 -0
- package/dist/ui/wasm.js +5 -3
- package/dist/ui.js +5 -3
- package/dist/web.d.ts +72 -0
- package/package.json +1 -1
package/dist/sdk.d.ts
CHANGED
|
@@ -326,6 +326,8 @@ export declare type MiniAppPlatformApi = {
|
|
|
326
326
|
credentials?: MiniAppCredentialsApi;
|
|
327
327
|
/** Desktop host capability; feature-detect before use on portable targets. */
|
|
328
328
|
printing?: MiniAppReceiptPrintingApi;
|
|
329
|
+
/** Desktop host capability; feature-detect before opening a terminal. */
|
|
330
|
+
terminal?: MiniAppTerminalApi;
|
|
329
331
|
/** Browser capabilities appear only when the selected target supports them. */
|
|
330
332
|
auth?: MiniAppAuthApi;
|
|
331
333
|
vfs?: MiniAppVfsApi;
|
|
@@ -591,6 +593,76 @@ export declare type MiniAppStorageSetOptions = MiniAppStorageAddress & {
|
|
|
591
593
|
expectedRevision: number | null;
|
|
592
594
|
};
|
|
593
595
|
|
|
596
|
+
export declare type MiniAppTerminalApi = {
|
|
597
|
+
readonly v1: MiniAppTerminalV1Api;
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/** Versioned, desktop-only host terminal capability. */
|
|
601
|
+
export declare type MiniAppTerminalV1Api = {
|
|
602
|
+
getCapabilities(): Promise<MiniAppTerminalV1Capabilities>;
|
|
603
|
+
open(options: MiniAppTerminalV1OpenOptions): Promise<MiniAppTerminalV1Session>;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
export declare type MiniAppTerminalV1Capabilities = {
|
|
607
|
+
profiles: MiniAppTerminalV1Profile[];
|
|
608
|
+
limits: MiniAppTerminalV1Limits;
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
export declare type MiniAppTerminalV1DataEvent = {
|
|
612
|
+
type: 'data';
|
|
613
|
+
sequence: number;
|
|
614
|
+
data: Uint8Array;
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
export declare type MiniAppTerminalV1Event = MiniAppTerminalV1DataEvent | MiniAppTerminalV1ExitEvent;
|
|
618
|
+
|
|
619
|
+
export declare type MiniAppTerminalV1ExitEvent = {
|
|
620
|
+
type: 'exit';
|
|
621
|
+
sequence: number;
|
|
622
|
+
code: number | null;
|
|
623
|
+
signal: string | null;
|
|
624
|
+
reason: 'exited' | 'closed' | 'revoked' | 'error';
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
export declare type MiniAppTerminalV1Limits = {
|
|
628
|
+
maxSessionsPerDocument: number;
|
|
629
|
+
maxWriteBytes: number;
|
|
630
|
+
maxOutputBytesInFlight: number;
|
|
631
|
+
maxCols: number;
|
|
632
|
+
maxRows: number;
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
export declare type MiniAppTerminalV1OpenOptions = {
|
|
636
|
+
profile: MiniAppTerminalV1ProfileId;
|
|
637
|
+
cols: number;
|
|
638
|
+
rows: number;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
export declare type MiniAppTerminalV1Profile = {
|
|
642
|
+
id: MiniAppTerminalV1ProfileId;
|
|
643
|
+
available: boolean;
|
|
644
|
+
unavailableReason: string | null;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
/** Host-owned terminal runtime profiles exposed by `sdk.terminal.v1`. */
|
|
648
|
+
export declare type MiniAppTerminalV1ProfileId = 'workspace-shell' | 'neovim';
|
|
649
|
+
|
|
650
|
+
export declare type MiniAppTerminalV1ResizeOptions = {
|
|
651
|
+
cols: number;
|
|
652
|
+
rows: number;
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
export declare type MiniAppTerminalV1Session = {
|
|
656
|
+
/** Opaque host-minted session identity; it carries no ambient authority. */
|
|
657
|
+
readonly id: string;
|
|
658
|
+
readonly profile: MiniAppTerminalV1ProfileId;
|
|
659
|
+
/** Ordered output with byte-sized backpressure owned by the host session. */
|
|
660
|
+
readonly events: ReadableStream<MiniAppTerminalV1Event>;
|
|
661
|
+
write(data: Uint8Array): Promise<void>;
|
|
662
|
+
resize(options: MiniAppTerminalV1ResizeOptions): Promise<void>;
|
|
663
|
+
close(): Promise<void>;
|
|
664
|
+
};
|
|
665
|
+
|
|
594
666
|
export declare type MiniAppUserProfile = {
|
|
595
667
|
sub: string;
|
|
596
668
|
name?: string | null;
|
package/dist/ui/wasm.js
CHANGED
|
@@ -6,7 +6,7 @@ import { clsx } from "clsx";
|
|
|
6
6
|
import { twMerge } from "tailwind-merge";
|
|
7
7
|
import { Slot as react_slot_Slot } from "@radix-ui/react-slot";
|
|
8
8
|
import "prism-react-renderer";
|
|
9
|
-
import {
|
|
9
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
10
10
|
import { useCallback as external_react_useCallback, useEffect, useRef } from "react";
|
|
11
11
|
import "react-resizable-panels";
|
|
12
12
|
import "@radix-ui/react-scroll-area";
|
|
@@ -626,6 +626,7 @@ DialogContentPrimitive.displayName = __rspack_external__radix_ui_react_dialog_da
|
|
|
626
626
|
function DialogContent({ className, children, ref, container, hideCloseButton, onOpenAutoFocus, onEscapeKeyDown, ...props }) {
|
|
627
627
|
const { ref: occlusionRef, ready } = native_view_occlusion_useNativeViewOcclusion();
|
|
628
628
|
const contentRef = __rspack_external_react.useRef(null);
|
|
629
|
+
const composedContentRef = useComposedRefs(ref, contentRef);
|
|
629
630
|
const closeButtonRef = __rspack_external_react.useRef(null);
|
|
630
631
|
const shouldFocusWhenReadyRef = __rspack_external_react.useRef(false);
|
|
631
632
|
const handleOpenAutoFocus = __rspack_external_react.useCallback((event)=>{
|
|
@@ -670,7 +671,7 @@ function DialogContent({ className, children, ref, container, hideCloseButton, o
|
|
|
670
671
|
bottom: 'var(--chat-input-offset, 0px)'
|
|
671
672
|
} : void 0
|
|
672
673
|
}, /*#__PURE__*/ __rspack_external_react.createElement(DialogContentPrimitive, {
|
|
673
|
-
ref:
|
|
674
|
+
ref: composedContentRef,
|
|
674
675
|
className: utils_cn('bg-surface-level-1 pointer-events-auto relative grid max-h-full w-full max-w-lg min-w-0 gap-4 overflow-auto rounded-3xl border p-8 break-words shadow-lg', className),
|
|
675
676
|
...container ? {
|
|
676
677
|
onInteractOutside: (e)=>{
|
|
@@ -1348,8 +1349,9 @@ function SelectScrollDownButton({ className, ref, ...props }) {
|
|
|
1348
1349
|
SelectScrollDownButton.displayName = __rspack_external__radix_ui_react_select_4606f4d3.ScrollDownButton.displayName;
|
|
1349
1350
|
function SelectContent({ className, children, position = 'popper', ref, ...props }) {
|
|
1350
1351
|
const { ref: occlusionRef, ready } = native_view_occlusion_useNativeViewOcclusion();
|
|
1352
|
+
const composedRef = useComposedRefs(ref, occlusionRef);
|
|
1351
1353
|
return /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_select_4606f4d3.Portal, null, /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_select_4606f4d3.Content, {
|
|
1352
|
-
ref:
|
|
1354
|
+
ref: composedRef,
|
|
1353
1355
|
className: utils_cn('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-(--z-popover) max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-lg shadow-sm data-[side=bottom]:origin-top data-[side=left]:origin-right data-[side=right]:origin-left data-[side=top]:origin-bottom', 'popper' === position && 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', !ready && 'invisible', className),
|
|
1354
1356
|
position: position,
|
|
1355
1357
|
...props
|
package/dist/ui.js
CHANGED
|
@@ -4,7 +4,7 @@ import { twMerge } from "tailwind-merge";
|
|
|
4
4
|
import { Slot } from "@radix-ui/react-slot";
|
|
5
5
|
import { Check, CheckIcon, ChevronDown, ChevronUp, Circle, CopyIcon, GripVertical, X, XIcon } from "lucide-react";
|
|
6
6
|
import { Highlight, themes } from "prism-react-renderer";
|
|
7
|
-
import {
|
|
7
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
8
8
|
import { useCallback, useEffect, useRef } from "react";
|
|
9
9
|
import { Group, Panel, Separator as external_react_resizable_panels_Separator } from "react-resizable-panels";
|
|
10
10
|
import * as __rspack_external_react from "react";
|
|
@@ -808,6 +808,7 @@ DialogContentPrimitive.displayName = __rspack_external__radix_ui_react_dialog_da
|
|
|
808
808
|
function DialogContent({ className, children, ref, container, hideCloseButton, onOpenAutoFocus, onEscapeKeyDown, ...props }) {
|
|
809
809
|
const { ref: occlusionRef, ready } = useNativeViewOcclusion();
|
|
810
810
|
const contentRef = __rspack_external_react.useRef(null);
|
|
811
|
+
const composedContentRef = useComposedRefs(ref, contentRef);
|
|
811
812
|
const closeButtonRef = __rspack_external_react.useRef(null);
|
|
812
813
|
const shouldFocusWhenReadyRef = __rspack_external_react.useRef(false);
|
|
813
814
|
const handleOpenAutoFocus = __rspack_external_react.useCallback((event)=>{
|
|
@@ -852,7 +853,7 @@ function DialogContent({ className, children, ref, container, hideCloseButton, o
|
|
|
852
853
|
bottom: 'var(--chat-input-offset, 0px)'
|
|
853
854
|
} : void 0
|
|
854
855
|
}, /*#__PURE__*/ __rspack_external_react.createElement(DialogContentPrimitive, {
|
|
855
|
-
ref:
|
|
856
|
+
ref: composedContentRef,
|
|
856
857
|
className: cn('bg-surface-level-1 pointer-events-auto relative grid max-h-full w-full max-w-lg min-w-0 gap-4 overflow-auto rounded-3xl border p-8 break-words shadow-lg', className),
|
|
857
858
|
...container ? {
|
|
858
859
|
onInteractOutside: (e)=>{
|
|
@@ -1725,8 +1726,9 @@ function SelectScrollDownButton({ className, ref, ...props }) {
|
|
|
1725
1726
|
SelectScrollDownButton.displayName = __rspack_external__radix_ui_react_select_4606f4d3.ScrollDownButton.displayName;
|
|
1726
1727
|
function SelectContent({ className, children, position = 'popper', ref, ...props }) {
|
|
1727
1728
|
const { ref: occlusionRef, ready } = useNativeViewOcclusion();
|
|
1729
|
+
const composedRef = useComposedRefs(ref, occlusionRef);
|
|
1728
1730
|
return /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_select_4606f4d3.Portal, null, /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_select_4606f4d3.Content, {
|
|
1729
|
-
ref:
|
|
1731
|
+
ref: composedRef,
|
|
1730
1732
|
className: cn('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-(--z-popover) max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-lg shadow-sm data-[side=bottom]:origin-top data-[side=left]:origin-right data-[side=right]:origin-left data-[side=top]:origin-bottom', 'popper' === position && 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', !ready && 'invisible', className),
|
|
1731
1733
|
position: position,
|
|
1732
1734
|
...props
|
package/dist/web.d.ts
CHANGED
|
@@ -367,6 +367,8 @@ export declare type MiniAppPlatformApi = {
|
|
|
367
367
|
credentials?: MiniAppCredentialsApi;
|
|
368
368
|
/** Desktop host capability; feature-detect before use on portable targets. */
|
|
369
369
|
printing?: MiniAppReceiptPrintingApi;
|
|
370
|
+
/** Desktop host capability; feature-detect before opening a terminal. */
|
|
371
|
+
terminal?: MiniAppTerminalApi;
|
|
370
372
|
/** Browser capabilities appear only when the selected target supports them. */
|
|
371
373
|
auth?: MiniAppAuthApi;
|
|
372
374
|
vfs?: MiniAppVfsApi;
|
|
@@ -632,6 +634,76 @@ declare type MiniAppStorageSetOptions = MiniAppStorageAddress & {
|
|
|
632
634
|
expectedRevision: number | null;
|
|
633
635
|
};
|
|
634
636
|
|
|
637
|
+
declare type MiniAppTerminalApi = {
|
|
638
|
+
readonly v1: MiniAppTerminalV1Api;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
/** Versioned, desktop-only host terminal capability. */
|
|
642
|
+
declare type MiniAppTerminalV1Api = {
|
|
643
|
+
getCapabilities(): Promise<MiniAppTerminalV1Capabilities>;
|
|
644
|
+
open(options: MiniAppTerminalV1OpenOptions): Promise<MiniAppTerminalV1Session>;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
declare type MiniAppTerminalV1Capabilities = {
|
|
648
|
+
profiles: MiniAppTerminalV1Profile[];
|
|
649
|
+
limits: MiniAppTerminalV1Limits;
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
declare type MiniAppTerminalV1DataEvent = {
|
|
653
|
+
type: 'data';
|
|
654
|
+
sequence: number;
|
|
655
|
+
data: Uint8Array;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
declare type MiniAppTerminalV1Event = MiniAppTerminalV1DataEvent | MiniAppTerminalV1ExitEvent;
|
|
659
|
+
|
|
660
|
+
declare type MiniAppTerminalV1ExitEvent = {
|
|
661
|
+
type: 'exit';
|
|
662
|
+
sequence: number;
|
|
663
|
+
code: number | null;
|
|
664
|
+
signal: string | null;
|
|
665
|
+
reason: 'exited' | 'closed' | 'revoked' | 'error';
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
declare type MiniAppTerminalV1Limits = {
|
|
669
|
+
maxSessionsPerDocument: number;
|
|
670
|
+
maxWriteBytes: number;
|
|
671
|
+
maxOutputBytesInFlight: number;
|
|
672
|
+
maxCols: number;
|
|
673
|
+
maxRows: number;
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
declare type MiniAppTerminalV1OpenOptions = {
|
|
677
|
+
profile: MiniAppTerminalV1ProfileId;
|
|
678
|
+
cols: number;
|
|
679
|
+
rows: number;
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
declare type MiniAppTerminalV1Profile = {
|
|
683
|
+
id: MiniAppTerminalV1ProfileId;
|
|
684
|
+
available: boolean;
|
|
685
|
+
unavailableReason: string | null;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
/** Host-owned terminal runtime profiles exposed by `sdk.terminal.v1`. */
|
|
689
|
+
declare type MiniAppTerminalV1ProfileId = 'workspace-shell' | 'neovim';
|
|
690
|
+
|
|
691
|
+
declare type MiniAppTerminalV1ResizeOptions = {
|
|
692
|
+
cols: number;
|
|
693
|
+
rows: number;
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
declare type MiniAppTerminalV1Session = {
|
|
697
|
+
/** Opaque host-minted session identity; it carries no ambient authority. */
|
|
698
|
+
readonly id: string;
|
|
699
|
+
readonly profile: MiniAppTerminalV1ProfileId;
|
|
700
|
+
/** Ordered output with byte-sized backpressure owned by the host session. */
|
|
701
|
+
readonly events: ReadableStream<MiniAppTerminalV1Event>;
|
|
702
|
+
write(data: Uint8Array): Promise<void>;
|
|
703
|
+
resize(options: MiniAppTerminalV1ResizeOptions): Promise<void>;
|
|
704
|
+
close(): Promise<void>;
|
|
705
|
+
};
|
|
706
|
+
|
|
635
707
|
export declare type MiniAppTheme = 'light' | 'dark';
|
|
636
708
|
|
|
637
709
|
export declare type MiniAppUiScale = number;
|