@tavora/sdk 0.0.0-stage → 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ What changed in `@tavora/sdk` and the bridge protocol it speaks, newest first. Before Tavora 1.0 the SDK may still change in ways that break modules; each such change raises the minor version (0.2 → 0.3) and is marked **Breaking** here. Anything else raises the patch version. To make sure players have a Tavora that knows what your module uses, set [`minTavora`](https://docs.mytavora.app/reference/manifest) in its manifest.
4
+
5
+ ## 0.2.5
6
+
7
+ - `pictures.save(png, name)`: saves a PNG as a new file in the player's `Pictures\Tavora` folder, right after a click or key press in the panel; resolves with the file name it got (Tavora 0.17.19). `MIN_TAVORA` is now `0.17.19`.
8
+
9
+ ## 0.2.4
10
+
11
+ - Opening another panel: `panels.open(type, { content })` opens one of the module's own panel types in the current game, right after a click or key press. Tavora brings forward a panel of that type already showing the content, else asks the one used last to switch through `panel.onNavigate(fn)` (save pending edits, then resolve; throw to refuse; 5 seconds), else opens a new one, whose `panel.getLaunch()` is `{ reason: "open", content }`. It resolves with `"shown"`, `"switched"`, `"opened"` or `"failed"`; when a switch fails, the player is offered the content in a new panel (Tavora 0.17.18). Set `minTavora` to `0.17.18` or newer when you use them.
12
+
13
+ ## 0.2.3
14
+
15
+ - Content per panel: `panel.setContent({ id, title } | null)` tells Tavora what the panel shows now, such as the build picked in your toolbar. Tavora keeps it with the panel across game switches and restarts and shows the title when the player hovers the tab. `panel.getLaunch()` says why the page is loading: `{ reason: "add" }` for a panel the player just added (pick the content yourself, such as the last one used), or `{ reason: "restore", content }` for one that was open before (Tavora 0.17.17). Set `minTavora` to `0.17.17` or newer when you use them.
16
+
17
+ ## 0.2.2
18
+
19
+ - `MIN_TAVORA`: the oldest Tavora that has everything this SDK version offers, for `minTavora` in your manifest.
20
+ - Panel types: a manifest may list `panels`, named tools such as Inventory and Build planner that players add, dock and copy on their own, all sharing the module's saved content and permissions. `panel.type` says which one a page runs as; the handshake carries it as `panel.type` (Tavora 0.17.12). Set `minTavora` to `0.17.12` or newer when you use them: an older Tavora refuses the `panels` field.
21
+
22
+ ## 0.2.1
23
+
24
+ - `ui.showMenu(request)`: a menu Tavora draws above every panel, so it is never cut off at the panel's edge. Items with an optional colour dot, check or radio mark, hint and danger style; separators; headings; one level of submenus. Only right after a click, right-click or key press in the panel; resolves with the chosen id or null (Tavora 0.17.9).
25
+
26
+ ## 0.2.0
27
+
28
+ Needs Tavora 0.17.8 or newer for `minTavora`; everything else works from the Tavora version named next to it.
29
+
30
+ - `minTavora` in the manifest: the oldest Tavora a module works with. An older Tavora refuses to install or load it and says why (Tavora 0.17.8).
31
+ - `connectors.discord`: the Discord app on the player's PC through Tavora's Discord sign-in: `state()`, `connect()`, `allowControl()`, `command()` for a fixed list of RPC commands, `subscribe()` and `onEvent()` for voice events, and `image()` for avatars and server icons. Needs `"discord"` in `permissions.connectors` and the player's consent (Tavora 0.16.11).
32
+ - `connectors.aiUsage`: the usage of the player's Claude and Codex accounts, without ever seeing a login. Needs `"ai-usage"` in `permissions.connectors` (Tavora 0.16.10).
33
+ - `storage.app`: small settings shared by every game, next to `storage` for the current game (Tavora 0.16.10).
34
+ - `network.fetch`: web requests to the hosts in `permissions.network`, after the player allowed them; HTTPS only, no cookies (Tavora 0.16.8).
35
+ - `clipboard.writeImage(png)`: puts a PNG on the clipboard right after a click or key press in the panel (Tavora 0.14.1).
36
+ - `blobs`: pictures a module keeps for a game, served from the module's own address (Tavora 0.12.0).
37
+ - `links.open(url)`: opens a web address in the game's Browser panel, right after a click or key press (Tavora 0.11.0).
38
+ - `ui.getLanguage()` and `ui.onLanguageChange()`: the language Tavora shows its texts in (Tavora 0.5.9).
39
+
40
+ ## 0.1.0
41
+
42
+ The first version: `connect()`, the current game, `storage`, `documents` with revisions and change events, panel state, the panel's size, the theme and its changes, and the suspend, resume and dispose lifecycle. Bridge protocol v1.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wellbrained
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @tavora/sdk
2
+
3
+ Typed client for [Tavora](https://mytavora.app) modules. A module is a web page that runs in a sandboxed panel inside Tavora Desktop; this package is how it talks to the host.
4
+
5
+ **Status:** bridge protocol v1, still before 1.0: a minor version can change things, and the [changelog](./CHANGELOG.md) says what and which Tavora a version needs.
6
+
7
+ Start a new module with `npm create @tavora/module` (or `pnpm create @tavora/module`), or add the SDK to your own project with `npm install @tavora/sdk`.
8
+
9
+ ```ts
10
+ import { connect, TavoraError } from "@tavora/sdk";
11
+
12
+ const tavora = await connect();
13
+ const game = await tavora.game.getCurrent(); // { id: "poe2", displayName: "Path of Exile 2" }
14
+
15
+ // Small settings, private to this module in this game.
16
+ const count = (await tavora.storage.get<number>("count")) ?? 0;
17
+ await tavora.storage.set("count", count + 1);
18
+
19
+ // Documents are shared by all panels of this module in this game.
20
+ const plan = await tavora.documents.get<{ steps: string[] }>("plan");
21
+ try {
22
+ await tavora.documents.put({ id: "plan", title: "Plan", data: { steps: ["Act 1"] }, ifRevision: plan?.revision ?? 0 });
23
+ } catch (error) {
24
+ if (error instanceof TavoraError && error.code === "CONFLICT") {
25
+ // Another panel saved first: reload instead of overwriting.
26
+ }
27
+ }
28
+ tavora.documents.onChange(({ id }) => console.log(`${id} changed in another panel`));
29
+
30
+ // State for this one panel (open tab, scroll position). Removed when the panel closes.
31
+ await tavora.panel.setState({ tab: "gear" });
32
+
33
+ tavora.workspace.onResize(({ width, height }) => {});
34
+ tavora.ui.onThemeChange((theme) => {});
35
+ tavora.lifecycle.onSuspend(() => {}); // hidden: pause timers and animations
36
+ tavora.lifecycle.onResume(() => {});
37
+ ```
38
+
39
+ `connect()` can be called any number of times and always returns the same connection. It rejects with a `TavoraError` when the page runs outside Tavora (`HOST_UNAVAILABLE`) or the host speaks another protocol version (`INCOMPATIBLE`).
40
+
41
+ Every failed call rejects with a `TavoraError`. Check `error.code`, not the message. The codes, limits and the wire format are in the [bridge protocol reference](https://docs.mytavora.app/reference/protocol); the manifest every module needs is in the [manifest reference](https://docs.mytavora.app/reference/manifest).
42
+
43
+ Values you store must be JSON. Type parameters such as `get<number>()` are not checked at runtime.
44
+
45
+ ## More from the host
46
+
47
+ | API | What it does |
48
+ | --- | --- |
49
+ | `tavora.storage.app` | The same small settings, shared by every game: for choices the player expects to stay the same from game to game. |
50
+ | `tavora.ui.getLanguage()`, `onLanguageChange` | The language of Tavora's own texts (`"en"`, `"de"`). Show your module in it, or in English when you have no translation. |
51
+ | `tavora.blobs` | Pictures too big for a document: up to 50 MB each and 500 MB per module and game. `put` a file, show it with `url(id)`. See [Files](https://docs.mytavora.app/reference/protocol#files-blobs). |
52
+ | `tavora.clipboard.writeImage(png)` | Puts a PNG on the system clipboard. Call it from the click or key press that asked for it. See [Clipboard](https://docs.mytavora.app/reference/protocol#clipboard). |
53
+ | `tavora.pictures.save(png, name)` | Saves a PNG in the player's `Pictures\Tavora` folder and resolves with the file name. Call it from the click or key press that asked for it. See [Saving pictures](https://docs.mytavora.app/reference/protocol#saving-pictures). |
54
+ | `tavora.links.open(url)` | Opens a web address in the game's Browser panel, from a click or key press. |
55
+ | `tavora.network.fetch(url, init)` | A web request to a host listed in `permissions.network`, once the player granted it. See [Network](https://docs.mytavora.app/reference/protocol#network). |
56
+ | `tavora.connectors.aiUsage` | The usage of the player's Claude and Codex accounts, with the `ai-usage` connector. |
57
+ | `tavora.connectors.discord` | The Discord app on this PC through Tavora's Discord sign-in, with the `discord` connector: voice channels, mute and deafen, voice events. |
58
+
59
+ What needs the player's permission (`permissions.network` and `permissions.connectors` in the [manifest](https://docs.mytavora.app/reference/manifest)) works only once the player has granted it: they are asked when they add the module and can take it back in Settings > Integrations. Until then the call fails with `PERMISSION_DENIED`; `tavora.host.capabilities` lists what was granted when the module connected. See [Capabilities](https://docs.mytavora.app/reference/protocol#capabilities) and [Connectors](https://docs.mytavora.app/reference/protocol#connectors).
60
+
61
+ ## Examples
62
+
63
+ The same small module built three ways: [vanilla TypeScript](https://github.com/wellbrained/tavora/tree/main/examples/vanilla-module), [React](https://github.com/wellbrained/tavora/tree/main/examples/react-module) and [Vue](https://github.com/wellbrained/tavora/tree/main/examples/vue-module).
64
+
65
+ ## Building a module
66
+
67
+ - Bundle everything. A module's page has no network access, so no CDN scripts, web fonts or remote images. To reach a web API, list its host in `permissions.network` and use `tavora.network.fetch` once the player has granted it.
68
+ - Use relative asset paths (Vite: `base: "./"`). The page is served from `tavora-module://<module-id>/`.
69
+ - Point the manifest's `entry` at the built HTML file.
@@ -0,0 +1,216 @@
1
+ import { type AiUsageAccountInfo, type AiUsageReading, type BlobInfo, type BlobUsage, type Capability, type DiscordCommand, type DiscordCommands, type DiscordEvent, type DiscordEventName, type DiscordResult, type DiscordState, type DocumentChange, type DocumentSummary, type ErrorCode, type ErrorPayload, type HandshakeResult, type JsonValue, type MenuRequest, type NetworkRequest, type NetworkResponse, type PanelContent, type PanelLaunch, type PanelOpenResult, type PutDocumentParams, type TavoraDocument, type TavoraGame, type TavoraTheme, type TavoraViewport } from "./protocol.js";
2
+ export type { AiUsageAccountInfo, AiUsageReading, BlobInfo, BlobType, BlobUsage, Capability, DiscordCommand, DiscordCommands, DiscordEvent, DiscordEventName, DiscordResult, DiscordState, DocumentChange, DocumentSummary, ErrorCode, HandshakeResult, JsonValue, MenuEntry, MenuRequest, NetworkRequest, NetworkResponse, PanelContent, PanelLaunch, PanelOpenResult, PutDocumentParams, TavoraDocument, TavoraGame, TavoraTheme, TavoraViewport, ThemeToken, } from "./protocol.js";
3
+ export { BLOB_ID, BLOB_TYPES, DISCORD_COMMANDS, DISCORD_EVENTS, LIMITS, PROTOCOL_VERSION, THEME_TOKENS } from "./protocol.js";
4
+ /** Version of this SDK package, sent to the host during the handshake. */
5
+ export declare const SDK_VERSION = "0.2.5";
6
+ /**
7
+ * The oldest Tavora that has everything this SDK version offers. Put it in your manifest as
8
+ * `minTavora`, so an older Tavora says it needs an update instead of loading a module it cannot run
9
+ * (the starter, `npm create @tavora/module`, does). The changelog names it for every version.
10
+ */
11
+ export declare const MIN_TAVORA = "0.17.19";
12
+ export declare class TavoraError extends Error {
13
+ readonly code: ErrorCode;
14
+ /** Set for PERMISSION_DENIED. */
15
+ readonly capability: Capability | undefined;
16
+ /** Set for CONFLICT: the document's current revision. */
17
+ readonly revision: number | undefined;
18
+ constructor(payload: ErrorPayload);
19
+ }
20
+ type Unsubscribe = () => void;
21
+ /** Small key/value settings: at most 5 MB of keys and values together, values plain JSON. */
22
+ export interface KeyValueStore {
23
+ /** T is not checked at runtime; the host only guarantees the value is JSON. */
24
+ get<T = JsonValue>(key: string): Promise<T | null>;
25
+ set(key: string, value: JsonValue): Promise<void>;
26
+ delete(key: string): Promise<void>;
27
+ keys(): Promise<string[]>;
28
+ }
29
+ export interface TavoraSDK {
30
+ /** What the host reported when this module connected. */
31
+ readonly host: HandshakeResult;
32
+ game: {
33
+ getCurrent(): Promise<TavoraGame>;
34
+ };
35
+ /** Small key/value settings, private to this module in the current game. */
36
+ storage: KeyValueStore & {
37
+ /** The same, shared by every game: settings that should not change from game to game. */
38
+ app: KeyValueStore;
39
+ };
40
+ /**
41
+ * Named documents (builds, plans, checklists), private to this module in
42
+ * the current game and shared by all of its panels.
43
+ */
44
+ documents: {
45
+ list(): Promise<DocumentSummary[]>;
46
+ get<T = JsonValue>(id: string): Promise<(TavoraDocument & {
47
+ data: T;
48
+ }) | null>;
49
+ /** Creates or replaces a document. Pass ifRevision to avoid overwriting another panel's change. */
50
+ put(document: PutDocumentParams): Promise<DocumentSummary>;
51
+ delete(id: string, options?: {
52
+ ifRevision?: number;
53
+ }): Promise<void>;
54
+ /** Fires when another panel of this module changes a document. */
55
+ onChange(fn: (change: DocumentChange) => void): Unsubscribe;
56
+ };
57
+ /** UI state for this one panel (selection, scroll, open tab). Cleared when the panel is closed. */
58
+ panel: {
59
+ /** Which of the manifest's `panels` this panel is, by id; null for a module without panel types (or an older Tavora). */
60
+ readonly type: string | null;
61
+ getState<T = JsonValue>(): Promise<T | null>;
62
+ setState(value: JsonValue | null): Promise<void>;
63
+ /**
64
+ * Why this page is loading: `{ reason: "add" }` for a panel the player just added (pick its content
65
+ * yourself, such as the last one used, or show a picker), or `{ reason: "restore", content }` for a panel
66
+ * that was open before, with what it last showed. Needs Tavora 0.17.17 or newer.
67
+ */
68
+ getLaunch(): Promise<PanelLaunch>;
69
+ /**
70
+ * Tells Tavora what this panel shows now, such as the build picked in your toolbar's selector, or null for
71
+ * nothing. Tavora keeps it with the panel, shows the title when the player hovers the tab, and gives it
72
+ * back through getLaunch after a restart. Needs Tavora 0.17.17 or newer.
73
+ */
74
+ setContent(content: PanelContent | null): Promise<void>;
75
+ /**
76
+ * Lets another panel of this module switch this one to other content (`panels.open`). The handler saves any
77
+ * pending edits and switches, then resolves; it throws (or rejects) when it cannot, and the panel keeps what it
78
+ * showed. It has 5 seconds. One handler per page: a new one replaces the last. Without one, Tavora opens a new
79
+ * panel instead of switching this one. Needs Tavora 0.17.18 or newer.
80
+ */
81
+ onNavigate(fn: (content: PanelContent) => void | Promise<void>): Unsubscribe;
82
+ };
83
+ /** The module's other panels. */
84
+ panels: {
85
+ /**
86
+ * Opens one of this module's own panel types in the current game, on `content` when given. Tavora brings
87
+ * forward a panel of that type already showing the content, else switches the one used last
88
+ * (`panel.onNavigate`), else opens a new one. Call it from the click or key press that asked for it: the host
89
+ * refuses it otherwise (PERMISSION_DENIED). Needs Tavora 0.17.18 or newer.
90
+ */
91
+ open(type: string, options?: {
92
+ content?: PanelContent;
93
+ }): Promise<PanelOpenResult>;
94
+ };
95
+ workspace: {
96
+ getViewport(): Promise<TavoraViewport>;
97
+ onResize(fn: (viewport: TavoraViewport) => void): Unsubscribe;
98
+ };
99
+ ui: {
100
+ getTheme(): Promise<TavoraTheme>;
101
+ onThemeChange(fn: (theme: TavoraTheme) => void): Unsubscribe;
102
+ /** The language Tavora shows its own texts in, as a code such as "en" or "de". Show yours in it, or in English when you have no translation. */
103
+ getLanguage(): Promise<string>;
104
+ /** Fires when the player changes the language. */
105
+ onLanguageChange(fn: (language: string) => void): Unsubscribe;
106
+ /**
107
+ * Shows a menu that Tavora draws above every panel, so it is never cut off at the panel's edge. Call it from
108
+ * the click, right-click or key press that asked for it: the host refuses it otherwise (PERMISSION_DENIED).
109
+ * Resolves with the chosen item's id, or null when the player closed the menu without choosing.
110
+ */
111
+ showMenu(request: MenuRequest): Promise<string | null>;
112
+ };
113
+ /**
114
+ * Files (pictures) this module keeps in the current game, shared by all of its panels. They live
115
+ * in a folder Tavora manages, not in a document, so they can be large: up to 50 MB each and
116
+ * 500 MB together. Only PNG, JPEG, GIF and WebP are accepted, judged by the file itself.
117
+ */
118
+ blobs: {
119
+ /** Stores a file and returns its id. Rejects with QUOTA_EXCEEDED, or INVALID_PARAMS for another kind of file. */
120
+ put(file: Blob): Promise<BlobInfo>;
121
+ /** The address to show a stored file from, for example as an image source. */
122
+ url(id: string): string;
123
+ list(): Promise<BlobInfo[]>;
124
+ usage(): Promise<BlobUsage>;
125
+ /** Deletes a file; nothing happens when it does not exist. */
126
+ delete(id: string): Promise<void>;
127
+ };
128
+ clipboard: {
129
+ /**
130
+ * Puts a picture on the system clipboard, so the player can paste it anywhere. Call it from the click or key
131
+ * press that asked for it: the host refuses it otherwise (PERMISSION_DENIED), and one press copies one
132
+ * picture. PNG only, a complete one, at most 20 MB and 16384 pixels on a side (INVALID_PARAMS, QUOTA_EXCEEDED).
133
+ */
134
+ writeImage(png: Blob): Promise<void>;
135
+ };
136
+ pictures: {
137
+ /**
138
+ * Saves a picture as a .png file in Tavora's folder in the player's Pictures (Pictures\Tavora), right away,
139
+ * without a dialog. `name` suggests the file name: Tavora makes it safe and adds " (2)" and so on rather than
140
+ * replace a file. Resolves with the name it was saved under; the module never learns where the folder is.
141
+ * Call it from the click or key press that asked for it: the host refuses it otherwise (PERMISSION_DENIED), and
142
+ * one press saves one picture. The same PNG limits as clipboard.writeImage apply.
143
+ */
144
+ save(png: Blob, name?: string): Promise<{
145
+ fileName: string;
146
+ }>;
147
+ };
148
+ links: {
149
+ /**
150
+ * Opens a web address (http or https) in a Browser panel of this game, as a new tab or in a new
151
+ * panel. Call it from the click or key press that asked for it: the host refuses it otherwise
152
+ * (PERMISSION_DENIED). The module learns nothing about the page.
153
+ */
154
+ open(url: string): Promise<void>;
155
+ };
156
+ network: {
157
+ /**
158
+ * Makes a web request through Tavora, to a host listed in `permissions.network` that the player
159
+ * granted (PERMISSION_DENIED otherwise). HTTPS only, no cookies, at most 5 MB back and 15 seconds.
160
+ * Error statuses such as 404 are answers, not errors; NETWORK_ERROR means no answer came.
161
+ */
162
+ fetch(url: string, init?: Omit<NetworkRequest, "url">): Promise<NetworkResponse>;
163
+ };
164
+ /** Parts of Tavora that hold a sign-in, used without seeing it. Each needs its connector in `permissions.connectors` and the player's grant (PERMISSION_DENIED otherwise). */
165
+ connectors: {
166
+ /** `ai-usage`: the usage of the Claude and Codex accounts the player set up in Settings > Integrations > AI usage. */
167
+ aiUsage: {
168
+ accounts(): Promise<AiUsageAccountInfo[]>;
169
+ /** Reads one account. Tavora reads each account at most once a minute; asking sooner gives the last reading. */
170
+ read(accountId: string): Promise<AiUsageReading>;
171
+ /** Fires when the player adds, renames or removes an account. */
172
+ onAccountsChange(fn: () => void): Unsubscribe;
173
+ };
174
+ /**
175
+ * `discord`: the Discord app on this PC, through Tavora's Discord sign-in. The connection runs while a
176
+ * panel has asked for state(); Tavora keeps the sign-in and sends only the commands in DISCORD_COMMANDS.
177
+ */
178
+ discord: {
179
+ /** The connection now. The first call starts it for this panel. */
180
+ state(): Promise<DiscordState>;
181
+ onStateChange(fn: (state: DiscordState) => void): Unsubscribe;
182
+ /** Signs in, asking for approval in Discord the first time. Call it from a click or key press handler. */
183
+ connect(): Promise<void>;
184
+ /** Asks Discord to approve muting and deafening, for a sign-in that can't yet (canControl false). From a click or key press. */
185
+ allowControl(): Promise<void>;
186
+ /** Sends one command; resolves with Discord's answer as it came, or why there is none. SELECT_VOICE_CHANNEL and SET_VOICE_SETTINGS only from a click or key press. */
187
+ command<C extends DiscordCommand>(command: C, args: DiscordCommands[C]): Promise<DiscordResult>;
188
+ /** Starts sending an event to this panel (VOICE_CHANNEL_SELECT without a channel, the others for one voice channel). Kept across reconnects. */
189
+ subscribe(event: DiscordEventName, channelId?: string): Promise<void>;
190
+ unsubscribe(event: DiscordEventName, channelId?: string): Promise<void>;
191
+ onEvent(fn: (event: DiscordEvent) => void): Unsubscribe;
192
+ /** A picture from cdn.discordapp.com (an avatar or server icon address) as a small PNG data address, or null. */
193
+ image(url: string): Promise<string | null>;
194
+ };
195
+ };
196
+ lifecycle: {
197
+ /** The panel is hidden; pause timers and animations. Called immediately if already suspended. */
198
+ onSuspend(fn: () => void): Unsubscribe;
199
+ onResume(fn: () => void): Unsubscribe;
200
+ /** Best effort only: autosave must not depend on this firing. */
201
+ onDispose(fn: () => void): Unsubscribe;
202
+ };
203
+ }
204
+ export interface ConnectOptions {
205
+ /** How long to wait for the host to hand over a port. Default 5000 ms. */
206
+ connectTimeoutMs?: number;
207
+ /** How long to wait for each request. Default 10000 ms. */
208
+ requestTimeoutMs?: number;
209
+ }
210
+ /**
211
+ * Connects to the Tavora host. Safe to call more than once: every call
212
+ * returns the same connection for this window. Rejects with a TavoraError
213
+ * (HOST_UNAVAILABLE, INCOMPATIBLE) if the module cannot run here.
214
+ */
215
+ export declare function connect(options?: ConnectOptions): Promise<TavoraSDK>;
216
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAQL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,YAAY,EAGjB,KAAK,eAAe,EAEpB,KAAK,SAAS,EACd,KAAK,WAAW,EAGhB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,UAAU,EACV,cAAc,EACd,eAAe,EACf,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