lumiverse-spindle-types 0.5.7 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -638,6 +638,13 @@ export interface ChatChangedPayloadDTO {
638
638
 
639
639
  // ─── User Preset DTOs ───────────────────────────────────────────────────
640
640
 
641
+ /** Option entry for `select` and `multiselect` prompt variables. */
642
+ export interface PromptVariableOptionDTO {
643
+ id: string;
644
+ label: string;
645
+ value: string;
646
+ }
647
+
641
648
  export type PromptVariableDefDTO =
642
649
  | {
643
650
  id: string;
@@ -677,9 +684,41 @@ export type PromptVariableDefDTO =
677
684
  max: number;
678
685
  step?: number;
679
686
  description?: string;
687
+ }
688
+ | {
689
+ id: string;
690
+ name: string;
691
+ label: string;
692
+ type: "select";
693
+ /** Stored selection: an option id. */
694
+ defaultValue: string;
695
+ options: PromptVariableOptionDTO[];
696
+ description?: string;
697
+ }
698
+ | {
699
+ id: string;
700
+ name: string;
701
+ label: string;
702
+ type: "switch";
703
+ /** 0 (off) or 1 (on). */
704
+ defaultValue: 0 | 1;
705
+ description?: string;
706
+ }
707
+ | {
708
+ id: string;
709
+ name: string;
710
+ label: string;
711
+ type: "multiselect";
712
+ /** Stored selection: array of option ids. */
713
+ defaultValue: string[];
714
+ options: PromptVariableOptionDTO[];
715
+ /** String inserted between joined option values. Defaults to two newlines. */
716
+ separator?: string;
717
+ description?: string;
680
718
  };
681
719
 
682
- export type PromptVariableValueDTO = string | number;
720
+ export type PromptVariableTypeDTO = PromptVariableDefDTO["type"];
721
+ export type PromptVariableValueDTO = string | number | string[];
683
722
  export type PromptVariableValuesDTO = Record<string, Record<string, PromptVariableValueDTO>>;
684
723
  export type PromptBlockRoleDTO = "system" | "user" | "assistant" | "user_append" | "assistant_append";
685
724
  export type PromptBlockPositionDTO = "pre_history" | "post_history" | "in_history";
@@ -1598,6 +1637,50 @@ export interface SpindleCommandContextDTO {
1598
1637
  isGroupChat?: boolean;
1599
1638
  }
1600
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
+
1601
1684
  // ─── Frontend Process Lifecycle DTOs ────────────────────────────────────
1602
1685
 
1603
1686
  /** High-level lifecycle state for a frontend process tracked by the backend host. */
@@ -2551,7 +2634,24 @@ export type WorkerToHost =
2551
2634
  scrape?: boolean;
2552
2635
  userId?: string;
2553
2636
  }
2554
- | { 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
+ };
2555
2655
 
2556
2656
  // ─── Host → Worker messages ──────────────────────────────────────────────
2557
2657
 
package/src/index.ts CHANGED
@@ -44,7 +44,9 @@ export type {
44
44
  ChatUpdateDTO,
45
45
  ChatSwitchedPayloadDTO,
46
46
  ChatChangedPayloadDTO,
47
+ PromptVariableOptionDTO,
47
48
  PromptVariableDefDTO,
49
+ PromptVariableTypeDTO,
48
50
  PromptVariableValueDTO,
49
51
  PromptVariableValuesDTO,
50
52
  PromptBlockRoleDTO,
@@ -119,6 +121,8 @@ export type {
119
121
  SpindleModalItemDTO,
120
122
  SpindleCommandDTO,
121
123
  SpindleCommandContextDTO,
124
+ SpindleUIDrawerTabDTO,
125
+ SpindleUISettingsTabDTO,
122
126
  FrontendProcessStateDTO,
123
127
  FrontendProcessExitReasonDTO,
124
128
  FrontendProcessSpawnOptionsDTO,
@@ -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;