@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 CHANGED
@@ -54,6 +54,28 @@ are not SDK capabilities. Job-key journaling suppresses
54
54
  routine reconnect duplicates, but physical exactly-once printing is impossible;
55
55
  every result therefore carries `physicalExactlyOnce: false`.
56
56
 
57
+ ## Terminal sessions in 0.3.0
58
+
59
+ `sdk.terminal?.v1` is an optional desktop-only terminal session API introduced
60
+ in SDK 0.3.0. It exposes
61
+ only the fixed `workspace-shell` and `neovim` profiles; package code cannot
62
+ choose an executable, environment, native terminal ID, working directory, or
63
+ filesystem path. `open()` returns a host-owned session with ordered binary
64
+ events, acknowledged binary writes, resize, and idempotent close. A dedicated
65
+ per-session channel applies byte credit and bounded buffering, so terminal
66
+ output never uses the ordinary miniapp host-action bridge as a data plane.
67
+ Packages opening a session declare the selected `terminal` profile and the
68
+ `filesystem-mount` resource `conversation-vfs:read-write`, plus the persisted
69
+ `terminal.session.open`, `filesystem.read`, and `filesystem.write` actions.
70
+ Capability discovery is authoritative: the initial host reports both profiles
71
+ unavailable. `workspace-shell` waits for positive conversation-scoped read
72
+ isolation, and `neovim` additionally waits for an integrity-locked runtime.
73
+
74
+ See the
75
+ [terminal API reference](https://docs.theaiplatform.app/miniapps/reference/sdk#terminal-sessions)
76
+ for capability detection, the required descriptor authorization, session
77
+ events, limits, and cleanup.
78
+
57
79
  ## Discovery metadata
58
80
 
59
81
  Descriptor-backed packages may assign up to three unique
@@ -600,27 +600,6 @@
600
600
  ],
601
601
  "type": "string"
602
602
  },
603
- "MiniAppReferencesManifest": {
604
- "additionalProperties": false,
605
- "description": "Manifest that references built TAP miniapp manifests.",
606
- "properties": {
607
- "$schema": {
608
- "description": "Optional JSON Schema reference for editor support.",
609
- "type": ["string", "null"]
610
- },
611
- "references": {
612
- "description": "References to built TAP miniapp manifests.\n\nString shorthand remains available for local and mutable development sources. An\nimmutable remote collection uses the object form (`{ \"url\": ..., \"hash\": ... }`) so\nevery child manifest carries its own SHA-256 integrity boundary.",
613
- "items": {
614
- "$ref": "#/$defs/MiniAppSource"
615
- },
616
- "minItems": 1,
617
- "type": "array"
618
- }
619
- },
620
- "required": ["references"],
621
- "title": "Tap Miniapp References Manifest",
622
- "type": "object"
623
- },
624
603
  "MiniAppSource": {
625
604
  "description": "Absolute URL or local path. Bundle entry paths are resolved relative to the manifest that declares them.",
626
605
  "oneOf": [
@@ -3694,12 +3673,8 @@
3694
3673
  {
3695
3674
  "$ref": "#/$defs/MiniAppBundleManifest",
3696
3675
  "description": "A single miniapp bundle with its runtime entrypoint."
3697
- },
3698
- {
3699
- "$ref": "#/$defs/MiniAppReferencesManifest",
3700
- "description": "A collection manifest that points at built miniapp manifests."
3701
3676
  }
3702
3677
  ],
3703
- "description": "Manifest for a Tap miniapp bundle or a collection of built miniapps.",
3678
+ "description": "Manifest for one Tap package or legacy miniapp bundle.",
3704
3679
  "title": "Tap Miniapp Manifest"
3705
3680
  }
package/dist/index.d.ts CHANGED
@@ -355,6 +355,8 @@ export declare type MiniAppPlatformApi = {
355
355
  credentials?: MiniAppCredentialsApi;
356
356
  /** Desktop host capability; feature-detect before use on portable targets. */
357
357
  printing?: MiniAppReceiptPrintingApi;
358
+ /** Desktop host capability; feature-detect before opening a terminal. */
359
+ terminal?: MiniAppTerminalApi;
358
360
  /** Browser capabilities appear only when the selected target supports them. */
359
361
  auth?: MiniAppAuthApi;
360
362
  vfs?: MiniAppVfsApi;
@@ -620,6 +622,76 @@ export declare type MiniAppStorageSetOptions = MiniAppStorageAddress & {
620
622
  expectedRevision: number | null;
621
623
  };
622
624
 
625
+ export declare type MiniAppTerminalApi = {
626
+ readonly v1: MiniAppTerminalV1Api;
627
+ };
628
+
629
+ /** Versioned, desktop-only host terminal capability. */
630
+ export declare type MiniAppTerminalV1Api = {
631
+ getCapabilities(): Promise<MiniAppTerminalV1Capabilities>;
632
+ open(options: MiniAppTerminalV1OpenOptions): Promise<MiniAppTerminalV1Session>;
633
+ };
634
+
635
+ export declare type MiniAppTerminalV1Capabilities = {
636
+ profiles: MiniAppTerminalV1Profile[];
637
+ limits: MiniAppTerminalV1Limits;
638
+ };
639
+
640
+ export declare type MiniAppTerminalV1DataEvent = {
641
+ type: 'data';
642
+ sequence: number;
643
+ data: Uint8Array;
644
+ };
645
+
646
+ export declare type MiniAppTerminalV1Event = MiniAppTerminalV1DataEvent | MiniAppTerminalV1ExitEvent;
647
+
648
+ export declare type MiniAppTerminalV1ExitEvent = {
649
+ type: 'exit';
650
+ sequence: number;
651
+ code: number | null;
652
+ signal: string | null;
653
+ reason: 'exited' | 'closed' | 'revoked' | 'error';
654
+ };
655
+
656
+ export declare type MiniAppTerminalV1Limits = {
657
+ maxSessionsPerDocument: number;
658
+ maxWriteBytes: number;
659
+ maxOutputBytesInFlight: number;
660
+ maxCols: number;
661
+ maxRows: number;
662
+ };
663
+
664
+ export declare type MiniAppTerminalV1OpenOptions = {
665
+ profile: MiniAppTerminalV1ProfileId;
666
+ cols: number;
667
+ rows: number;
668
+ };
669
+
670
+ export declare type MiniAppTerminalV1Profile = {
671
+ id: MiniAppTerminalV1ProfileId;
672
+ available: boolean;
673
+ unavailableReason: string | null;
674
+ };
675
+
676
+ /** Host-owned terminal runtime profiles exposed by `sdk.terminal.v1`. */
677
+ export declare type MiniAppTerminalV1ProfileId = 'workspace-shell' | 'neovim';
678
+
679
+ export declare type MiniAppTerminalV1ResizeOptions = {
680
+ cols: number;
681
+ rows: number;
682
+ };
683
+
684
+ export declare type MiniAppTerminalV1Session = {
685
+ /** Opaque host-minted session identity; it carries no ambient authority. */
686
+ readonly id: string;
687
+ readonly profile: MiniAppTerminalV1ProfileId;
688
+ /** Ordered output with byte-sized backpressure owned by the host session. */
689
+ readonly events: ReadableStream<MiniAppTerminalV1Event>;
690
+ write(data: Uint8Array): Promise<void>;
691
+ resize(options: MiniAppTerminalV1ResizeOptions): Promise<void>;
692
+ close(): Promise<void>;
693
+ };
694
+
623
695
  export declare type MiniAppUserProfile = {
624
696
  sub: string;
625
697
  name?: string | null;