lumiverse-spindle-types 0.5.8 → 0.5.9
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/package.json +1 -1
- package/src/api.ts +62 -1
- package/src/index.ts +2 -0
- package/src/spindle-api.ts +73 -0
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -1637,6 +1637,50 @@ export interface SpindleCommandContextDTO {
|
|
|
1637
1637
|
isGroupChat?: boolean;
|
|
1638
1638
|
}
|
|
1639
1639
|
|
|
1640
|
+
// ─── UI Automation DTOs ─────────────────────────────────────────────────
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Read-only snapshot of a drawer tab discoverable via
|
|
1644
|
+
* {@link SpindleAPI.ui.getDrawerTabs}. Mirrors the metadata used by the
|
|
1645
|
+
* built-in Command Palette to render the "Panels" group.
|
|
1646
|
+
*/
|
|
1647
|
+
export interface SpindleUIDrawerTabDTO {
|
|
1648
|
+
/** Stable id used by `openDrawerTab(id)`. */
|
|
1649
|
+
id: string;
|
|
1650
|
+
/** Short label shown beneath the sidebar icon (max ~8 characters). */
|
|
1651
|
+
shortName: string;
|
|
1652
|
+
/** Full title shown in menus and the command palette. */
|
|
1653
|
+
tabName: string;
|
|
1654
|
+
/** One-line description shown in the command palette. */
|
|
1655
|
+
tabDescription: string;
|
|
1656
|
+
/** Keywords used for command-palette fuzzy search. */
|
|
1657
|
+
keywords: string[];
|
|
1658
|
+
/** Whether the tab is built into Lumiverse or contributed by another extension. */
|
|
1659
|
+
source: "builtin" | "extension";
|
|
1660
|
+
/** For extension-contributed tabs, the owning extension's identifier. */
|
|
1661
|
+
extensionId?: string;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* Read-only snapshot of a settings tab discoverable via
|
|
1666
|
+
* {@link SpindleAPI.ui.getSettingsTabs}. Restricted entries (`role` set) are
|
|
1667
|
+
* filtered out when the call resolves to a user that lacks the required role.
|
|
1668
|
+
*/
|
|
1669
|
+
export interface SpindleUISettingsTabDTO {
|
|
1670
|
+
/** Stable id used by `openSettings(id)`. */
|
|
1671
|
+
id: string;
|
|
1672
|
+
/** Short label shown in the settings sidebar. */
|
|
1673
|
+
shortName: string;
|
|
1674
|
+
/** Full title shown in the settings header / command palette. */
|
|
1675
|
+
tabName: string;
|
|
1676
|
+
/** One-line description shown in the command palette. */
|
|
1677
|
+
tabDescription: string;
|
|
1678
|
+
/** Keywords used for command-palette fuzzy search. */
|
|
1679
|
+
keywords: string[];
|
|
1680
|
+
/** Set when the tab is only visible to certain roles. */
|
|
1681
|
+
role?: "admin" | "owner";
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1640
1684
|
// ─── Frontend Process Lifecycle DTOs ────────────────────────────────────
|
|
1641
1685
|
|
|
1642
1686
|
/** High-level lifecycle state for a frontend process tracked by the backend host. */
|
|
@@ -2590,7 +2634,24 @@ export type WorkerToHost =
|
|
|
2590
2634
|
scrape?: boolean;
|
|
2591
2635
|
userId?: string;
|
|
2592
2636
|
}
|
|
2593
|
-
| { type: "web_search_get_settings"; requestId: string; userId?: string }
|
|
2637
|
+
| { type: "web_search_get_settings"; requestId: string; userId?: string }
|
|
2638
|
+
// ─── UI Automation (free tier) ────────────────────────────────────────
|
|
2639
|
+
| { type: "ui_get_drawer_tabs"; requestId: string; userId?: string }
|
|
2640
|
+
| { type: "ui_get_settings_tabs"; requestId: string; userId?: string }
|
|
2641
|
+
| {
|
|
2642
|
+
type: "ui_navigate";
|
|
2643
|
+
requestId: string;
|
|
2644
|
+
action:
|
|
2645
|
+
| "open_drawer_tab"
|
|
2646
|
+
| "close_drawer"
|
|
2647
|
+
| "open_settings"
|
|
2648
|
+
| "close_settings"
|
|
2649
|
+
| "open_command_palette"
|
|
2650
|
+
| "close_command_palette";
|
|
2651
|
+
tabId?: string;
|
|
2652
|
+
viewId?: string;
|
|
2653
|
+
userId?: string;
|
|
2654
|
+
};
|
|
2594
2655
|
|
|
2595
2656
|
// ─── Host → Worker messages ──────────────────────────────────────────────
|
|
2596
2657
|
|
package/src/index.ts
CHANGED
package/src/spindle-api.ts
CHANGED
|
@@ -72,6 +72,8 @@ import type {
|
|
|
72
72
|
SpindleModalItemDTO,
|
|
73
73
|
SpindleCommandDTO,
|
|
74
74
|
SpindleCommandContextDTO,
|
|
75
|
+
SpindleUIDrawerTabDTO,
|
|
76
|
+
SpindleUISettingsTabDTO,
|
|
75
77
|
FrontendProcessSpawnOptionsDTO,
|
|
76
78
|
FrontendProcessListOptionsDTO,
|
|
77
79
|
FrontendProcessInfoDTO,
|
|
@@ -1522,6 +1524,77 @@ export interface SpindleAPI {
|
|
|
1522
1524
|
getRole(userId?: string): Promise<SpindleUserRoleDTO>;
|
|
1523
1525
|
};
|
|
1524
1526
|
|
|
1527
|
+
/**
|
|
1528
|
+
* UI automation (free tier — no permission needed).
|
|
1529
|
+
*
|
|
1530
|
+
* Enumerate the built-in drawer / settings tabs and trigger navigation
|
|
1531
|
+
* on the user's frontend. Same primitives the Command Palette uses, but
|
|
1532
|
+
* exposed to extensions so agents and automations can guide the user to
|
|
1533
|
+
* the right surface — for example, an onboarding flow that opens the
|
|
1534
|
+
* Connections drawer, or a "fix it" prompt that jumps to the relevant
|
|
1535
|
+
* settings tab.
|
|
1536
|
+
*
|
|
1537
|
+
* Listings include both built-in tabs (mirrored on the backend) and
|
|
1538
|
+
* extension-contributed drawer tabs the user's frontend has registered.
|
|
1539
|
+
* Navigation calls accept any tab id the frontend recognises — including
|
|
1540
|
+
* extension-added ids — so an extension can deep-link into another
|
|
1541
|
+
* extension's tab if it knows the id.
|
|
1542
|
+
*
|
|
1543
|
+
* @example
|
|
1544
|
+
* ```ts
|
|
1545
|
+
* // Enumerate every drawer tab the user can see and surface our own
|
|
1546
|
+
* // command-palette-style picker.
|
|
1547
|
+
* const tabs = await spindle.ui.getDrawerTabs({ userId })
|
|
1548
|
+
* await spindle.modal.open({
|
|
1549
|
+
* title: "Jump to…",
|
|
1550
|
+
* items: tabs.map((t) => ({ type: "key_value", label: t.tabName, value: t.tabDescription })),
|
|
1551
|
+
* })
|
|
1552
|
+
*
|
|
1553
|
+
* // Take the user straight to the Connections drawer.
|
|
1554
|
+
* await spindle.ui.openDrawerTab("connections", { userId })
|
|
1555
|
+
* ```
|
|
1556
|
+
*/
|
|
1557
|
+
ui: {
|
|
1558
|
+
/**
|
|
1559
|
+
* Read the discoverable drawer tabs (built-in + extension-contributed)
|
|
1560
|
+
* visible to the resolved user. Extension tabs are only included once
|
|
1561
|
+
* the user's frontend has synced its registry over the WebSocket;
|
|
1562
|
+
* during connection bootstrap the list may be limited to built-ins.
|
|
1563
|
+
*
|
|
1564
|
+
* For user-scoped extensions, `userId` defaults to the installer.
|
|
1565
|
+
* Operator-scoped extensions should pass `userId` to scope the call.
|
|
1566
|
+
*/
|
|
1567
|
+
getDrawerTabs(options?: { userId?: string }): Promise<SpindleUIDrawerTabDTO[]>;
|
|
1568
|
+
/**
|
|
1569
|
+
* Read the discoverable settings tabs visible to the resolved user.
|
|
1570
|
+
* Restricted tabs (e.g. `role: "owner"`) are filtered out for users
|
|
1571
|
+
* lacking the required role. When `userId` is omitted on operator-scoped
|
|
1572
|
+
* extensions, role gating is skipped and every tab is returned.
|
|
1573
|
+
*/
|
|
1574
|
+
getSettingsTabs(options?: { userId?: string }): Promise<SpindleUISettingsTabDTO[]>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Open the drawer to a specific tab. The id is forwarded verbatim, so
|
|
1577
|
+
* extension-contributed tabs are addressable too. The call resolves
|
|
1578
|
+
* once the host has dispatched the navigation event — the frontend
|
|
1579
|
+
* applies it asynchronously.
|
|
1580
|
+
*/
|
|
1581
|
+
openDrawerTab(tabId: string, options?: { userId?: string }): Promise<void>;
|
|
1582
|
+
/** Close the drawer if it is currently open. */
|
|
1583
|
+
closeDrawer(options?: { userId?: string }): Promise<void>;
|
|
1584
|
+
/**
|
|
1585
|
+
* Open the settings modal. Pass a settings tab id (e.g. `"connections"`,
|
|
1586
|
+
* `"display"`) to land on a specific view; omit to open the user's last
|
|
1587
|
+
* settings view.
|
|
1588
|
+
*/
|
|
1589
|
+
openSettings(viewId?: string, options?: { userId?: string }): Promise<void>;
|
|
1590
|
+
/** Close the settings modal if it is currently open. */
|
|
1591
|
+
closeSettings(options?: { userId?: string }): Promise<void>;
|
|
1592
|
+
/** Open the command palette overlay. */
|
|
1593
|
+
openCommandPalette(options?: { userId?: string }): Promise<void>;
|
|
1594
|
+
/** Close the command palette overlay if it is currently open. */
|
|
1595
|
+
closeCommandPalette(options?: { userId?: string }): Promise<void>;
|
|
1596
|
+
};
|
|
1597
|
+
|
|
1525
1598
|
/** Show toast notifications in the frontend UI (free tier — no permission needed) */
|
|
1526
1599
|
toast: {
|
|
1527
1600
|
success(message: string, options?: { title?: string; duration?: number; /** For operator-scoped extensions only. */ userId?: string }): void;
|