@harborclient/sdk 1.3.3 → 1.3.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/AnchorMenuPanel/index.d.ts +35 -0
  3. package/dist/components/AnchorMenuPanel/index.d.ts.map +1 -0
  4. package/dist/components/AnchorMenuPanel/index.js +364 -0
  5. package/dist/components/Breadcrumb/SegmentShell.d.ts +12 -1
  6. package/dist/components/Breadcrumb/SegmentShell.d.ts.map +1 -1
  7. package/dist/components/Breadcrumb/SegmentShell.js +7 -5
  8. package/dist/components/CodeEditor/index.d.ts +7 -4
  9. package/dist/components/CodeEditor/index.d.ts.map +1 -1
  10. package/dist/components/CodeEditor/index.js +15 -176
  11. package/dist/components/CodeEditor/selectionActionToolbar.d.ts +162 -0
  12. package/dist/components/CodeEditor/selectionActionToolbar.d.ts.map +1 -0
  13. package/dist/components/CodeEditor/selectionActionToolbar.js +319 -0
  14. package/dist/components/CopyToChatButton/constants.d.ts +18 -0
  15. package/dist/components/CopyToChatButton/constants.d.ts.map +1 -0
  16. package/dist/components/CopyToChatButton/constants.js +19 -0
  17. package/dist/components/CopyToChatButton/index.d.ts +49 -0
  18. package/dist/components/CopyToChatButton/index.d.ts.map +1 -0
  19. package/dist/components/CopyToChatButton/index.js +43 -0
  20. package/dist/components/FloatingDialog/floatingDialogPosition.d.ts +52 -0
  21. package/dist/components/FloatingDialog/floatingDialogPosition.d.ts.map +1 -0
  22. package/dist/components/FloatingDialog/floatingDialogPosition.js +33 -0
  23. package/dist/components/FloatingDialog/index.d.ts +95 -0
  24. package/dist/components/FloatingDialog/index.d.ts.map +1 -0
  25. package/dist/components/FloatingDialog/index.js +275 -0
  26. package/dist/components/FormGroup/index.d.ts +7 -1
  27. package/dist/components/FormGroup/index.d.ts.map +1 -1
  28. package/dist/components/FormGroup/index.js +8 -11
  29. package/dist/components/PageHeader/index.d.ts +2 -1
  30. package/dist/components/PageHeader/index.d.ts.map +1 -1
  31. package/dist/components/PageHeader/index.js +3 -2
  32. package/dist/components/PageSidebar/index.d.ts +1 -0
  33. package/dist/components/PageSidebar/index.d.ts.map +1 -1
  34. package/dist/components/PageSidebar/index.js +4 -13
  35. package/dist/components/Resizable/useResizable.d.ts +6 -0
  36. package/dist/components/Resizable/useResizable.d.ts.map +1 -1
  37. package/dist/components/Resizable/useResizable.js +113 -11
  38. package/dist/components/SettingFieldActions/index.d.ts +42 -0
  39. package/dist/components/SettingFieldActions/index.d.ts.map +1 -0
  40. package/dist/components/SettingFieldActions/index.js +66 -0
  41. package/dist/components/SidebarItem/SidebarEnvironmentItem.d.ts +42 -4
  42. package/dist/components/SidebarItem/SidebarEnvironmentItem.d.ts.map +1 -1
  43. package/dist/components/SidebarItem/SidebarEnvironmentItem.js +34 -5
  44. package/dist/components/SidebarItem/SidebarHistoryItem.d.ts +5 -1
  45. package/dist/components/SidebarItem/SidebarHistoryItem.d.ts.map +1 -1
  46. package/dist/components/SidebarItem/SidebarHistoryItem.js +2 -2
  47. package/dist/components/SidebarItem/SidebarWorkspaceItem.d.ts +9 -1
  48. package/dist/components/SidebarItem/SidebarWorkspaceItem.d.ts.map +1 -1
  49. package/dist/components/SidebarItem/SidebarWorkspaceItem.js +15 -2
  50. package/dist/components/TabBar/TabContextMenu.d.ts +3 -0
  51. package/dist/components/TabBar/TabContextMenu.d.ts.map +1 -1
  52. package/dist/components/TabBar/TabContextMenu.js +25 -16
  53. package/dist/components/VariableTable/index.d.ts +1 -1
  54. package/dist/components/VariableTable/index.d.ts.map +1 -1
  55. package/dist/components/VariableTable/index.js +14 -3
  56. package/dist/components/index.d.ts +6 -2
  57. package/dist/components/index.d.ts.map +1 -1
  58. package/dist/components/index.js +5 -1
  59. package/dist/runtime/createBridgedPluginContext.js +240 -2
  60. package/dist/snippets.d.ts +48 -2
  61. package/dist/styles.css +16 -0
  62. package/dist/types.d.ts +1159 -30
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/ui/index.d.ts +1 -0
  65. package/dist/ui/index.d.ts.map +1 -1
  66. package/dist/ui/index.js +1 -0
  67. package/package.json +1 -1
  68. package/dist/components/SelectionActionToolbar/index.d.ts +0 -41
  69. package/dist/components/SelectionActionToolbar/index.d.ts.map +0 -1
  70. package/dist/components/SelectionActionToolbar/index.js +0 -13
package/dist/types.d.ts CHANGED
@@ -19,6 +19,10 @@ export interface Variable {
19
19
  * Fallback value used when value is empty.
20
20
  */
21
21
  defaultValue: string;
22
+ /**
23
+ * When false, the row is ignored at resolve time so a parent/lower scope can pass through.
24
+ */
25
+ enabled: boolean;
22
26
  /**
23
27
  * When true, value is included in collection exports.
24
28
  */
@@ -155,6 +159,10 @@ export interface SettingsSectionContribution extends UiContributionBase {
155
159
  * selects instead of the default collections view.
156
160
  *
157
161
  * Manifest: `contributes.sidebarPanels`. Requires the `ui` permission.
162
+ *
163
+ * To replace the built-in Collections sidebar, set `replaces: "collections"` on
164
+ * the matching manifest entry (not on this runtime object). The host copies that
165
+ * field into the registry when the panel is registered.
158
166
  */
159
167
  export interface SidebarPanelContribution extends UiContributionBase {
160
168
  /**
@@ -167,6 +175,7 @@ export interface SidebarPanelContribution extends UiContributionBase {
167
175
  Component: React.ComponentType;
168
176
  /**
169
177
  * Sort order among plugin sidebar panels. Lower values appear first.
178
+ * Also used as a tie-breaker when choosing among multiple `replaces: "collections"` panels.
170
179
  */
171
180
  order?: number;
172
181
  }
@@ -617,6 +626,125 @@ export interface ScriptEditorActionContribution {
617
626
  */
618
627
  phases?: ScriptPhase[];
619
628
  }
629
+ /**
630
+ * One recorded workflow step exposed to plugin toolbar commands and action-block surfaces.
631
+ */
632
+ export interface WorkflowActionRef {
633
+ /**
634
+ * Stable identifier for this action; used when other actions refer to it.
635
+ */
636
+ uuid: string;
637
+ /**
638
+ * Stable logical event name (for example `request.load`).
639
+ */
640
+ type: string;
641
+ /**
642
+ * Wall-clock time when the action was recorded; optional in portable files.
643
+ */
644
+ at?: number;
645
+ /**
646
+ * Normalized action payload.
647
+ */
648
+ payload: unknown;
649
+ }
650
+ /**
651
+ * Context passed to a workflow toolbar action command when the user clicks the button.
652
+ */
653
+ export interface WorkflowToolbarActionContext {
654
+ /**
655
+ * Database id of the workflow open in play/edit mode.
656
+ */
657
+ workflowId: number;
658
+ /**
659
+ * 0-based index of the selected timeline action, or `-1` when none is selected.
660
+ */
661
+ actionIndex: number;
662
+ /**
663
+ * Selected timeline action, or `null` when none is selected.
664
+ */
665
+ action: WorkflowActionRef | null;
666
+ /**
667
+ * True when the playback buffer has unsaved edits.
668
+ */
669
+ dirty: boolean;
670
+ }
671
+ /**
672
+ * Adds a button to the right of Save in the workflow play/edit toolbar.
673
+ *
674
+ * Register the command handler with {@link PluginCommands.register} separately.
675
+ * The handler receives a single {@link WorkflowToolbarActionContext} argument.
676
+ * Manifest: `contributes.workflowToolbarActions` plus a matching `contributes.commands` entry.
677
+ * Requires the `ui` permission.
678
+ */
679
+ export interface WorkflowToolbarActionContribution {
680
+ /**
681
+ * Action id — must match an entry in `contributes.workflowToolbarActions`.
682
+ */
683
+ id: string;
684
+ /**
685
+ * Button label or tooltip text.
686
+ */
687
+ title: string;
688
+ /**
689
+ * Command id to run on click — must match a registered command and manifest entry.
690
+ */
691
+ command: string;
692
+ /**
693
+ * Optional icon name.
694
+ */
695
+ icon?: string;
696
+ /**
697
+ * Sort order to the right of Save. Lower values appear first.
698
+ */
699
+ order?: number;
700
+ }
701
+ /**
702
+ * Context passed to {@link WorkflowActionBlockContribution} HostedSurface components.
703
+ */
704
+ export interface WorkflowActionBlockContext {
705
+ /**
706
+ * Database id of the workflow open in play/edit mode.
707
+ */
708
+ workflowId: number;
709
+ /**
710
+ * 0-based index of this timeline action.
711
+ */
712
+ actionIndex: number;
713
+ /**
714
+ * Timeline action rendered inside this block.
715
+ */
716
+ action: WorkflowActionRef;
717
+ /**
718
+ * True when this block is the playback cursor.
719
+ */
720
+ selected: boolean;
721
+ /**
722
+ * True when the block is too narrow for rich content (host may hide the surface).
723
+ */
724
+ compact: boolean;
725
+ }
726
+ /**
727
+ * Renders a HostedSurface inside matching workflow timeline action blocks.
728
+ *
729
+ * Manifest: `contributes.workflowActionBlocks`. Requires the `ui` permission.
730
+ */
731
+ export interface WorkflowActionBlockContribution extends UiContributionBase {
732
+ /**
733
+ * Block content. Receives `{ context: WorkflowActionBlockContext }`.
734
+ * Use {@link PluginContext.react} — do not bundle React.
735
+ */
736
+ Component: React.ComponentType<{
737
+ context: WorkflowActionBlockContext;
738
+ }>;
739
+ /**
740
+ * When set, limits the surface to these action types. Omit to show on every block.
741
+ */
742
+ actionTypes?: string[];
743
+ /**
744
+ * Sort order among stacked surfaces in a block. Lower values appear first.
745
+ */
746
+ order?: number;
747
+ }
620
748
  /**
621
749
  * Sidebar row type that a context menu item applies to.
622
750
  *
@@ -1326,6 +1454,24 @@ export interface PluginUi {
1326
1454
  * @returns A {@link Disposable} that unregisters the action when disposed.
1327
1455
  */
1328
1456
  registerScriptEditorAction(action: ScriptEditorActionContribution): Disposable;
1457
+ /**
1458
+ * Adds a button to the right of Save in the workflow play/edit toolbar.
1459
+ *
1460
+ * Manifest: `contributes.workflowToolbarActions` plus a matching `contributes.commands` entry.
1461
+ *
1462
+ * @param action - Toolbar action contribution.
1463
+ * @returns A {@link Disposable} that unregisters the action when disposed.
1464
+ */
1465
+ registerWorkflowToolbarAction(action: WorkflowToolbarActionContribution): Disposable;
1466
+ /**
1467
+ * Renders a HostedSurface inside matching workflow timeline action blocks.
1468
+ *
1469
+ * Manifest: `contributes.workflowActionBlocks` — `block.id` must match an entry there.
1470
+ *
1471
+ * @param block - Action block contribution.
1472
+ * @returns A {@link Disposable} that unregisters the block when disposed.
1473
+ */
1474
+ registerWorkflowActionBlock(block: WorkflowActionBlockContribution): Disposable;
1329
1475
  /**
1330
1476
  * Adds an action to sidebar row context menus.
1331
1477
  *
@@ -1597,6 +1743,10 @@ export interface PluginVariableInput {
1597
1743
  * Fallback value used when value is empty.
1598
1744
  */
1599
1745
  defaultValue?: string;
1746
+ /**
1747
+ * When false, the row is ignored at resolve time. Defaults to true when omitted.
1748
+ */
1749
+ enabled?: boolean;
1600
1750
  /**
1601
1751
  * When true, value is included in collection exports.
1602
1752
  */
@@ -1616,45 +1766,699 @@ export interface CreatedEnvironmentResult {
1616
1766
  name: string;
1617
1767
  }
1618
1768
  /**
1619
- * Typed wrappers for built-in HarborClient request editor commands.
1620
- *
1621
- * Requires the `ui` permission. Prefer these over stringly-typed
1622
- * {@link PluginCommands.execute} for opening request tabs.
1769
+ * Options for library list APIs that can include archived collections.
1623
1770
  */
1624
- export interface PluginHost {
1771
+ export interface LibraryListOptions {
1625
1772
  /**
1626
- * Opens a new request tab seeded with captured send metadata.
1627
- *
1628
- * @param payload - Partial draft fields from a recent request entry.
1773
+ * When true, include archived collections. Defaults to false (active only).
1629
1774
  */
1630
- openRequestDraft(payload: OpenRequestDraftPayload): Promise<void>;
1775
+ includeArchived?: boolean;
1776
+ }
1777
+ /**
1778
+ * Lightweight collection row for sidebar trees and discovery.
1779
+ */
1780
+ export interface CollectionSummary {
1781
+ /** Database id. */
1782
+ id: number;
1783
+ /** Stable portable identifier. */
1784
+ uuid: string;
1785
+ /** Display name. */
1786
+ name: string;
1787
+ /** Optional sidebar marker color. */
1788
+ marker?: string | null;
1789
+ /** ISO 8601 creation timestamp. */
1790
+ created_at: string;
1791
+ /** Storage connection id when the collection is remote-backed. */
1792
+ connectionId?: string;
1793
+ /** When true, the collection is archived. */
1794
+ archived?: boolean;
1795
+ /** When true on a team hub collection, non-admins cannot delete it. */
1796
+ deletion_locked?: boolean;
1797
+ }
1798
+ /**
1799
+ * Lightweight folder row for sidebar trees.
1800
+ */
1801
+ export interface FolderSummary {
1802
+ /** Database id. */
1803
+ id: number;
1804
+ /** Stable portable identifier. */
1805
+ uuid: string;
1806
+ /** Parent collection id. */
1807
+ collection_id: number;
1808
+ /** Parent folder id, or null at collection root. */
1809
+ parent_folder_id: number | null;
1810
+ /** Display name. */
1811
+ name: string;
1812
+ /** Sibling sort order. */
1813
+ sort_order: number;
1814
+ /** Optional sidebar marker color. */
1815
+ marker?: string | null;
1816
+ /** ISO 8601 creation timestamp. */
1817
+ created_at: string;
1818
+ }
1819
+ /**
1820
+ * Lightweight saved-request row for sidebar trees (no body/auth).
1821
+ */
1822
+ export interface SavedRequestSummary {
1823
+ /** Database id. */
1824
+ id: number;
1825
+ /** Stable portable identifier. */
1826
+ uuid: string;
1827
+ /** Parent collection id. */
1828
+ collection_id: number;
1829
+ /** Parent folder id, or null at collection root. */
1830
+ folder_id: number | null;
1831
+ /** Display name. */
1832
+ name: string;
1833
+ /** HTTP method. */
1834
+ method: HttpMethod;
1835
+ /** Sibling sort order. */
1836
+ sort_order: number;
1837
+ /** Optional sidebar marker color. */
1838
+ marker?: string | null;
1839
+ /** ISO 8601 creation timestamp. */
1840
+ created_at: string;
1841
+ }
1842
+ /**
1843
+ * Lightweight markdown document row for sidebar trees (no content body).
1844
+ */
1845
+ export interface DocumentSummary {
1846
+ /** Database id. */
1847
+ id: number;
1848
+ /** Stable portable identifier. */
1849
+ uuid: string;
1850
+ /** Parent collection id. */
1851
+ collection_id: number;
1852
+ /** Parent folder id, or null at collection root. */
1853
+ folder_id: number | null;
1854
+ /** Display file name. */
1855
+ name: string;
1856
+ /** Sibling sort order. */
1857
+ sort_order: number;
1858
+ /** Optional sidebar marker color. */
1859
+ marker?: string | null;
1860
+ /** ISO 8601 creation timestamp. */
1861
+ created_at: string;
1862
+ /** ISO 8601 last-updated timestamp. */
1863
+ updated_at: string;
1864
+ }
1865
+ /**
1866
+ * One collection node in a {@link LibraryTreeSnapshot}, including nested contents.
1867
+ */
1868
+ export interface LibraryTreeCollectionNode extends CollectionSummary {
1869
+ /** Folders in this collection (flat list; nest via parent_folder_id). */
1870
+ folders: FolderSummary[];
1871
+ /** Saved requests in this collection (flat list; nest via folder_id). */
1872
+ requests: SavedRequestSummary[];
1873
+ /** Markdown documents in this collection (flat list; nest via folder_id). */
1874
+ documents: DocumentSummary[];
1875
+ }
1876
+ /**
1877
+ * Full library snapshot suitable for building a custom collections sidebar tree.
1878
+ */
1879
+ export interface LibraryTreeSnapshot {
1880
+ /** Collections with nested folder/request/document summaries. */
1881
+ collections: LibraryTreeCollectionNode[];
1631
1882
  /**
1632
- * Updates the active request editor tab in place with the given draft fields.
1633
- *
1634
- * Provided fields replace the corresponding values on the active draft.
1635
- * When `headers` or `params` are supplied, those tables are replaced entirely
1636
- * (not merged). Throws when there is no active request tab.
1637
- *
1638
- * Requires the `ui` permission.
1639
- *
1640
- * @param payload - Partial draft fields to apply to the active tab.
1883
+ * Warnings when one or more storage backends failed while listing collections.
1884
+ * The snapshot may be incomplete when non-empty.
1641
1885
  */
1642
- applyRequestDraft(payload: ApplyRequestDraftPayload): Promise<void>;
1886
+ warnings: string[];
1887
+ }
1888
+ /**
1889
+ * Coarse reason for a {@link LibraryChangedEvent}.
1890
+ */
1891
+ export type LibraryChangedReason = 'collections' | 'folders' | 'requests' | 'documents';
1892
+ /**
1893
+ * Coarse invalidation signal so plugins can refetch library data without polling.
1894
+ */
1895
+ export interface LibraryChangedEvent {
1896
+ /** Which library slice changed. */
1897
+ reason: LibraryChangedReason;
1898
+ /** Collection id for per-collection reasons; omitted for `collections`. */
1899
+ collectionId?: number;
1900
+ }
1901
+ /**
1902
+ * Coarse reason for a {@link WorkflowsChangedEvent}.
1903
+ */
1904
+ export type WorkflowsChangedReason = 'created' | 'updated' | 'renamed' | 'deleted' | 'refreshed';
1905
+ /**
1906
+ * Coarse invalidation signal so plugins can refetch workflows without polling.
1907
+ */
1908
+ export interface WorkflowsChangedEvent {
1909
+ /** Which workflow mutation occurred. */
1910
+ reason: WorkflowsChangedReason;
1911
+ /** Workflow database id when the change targets one row. */
1912
+ workflowId?: number;
1913
+ }
1914
+ /**
1915
+ * Full workflow row returned by {@link PluginHost} workflow CRUD methods.
1916
+ */
1917
+ export interface HostWorkflow {
1918
+ /** Database primary key. */
1919
+ id: number;
1920
+ /** Stable portable identifier for export/import. */
1921
+ uuid: string;
1922
+ /** Display name shown in the sidebar. */
1923
+ name: string;
1924
+ /** Accumulated recording duration in milliseconds. */
1925
+ durationMs: number;
1926
+ /** Pause between consecutive actions during playback, in milliseconds. */
1927
+ delayMs: number;
1928
+ /** Workflow-scoped variables for parameterization. */
1929
+ variables: Record<string, string>;
1930
+ /** Ordered recorded actions. */
1931
+ actions: WorkflowActionRef[];
1932
+ /** Creation timestamp in milliseconds since epoch. */
1933
+ createdAt: number;
1934
+ /** Last update timestamp in milliseconds since epoch. */
1935
+ updatedAt: number;
1936
+ }
1937
+ /**
1938
+ * Payload for {@link PluginHost.createWorkflow}.
1939
+ */
1940
+ export interface CreateWorkflowPayload {
1941
+ /** Display name for the workflow. */
1942
+ name: string;
1943
+ /** Optional portable uuid; generated when omitted. */
1944
+ uuid?: string;
1945
+ /** Accumulated recording duration in milliseconds. */
1946
+ durationMs: number;
1947
+ /** Optional pause between consecutive actions during playback, in milliseconds. */
1948
+ delayMs?: number;
1949
+ /** Optional workflow variables; defaults to an empty object. */
1950
+ variables?: Record<string, string>;
1951
+ /** Ordered recorded actions to persist. */
1952
+ actions: WorkflowActionRef[];
1953
+ }
1954
+ /**
1955
+ * Payload for {@link PluginHost.updateWorkflow} — replaces actions and duration.
1956
+ *
1957
+ * Name and variables are preserved. Use {@link PluginHost.renameWorkflow} to rename.
1958
+ */
1959
+ export interface UpdateWorkflowPayload {
1960
+ /** Database primary key of the workflow to update. */
1961
+ id: number;
1962
+ /** Ordered recorded actions to persist. */
1963
+ actions: WorkflowActionRef[];
1964
+ /** Accumulated recording duration in milliseconds. */
1965
+ durationMs: number;
1966
+ /** Pause between consecutive actions during playback, in milliseconds. */
1967
+ delayMs: number;
1968
+ }
1969
+ /**
1970
+ * Serializable sidebar focus/selection for replacement panels and host sync.
1971
+ *
1972
+ * Matches the host's "reveal in sidebar" navigation state: collection/folder
1973
+ * highlight plus the active request or document tab when one is open.
1974
+ */
1975
+ export type SidebarSelection = {
1976
+ kind: 'collection';
1977
+ collectionId: number;
1978
+ } | {
1979
+ kind: 'folder';
1980
+ collectionId: number;
1981
+ folderId: number;
1982
+ } | {
1983
+ kind: 'request';
1984
+ collectionId: number;
1985
+ folderId: number | null;
1986
+ requestId: number;
1987
+ } | {
1988
+ kind: 'document';
1989
+ collectionId: number;
1990
+ folderId: number | null;
1991
+ documentId: number;
1992
+ };
1993
+ /**
1994
+ * View context pushed to `sidebarPanels` HostedSurface mounts.
1995
+ *
1996
+ * Read via `hc.view.getContext()` on panel mount; updates arrive through
1997
+ * {@link PluginHost.onSidebarSelectionChanged}.
1998
+ */
1999
+ export interface SidebarPanelViewContext {
2000
+ /** Current host sidebar selection, or null when nothing is focused. */
2001
+ sidebarSelection: SidebarSelection | null;
2002
+ }
2003
+ /**
2004
+ * Payload for {@link PluginHost.updateCollection} — renames a collection.
2005
+ *
2006
+ * Other collection settings are preserved. Destructive host methods are silent;
2007
+ * plugins must confirm before calling delete/archive APIs.
2008
+ */
2009
+ export interface UpdateCollectionInput {
2010
+ /** Collection database id. */
2011
+ id: number;
2012
+ /** New display name. */
2013
+ name: string;
2014
+ }
2015
+ /**
2016
+ * Payload for {@link PluginHost.setCollectionArchived}.
2017
+ */
2018
+ export interface SetCollectionArchivedInput {
2019
+ /** Collection database id. */
2020
+ collectionId: number;
2021
+ /** When true, archive; when false, restore from archive. */
2022
+ archived: boolean;
2023
+ }
2024
+ /**
2025
+ * Payload for {@link PluginHost.createFolder}.
2026
+ */
2027
+ export interface CreateFolderInput {
2028
+ /** Parent collection database id. */
2029
+ collectionId: number;
2030
+ /** Display name for the new folder. */
2031
+ name: string;
2032
+ /** Parent folder id, or null/omitted for collection root. */
2033
+ parentFolderId?: number | null;
2034
+ }
2035
+ /**
2036
+ * Payload for {@link PluginHost.renameFolder}.
2037
+ */
2038
+ export interface RenameFolderInput {
2039
+ /** Folder database id. */
2040
+ folderId: number;
2041
+ /** Parent collection database id. */
2042
+ collectionId: number;
2043
+ /** New display name. */
2044
+ name: string;
2045
+ }
2046
+ /**
2047
+ * Payload for {@link PluginHost.deleteFolder}.
2048
+ *
2049
+ * Deletes the folder subtree (descendant folders, requests, and documents).
2050
+ * Silent — plugins must confirm before calling.
2051
+ */
2052
+ export interface DeleteFolderInput {
2053
+ /** Folder database id. */
2054
+ folderId: number;
2055
+ /** Parent collection database id. */
2056
+ collectionId: number;
2057
+ }
2058
+ /**
2059
+ * Payload for {@link PluginHost.moveFolder}.
2060
+ */
2061
+ export interface MoveFolderInput {
2062
+ /** Parent collection database id. */
2063
+ collectionId: number;
2064
+ /** Folder database id to move. */
2065
+ folderId: number;
2066
+ /** New parent folder id, or null for collection root. */
2067
+ parentFolderId: number | null;
2068
+ /** Optional zero-based index among new siblings. */
2069
+ sortOrder?: number;
2070
+ }
2071
+ /**
2072
+ * Payload for {@link PluginHost.reorderFolders}.
2073
+ */
2074
+ export interface ReorderFoldersInput {
2075
+ /** Parent collection database id. */
2076
+ collectionId: number;
2077
+ /** Parent folder id, or null for collection-root siblings. */
2078
+ parentFolderId: number | null;
2079
+ /** Sibling folder ids in desired order. */
2080
+ orderedFolderIds: number[];
2081
+ }
2082
+ /**
2083
+ * Payload for {@link PluginHost.createRequest}.
2084
+ *
2085
+ * Opens the new request in an editor tab (same as the built-in sidebar).
2086
+ */
2087
+ export interface CreateRequestInput {
2088
+ /** Parent collection database id. */
2089
+ collectionId: number;
2090
+ /** Parent folder id, or null/omitted for collection root. */
2091
+ folderId?: number | null;
2092
+ /** Display name; defaults to `Untitled Request`. */
2093
+ name?: string;
2094
+ /** HTTP method; defaults to `GET`. */
2095
+ method?: HttpMethod;
2096
+ /** Request URL; defaults to empty. */
2097
+ url?: string;
2098
+ }
2099
+ /**
2100
+ * Payload for {@link PluginHost.moveRequest}.
2101
+ */
2102
+ export interface MoveRequestInput {
2103
+ /** Parent collection database id. */
2104
+ collectionId: number;
2105
+ /** Saved request database id. */
2106
+ requestId: number;
2107
+ /** Target folder id, or null for collection root. */
2108
+ folderId: number | null;
1643
2109
  /**
1644
- * Opens a saved collection request or focuses an existing tab for it.
1645
- *
1646
- * @param requestId - Saved request database id.
2110
+ * Zero-based index among siblings in the target container.
2111
+ * When omitted, appends to the end.
1647
2112
  */
1648
- loadRequest(requestId: number): Promise<void>;
2113
+ index?: number;
2114
+ }
2115
+ /**
2116
+ * Payload for {@link PluginHost.reorderRequests}.
2117
+ */
2118
+ export interface ReorderRequestsInput {
2119
+ /** Parent collection database id. */
2120
+ collectionId: number;
2121
+ /** Folder id, or null for collection-root requests. */
2122
+ folderId: number | null;
2123
+ /** Request ids in desired order. */
2124
+ orderedRequestIds: number[];
2125
+ }
2126
+ /**
2127
+ * Payload for {@link PluginHost.createDocument}.
2128
+ *
2129
+ * Does not open the document in a tab — use a later host open API for that.
2130
+ */
2131
+ export interface CreateDocumentInput {
2132
+ /** Parent collection database id. */
2133
+ collectionId: number;
2134
+ /** Parent folder id, or null/omitted for collection root. */
2135
+ folderId?: number | null;
2136
+ /** Display file name. */
2137
+ name: string;
2138
+ /** Optional markdown body; defaults to empty. */
2139
+ content?: string;
2140
+ }
2141
+ /**
2142
+ * Payload for {@link PluginHost.renameDocument}.
2143
+ */
2144
+ export interface RenameDocumentInput {
2145
+ /** Document database id. */
2146
+ id: number;
2147
+ /** Parent collection database id. */
2148
+ collectionId: number;
2149
+ /** New display file name. */
2150
+ name: string;
2151
+ }
2152
+ /**
2153
+ * Payload for {@link PluginHost.deleteDocument}.
2154
+ *
2155
+ * Silent — plugins must confirm before calling.
2156
+ */
2157
+ export interface DeleteDocumentInput {
2158
+ /** Document database id. */
2159
+ id: number;
2160
+ /** Parent collection database id. */
2161
+ collectionId: number;
2162
+ }
2163
+ /**
2164
+ * Payload for {@link PluginHost.moveDocument}.
2165
+ */
2166
+ export interface MoveDocumentInput {
2167
+ /** Parent collection database id. */
2168
+ collectionId: number;
2169
+ /** Document database id. */
2170
+ documentId: number;
2171
+ /** Target folder id, or null for collection root. */
2172
+ folderId: number | null;
1649
2173
  /**
1650
- * Sends the active request editor tab using the same pipeline as the Send button
1651
- * (pre/post scripts, variable substitution, auth merge, and history).
1652
- *
1653
- * No-op when a send is already in flight for the active tab.
2174
+ * Zero-based index among siblings in the target container.
2175
+ * When omitted, appends to the end.
1654
2176
  */
1655
- sendRequest(): Promise<void>;
1656
- /**
1657
- * Creates a new environment, populates it with variables, and selects it as active.
2177
+ index?: number;
2178
+ }
2179
+ /**
2180
+ * Payload for {@link PluginHost.reorderDocuments}.
2181
+ */
2182
+ export interface ReorderDocumentsInput {
2183
+ /** Parent collection database id. */
2184
+ collectionId: number;
2185
+ /** Folder id, or null for collection-root documents. */
2186
+ folderId: number | null;
2187
+ /** Document ids in desired order. */
2188
+ orderedDocumentIds: number[];
2189
+ }
2190
+ /**
2191
+ * Kind of sidebar row that shares a collection root or folder container order.
2192
+ */
2193
+ export type ContainerItemKind = 'request' | 'document';
2194
+ /**
2195
+ * Stable reference to a request or markdown document in a shared container.
2196
+ */
2197
+ export interface ContainerItemRef {
2198
+ /** Whether this entry is a saved request or a markdown document. */
2199
+ kind: ContainerItemKind;
2200
+ /** Database id of the request or document. */
2201
+ id: number;
2202
+ }
2203
+ /**
2204
+ * Payload for {@link PluginHost.reorderContainerItems}.
2205
+ *
2206
+ * Use this when a folder or collection root interleaves requests and documents
2207
+ * in one list. Prefer {@link ReorderRequestsInput} / {@link ReorderDocumentsInput}
2208
+ * when reordering a single entity kind.
2209
+ */
2210
+ export interface ReorderContainerItemsInput {
2211
+ /** Parent collection database id. */
2212
+ collectionId: number;
2213
+ /** Folder id, or null for collection-root items. */
2214
+ folderId: number | null;
2215
+ /** Request and document refs in desired interleaved order. */
2216
+ items: ContainerItemRef[];
2217
+ }
2218
+ /**
2219
+ * Target for {@link PluginHost.showEntityContextMenu}.
2220
+ *
2221
+ * Matches built-in sidebar context menu targets (`collection` | `folder` | `request`).
2222
+ * Documents are not supported in v1.
2223
+ */
2224
+ export type EntityContextMenuTarget = {
2225
+ type: 'collection';
2226
+ collectionId: number;
2227
+ } | {
2228
+ type: 'folder';
2229
+ collectionId: number;
2230
+ folderId: number;
2231
+ } | {
2232
+ type: 'request';
2233
+ requestId: number;
2234
+ };
2235
+ /**
2236
+ * Payload for {@link PluginHost.showEntityContextMenu}.
2237
+ *
2238
+ * Coordinates are local to the plugin webview viewport; the host offsets them
2239
+ * using the HostedSurface bounds. When the surface cannot be found, `x`/`y`
2240
+ * are treated as host viewport coordinates.
2241
+ */
2242
+ export interface ShowEntityContextMenuInput {
2243
+ /** Entity the menu should act on. */
2244
+ target: EntityContextMenuTarget;
2245
+ /** X coordinate in the plugin webview viewport. */
2246
+ x: number;
2247
+ /** Y coordinate in the plugin webview viewport. */
2248
+ y: number;
2249
+ /** Plugin manifest id that owns the requesting surface. */
2250
+ pluginId: string;
2251
+ /** Sidebar panel contribution id mounted in the surface. */
2252
+ contributionId: string;
2253
+ }
2254
+ /**
2255
+ * Collection metadata returned by {@link PluginHost.getCollectionMetadata}.
2256
+ *
2257
+ * Includes settings fields plugins may read; prefer {@link CollectionSummary} for trees.
2258
+ */
2259
+ export interface HostCollection extends CollectionSummary {
2260
+ /** Collection-scoped variables. */
2261
+ variables: Variable[];
2262
+ /** Collection-level headers. */
2263
+ headers: KeyValue[];
2264
+ /** User-Agent override; empty inherits the global default. */
2265
+ userAgent: string;
2266
+ /** Default Authorization settings. */
2267
+ auth: AuthConfig;
2268
+ /** Legacy single pre-request script string. */
2269
+ pre_request_script: string;
2270
+ /** Legacy single post-request script string. */
2271
+ post_request_script: string;
2272
+ }
2273
+ /**
2274
+ * Full saved request returned by {@link PluginHost.listCollectionRequests}.
2275
+ *
2276
+ * Prefer {@link SavedRequestSummary} when only sidebar fields are needed.
2277
+ */
2278
+ export interface HostSavedRequest extends SavedRequestSummary {
2279
+ /** Request URL without query parameters. */
2280
+ url: string;
2281
+ /** Request headers. */
2282
+ headers: KeyValue[];
2283
+ /** Query parameters. */
2284
+ params: KeyValue[];
2285
+ /** Raw request body content. */
2286
+ body: string;
2287
+ /** Content type of the request body. */
2288
+ body_type: BodyType;
2289
+ /** Free-form notes. */
2290
+ comment: string;
2291
+ /** Comma-separated labels. */
2292
+ tags: string;
2293
+ /** ISO 8601 last-saved timestamp. */
2294
+ updated_at: string;
2295
+ }
2296
+ /**
2297
+ * Input for {@link PluginHost.sendHttpRequest}.
2298
+ */
2299
+ export interface PluginSendRequestInput {
2300
+ /** HTTP method to use. */
2301
+ method: HttpMethod;
2302
+ /** Request URL without query parameters. */
2303
+ url: string;
2304
+ /** Request headers. */
2305
+ headers: KeyValue[];
2306
+ /** Query parameters. */
2307
+ params: KeyValue[];
2308
+ /** Raw request body content. */
2309
+ body: string;
2310
+ /** Content type of the request body. */
2311
+ bodyType: BodyType;
2312
+ /** Optional verbatim Raw body override. */
2313
+ bodyRaw?: string;
2314
+ /** Saved request id when the send originated from a saved tab. */
2315
+ sourceRequestId?: number;
2316
+ /** Display name when {@link sourceRequestId} is set. */
2317
+ sourceRequestName?: string;
2318
+ }
2319
+ /**
2320
+ * Result of {@link PluginHost.sendHttpRequest}.
2321
+ */
2322
+ export interface PluginSendResult {
2323
+ /** HTTP status code, or 0 when the request failed before a response. */
2324
+ status: number;
2325
+ /** HTTP status text. */
2326
+ statusText: string;
2327
+ /** Response headers. */
2328
+ headers: Record<string, string>;
2329
+ /** Response body as text. */
2330
+ body: string;
2331
+ /**
2332
+ * Base64-encoded body for binary / non-textual responses (images, PDF, zip, etc.);
2333
+ * omitted for JSON, text-ish, and HTML-ish bodies.
2334
+ */
2335
+ bodyBase64?: string;
2336
+ /** Round-trip time in milliseconds. */
2337
+ timeMs: number;
2338
+ /** Response body size in bytes. */
2339
+ sizeBytes: number;
2340
+ /** Error message when the request failed. */
2341
+ error?: string;
2342
+ }
2343
+ /**
2344
+ * Typed wrappers for built-in HarborClient request editor commands.
2345
+ *
2346
+ * Requires the `ui` permission (except {@link PluginHost.sendHttpRequest}, which
2347
+ * requires `network`). Prefer these over stringly-typed
2348
+ * {@link PluginCommands.execute} for opening request tabs.
2349
+ */
2350
+ export interface PluginHost {
2351
+ /**
2352
+ * Opens a new request tab seeded with captured send metadata.
2353
+ *
2354
+ * @param payload - Partial draft fields from a recent request entry.
2355
+ */
2356
+ openRequestDraft(payload: OpenRequestDraftPayload): Promise<void>;
2357
+ /**
2358
+ * Updates the active request editor tab in place with the given draft fields.
2359
+ *
2360
+ * Provided fields replace the corresponding values on the active draft.
2361
+ * When `headers` or `params` are supplied, those tables are replaced entirely
2362
+ * (not merged). Throws when there is no active request tab.
2363
+ *
2364
+ * Requires the `ui` permission.
2365
+ *
2366
+ * @param payload - Partial draft fields to apply to the active tab.
2367
+ */
2368
+ applyRequestDraft(payload: ApplyRequestDraftPayload): Promise<void>;
2369
+ /**
2370
+ * Opens a saved collection request or focuses an existing tab for it.
2371
+ *
2372
+ * Also updates host sidebar selection (collection/folder highlight) to match
2373
+ * the built-in tree click path.
2374
+ *
2375
+ * @param requestId - Saved request database id.
2376
+ */
2377
+ loadRequest(requestId: number): Promise<void>;
2378
+ /**
2379
+ * Opens a saved markdown document or focuses an existing tab for it.
2380
+ *
2381
+ * Requires the `ui` permission. Also updates host sidebar selection.
2382
+ *
2383
+ * @param documentId - Collection document database id.
2384
+ */
2385
+ loadDocument(documentId: number): Promise<void>;
2386
+ /**
2387
+ * Opens collection settings in a page tab.
2388
+ *
2389
+ * Requires the `ui` permission.
2390
+ *
2391
+ * @param collectionId - Collection database id.
2392
+ */
2393
+ openCollectionSettings(collectionId: number): Promise<void>;
2394
+ /**
2395
+ * Opens the collection runner for an entire collection.
2396
+ *
2397
+ * Requires the `ui` permission.
2398
+ *
2399
+ * @param collectionId - Collection database id.
2400
+ */
2401
+ openCollectionRunner(collectionId: number): Promise<void>;
2402
+ /**
2403
+ * Opens the share-collection modal for a collection.
2404
+ *
2405
+ * Requires the `ui` permission.
2406
+ *
2407
+ * @param collectionId - Collection database id.
2408
+ */
2409
+ openShareModal(collectionId: number): Promise<void>;
2410
+ /**
2411
+ * Opens the host's built-in entity context menu for a collection, folder, or request.
2412
+ *
2413
+ * Builds the same menu groups the built-in Collections tree would show
2414
+ * (including {@link PluginUi.registerContextMenuItem} contributions) and
2415
+ * positions the panel in the host window. Coordinates are webview-local;
2416
+ * the host maps them using the HostedSurface bounds.
2417
+ *
2418
+ * Requires the `ui` permission. Fire-and-forget — does not wait for the
2419
+ * user to dismiss the menu.
2420
+ *
2421
+ * Limitations: submenu positioning and focus return to the webview may be
2422
+ * imperfect; document targets are not supported.
2423
+ *
2424
+ * @param input - Target, coordinates, and requesting surface identity.
2425
+ */
2426
+ showEntityContextMenu(input: ShowEntityContextMenuInput): Promise<void>;
2427
+ /**
2428
+ * Returns the current host sidebar selection (collection/folder/request/document).
2429
+ *
2430
+ * Requires the `ui` permission.
2431
+ */
2432
+ getSidebarSelection(): Promise<SidebarSelection | null>;
2433
+ /**
2434
+ * Updates host sidebar selection the same way the built-in tree does.
2435
+ *
2436
+ * Selecting a request or document also opens/focuses its editor tab.
2437
+ * Passing `null` clears the collection/folder highlight.
2438
+ *
2439
+ * Requires the `ui` permission.
2440
+ *
2441
+ * @param selection - Target selection, or null to clear.
2442
+ */
2443
+ setSidebarSelection(selection: SidebarSelection | null): Promise<void>;
2444
+ /**
2445
+ * Subscribes to host sidebar selection changes (reveal-in-sidebar, tab focus, plugin sets).
2446
+ *
2447
+ * Requires the `ui` permission.
2448
+ *
2449
+ * @param listener - Called when selection changes.
2450
+ * @returns A {@link Disposable} that removes the listener when disposed.
2451
+ */
2452
+ onSidebarSelectionChanged(listener: (selection: SidebarSelection | null) => void): Disposable;
2453
+ /**
2454
+ * Sends the active request editor tab using the same pipeline as the Send button
2455
+ * (pre/post scripts, variable substitution, auth merge, and history).
2456
+ *
2457
+ * No-op when a send is already in flight for the active tab.
2458
+ */
2459
+ sendRequest(): Promise<void>;
2460
+ /**
2461
+ * Creates a new environment, populates it with variables, and selects it as active.
1658
2462
  *
1659
2463
  * @param name - Display name for the new environment.
1660
2464
  * @param variables - Initial variable rows.
@@ -1677,6 +2481,331 @@ export interface PluginHost {
1677
2481
  * @returns The database id of the created collection.
1678
2482
  */
1679
2483
  createCollection(payload: CreateCollectionPayload): Promise<CreateCollectionResult>;
2484
+ /**
2485
+ * Renames a collection while preserving its other settings.
2486
+ *
2487
+ * Requires the `ui` permission. Silent — no host confirmation dialog.
2488
+ *
2489
+ * @param input - Collection id and new name.
2490
+ */
2491
+ updateCollection(input: UpdateCollectionInput): Promise<CollectionSummary>;
2492
+ /**
2493
+ * Deletes a collection (moves it to trash when supported).
2494
+ *
2495
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2496
+ *
2497
+ * @param collectionId - Collection database id.
2498
+ */
2499
+ deleteCollection(collectionId: number): Promise<void>;
2500
+ /**
2501
+ * Persists a new top-level collection order in the sidebar.
2502
+ *
2503
+ * Requires the `ui` permission.
2504
+ *
2505
+ * @param orderedIds - Collection ids in desired order.
2506
+ */
2507
+ reorderCollections(orderedIds: number[]): Promise<void>;
2508
+ /**
2509
+ * Archives or un-archives a collection.
2510
+ *
2511
+ * Requires the `ui` permission. Silent — plugins must confirm before archiving.
2512
+ *
2513
+ * @param input - Collection id and archived flag.
2514
+ */
2515
+ setCollectionArchived(input: SetCollectionArchivedInput): Promise<void>;
2516
+ /**
2517
+ * Deep-copies a collection and places the duplicate below the original.
2518
+ *
2519
+ * Requires the `ui` permission.
2520
+ *
2521
+ * @param collectionId - Collection database id to duplicate.
2522
+ */
2523
+ duplicateCollection(collectionId: number): Promise<CollectionSummary>;
2524
+ /**
2525
+ * Creates a folder inside a collection (optionally nested under a parent folder).
2526
+ *
2527
+ * Requires the `ui` permission.
2528
+ *
2529
+ * @param input - Collection id, name, and optional parent folder.
2530
+ */
2531
+ createFolder(input: CreateFolderInput): Promise<FolderSummary>;
2532
+ /**
2533
+ * Renames a folder.
2534
+ *
2535
+ * Requires the `ui` permission.
2536
+ *
2537
+ * @param input - Folder id, collection id, and new name.
2538
+ */
2539
+ renameFolder(input: RenameFolderInput): Promise<FolderSummary>;
2540
+ /**
2541
+ * Deletes a folder and its subtree (descendant folders, requests, documents).
2542
+ *
2543
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2544
+ *
2545
+ * @param input - Folder id and parent collection id.
2546
+ */
2547
+ deleteFolder(input: DeleteFolderInput): Promise<void>;
2548
+ /**
2549
+ * Reparents a folder and optionally inserts it at a sibling position.
2550
+ *
2551
+ * Requires the `ui` permission.
2552
+ *
2553
+ * @param input - Move target and optional sort order.
2554
+ */
2555
+ moveFolder(input: MoveFolderInput): Promise<FolderSummary>;
2556
+ /**
2557
+ * Persists a new folder order within a collection container.
2558
+ *
2559
+ * Requires the `ui` permission.
2560
+ *
2561
+ * @param input - Collection id, parent folder, and ordered sibling ids.
2562
+ */
2563
+ reorderFolders(input: ReorderFoldersInput): Promise<void>;
2564
+ /**
2565
+ * Creates a saved request and opens it in an editor tab.
2566
+ *
2567
+ * Requires the `ui` permission.
2568
+ *
2569
+ * @param input - Collection id, optional folder, and optional draft fields.
2570
+ */
2571
+ createRequest(input: CreateRequestInput): Promise<SavedRequestSummary>;
2572
+ /**
2573
+ * Deletes a saved request.
2574
+ *
2575
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2576
+ *
2577
+ * @param requestId - Saved request database id.
2578
+ */
2579
+ deleteRequest(requestId: number): Promise<void>;
2580
+ /**
2581
+ * Duplicates a saved request in the same collection/folder and opens the copy.
2582
+ *
2583
+ * Requires the `ui` permission.
2584
+ *
2585
+ * @param requestId - Saved request database id to duplicate.
2586
+ */
2587
+ duplicateRequest(requestId: number): Promise<SavedRequestSummary>;
2588
+ /**
2589
+ * Moves a saved request to another folder or the collection root.
2590
+ *
2591
+ * Requires the `ui` permission.
2592
+ *
2593
+ * @param input - Request id, target folder, and optional index.
2594
+ */
2595
+ moveRequest(input: MoveRequestInput): Promise<void>;
2596
+ /**
2597
+ * Persists a new request order within a folder or collection root.
2598
+ *
2599
+ * Requires the `ui` permission.
2600
+ *
2601
+ * @param input - Collection id, folder id, and ordered request ids.
2602
+ */
2603
+ reorderRequests(input: ReorderRequestsInput): Promise<void>;
2604
+ /**
2605
+ * Creates a markdown document in a collection (optionally inside a folder).
2606
+ *
2607
+ * Does not open the document in a tab.
2608
+ *
2609
+ * Requires the `ui` permission.
2610
+ *
2611
+ * @param input - Collection id, name, and optional folder/content.
2612
+ */
2613
+ createDocument(input: CreateDocumentInput): Promise<DocumentSummary>;
2614
+ /**
2615
+ * Renames a markdown document without changing its body.
2616
+ *
2617
+ * Requires the `ui` permission.
2618
+ *
2619
+ * @param input - Document id, collection id, and new name.
2620
+ */
2621
+ renameDocument(input: RenameDocumentInput): Promise<DocumentSummary>;
2622
+ /**
2623
+ * Deletes a markdown document.
2624
+ *
2625
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2626
+ *
2627
+ * @param input - Document id and parent collection id.
2628
+ */
2629
+ deleteDocument(input: DeleteDocumentInput): Promise<void>;
2630
+ /**
2631
+ * Moves a markdown document to another folder or the collection root.
2632
+ *
2633
+ * Requires the `ui` permission.
2634
+ *
2635
+ * @param input - Document id, target folder, and optional index.
2636
+ */
2637
+ moveDocument(input: MoveDocumentInput): Promise<void>;
2638
+ /**
2639
+ * Persists a new document order within a folder or collection root.
2640
+ *
2641
+ * Requires the `ui` permission.
2642
+ *
2643
+ * @param input - Collection id, folder id, and ordered document ids.
2644
+ */
2645
+ reorderDocuments(input: ReorderDocumentsInput): Promise<void>;
2646
+ /**
2647
+ * Persists interleaved request + document order in one folder or collection root.
2648
+ *
2649
+ * Requires the `ui` permission. Prefer this over separate request/document
2650
+ * reorder APIs when the UI shows a mixed container list.
2651
+ *
2652
+ * @param input - Collection id, folder id, and ordered item refs.
2653
+ */
2654
+ reorderContainerItems(input: ReorderContainerItemsInput): Promise<void>;
2655
+ /**
2656
+ * Lists collection summaries for building a sidebar tree.
2657
+ *
2658
+ * Archived collections are omitted unless {@link LibraryListOptions.includeArchived} is true.
2659
+ *
2660
+ * Requires the `ui` permission.
2661
+ *
2662
+ * @param options - Optional archive filter.
2663
+ */
2664
+ listCollections(options?: LibraryListOptions): Promise<CollectionSummary[]>;
2665
+ /**
2666
+ * Lists folder summaries for one collection.
2667
+ *
2668
+ * Requires the `ui` permission.
2669
+ *
2670
+ * @param collectionId - Collection database id.
2671
+ */
2672
+ listFolders(collectionId: number): Promise<FolderSummary[]>;
2673
+ /**
2674
+ * Lists lightweight saved-request summaries for one collection (no body/auth).
2675
+ *
2676
+ * Distinct from {@link listCollectionRequests}, which returns full rows in run order.
2677
+ *
2678
+ * Requires the `ui` permission.
2679
+ *
2680
+ * @param collectionId - Collection database id.
2681
+ */
2682
+ listRequests(collectionId: number): Promise<SavedRequestSummary[]>;
2683
+ /**
2684
+ * Lists markdown document summaries for one collection (no content body).
2685
+ *
2686
+ * Requires the `ui` permission.
2687
+ *
2688
+ * @param collectionId - Collection database id.
2689
+ */
2690
+ listDocuments(collectionId: number): Promise<DocumentSummary[]>;
2691
+ /**
2692
+ * Returns a full library snapshot (collections + nested folders/requests/documents).
2693
+ *
2694
+ * Requires the `ui` permission.
2695
+ *
2696
+ * @param options - Optional archive filter.
2697
+ */
2698
+ listLibraryTree(options?: LibraryListOptions): Promise<LibraryTreeSnapshot>;
2699
+ /**
2700
+ * Subscribes to coarse library invalidation events so plugins can refetch without polling.
2701
+ *
2702
+ * Requires the `ui` permission.
2703
+ *
2704
+ * @param listener - Called when collections, folders, requests, or documents refresh.
2705
+ * @returns A {@link Disposable} that removes the listener when disposed.
2706
+ */
2707
+ onLibraryChanged(listener: (event: LibraryChangedEvent) => void): Disposable;
2708
+ /**
2709
+ * Lists all workflows from the local registry.
2710
+ *
2711
+ * Requires the `ui` permission.
2712
+ */
2713
+ listWorkflows(): Promise<HostWorkflow[]>;
2714
+ /**
2715
+ * Returns one workflow by database id, or `null` when missing.
2716
+ *
2717
+ * Requires the `ui` permission.
2718
+ *
2719
+ * @param workflowId - Workflow database id.
2720
+ */
2721
+ getWorkflow(workflowId: number): Promise<HostWorkflow | null>;
2722
+ /**
2723
+ * Creates a workflow in the local registry.
2724
+ *
2725
+ * Requires the `ui` permission.
2726
+ *
2727
+ * @param input - Name, actions, duration, and optional uuid/variables.
2728
+ */
2729
+ createWorkflow(input: CreateWorkflowPayload): Promise<HostWorkflow>;
2730
+ /**
2731
+ * Replaces a workflow's actions and duration while preserving name and variables.
2732
+ *
2733
+ * Requires the `ui` permission.
2734
+ *
2735
+ * @param input - Workflow id, actions, and duration.
2736
+ */
2737
+ updateWorkflow(input: UpdateWorkflowPayload): Promise<HostWorkflow>;
2738
+ /**
2739
+ * Renames a workflow while preserving actions and variables.
2740
+ *
2741
+ * Requires the `ui` permission.
2742
+ *
2743
+ * @param workflowId - Workflow database id.
2744
+ * @param name - New display name.
2745
+ */
2746
+ renameWorkflow(workflowId: number, name: string): Promise<HostWorkflow>;
2747
+ /**
2748
+ * Deletes a workflow (moves it to trash when supported).
2749
+ *
2750
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2751
+ *
2752
+ * @param workflowId - Workflow database id.
2753
+ */
2754
+ deleteWorkflow(workflowId: number): Promise<void>;
2755
+ /**
2756
+ * Subscribes to coarse workflow invalidation events so plugins can refetch without polling.
2757
+ *
2758
+ * Requires the `ui` permission.
2759
+ *
2760
+ * @param listener - Called when workflows are created, updated, renamed, or deleted.
2761
+ * @returns A {@link Disposable} that removes the listener when disposed.
2762
+ */
2763
+ onWorkflowsChanged(listener: (event: WorkflowsChangedEvent) => void): Disposable;
2764
+ /**
2765
+ * Returns saved requests for a collection or folder in sidebar run order.
2766
+ *
2767
+ * Requires the `ui` permission.
2768
+ *
2769
+ * @param collectionId - Collection database id.
2770
+ * @param folderId - Optional folder id; omit or null for collection-root run order.
2771
+ */
2772
+ listCollectionRequests(collectionId: number, folderId?: number | null): Promise<HostSavedRequest[]>;
2773
+ /**
2774
+ * Returns collection metadata needed to resolve saved requests in plugins.
2775
+ *
2776
+ * Requires the `ui` permission.
2777
+ *
2778
+ * @param collectionId - Collection database id.
2779
+ */
2780
+ getCollectionMetadata(collectionId: number): Promise<HostCollection>;
2781
+ /**
2782
+ * Appends one HTTP result to the footer session console from a renderer plugin.
2783
+ *
2784
+ * Requires the `ui` permission.
2785
+ *
2786
+ * @param payload - Request label and send result metadata.
2787
+ */
2788
+ logRequestToConsole(payload: {
2789
+ requestName: string;
2790
+ collectionName?: string;
2791
+ result: PluginSendResult;
2792
+ }): Promise<void>;
2793
+ /**
2794
+ * Sends one HTTP request through the main-process pipeline, bypassing the
2795
+ * renderer's CORS restrictions. Failures resolve to an error result.
2796
+ *
2797
+ * Requires the `network` permission.
2798
+ *
2799
+ * @param input - Request configuration to execute.
2800
+ */
2801
+ sendHttpRequest(input: PluginSendRequestInput): Promise<PluginSendResult>;
2802
+ /**
2803
+ * Clears the active request tab's last HTTP response so plugin-only response
2804
+ * views can take over the panel.
2805
+ *
2806
+ * Requires the `ui` permission.
2807
+ */
2808
+ clearResponse(): Promise<void>;
1680
2809
  /**
1681
2810
  * Opens (or focuses) an image viewer page tab for a local path, URL, or inline image.
1682
2811
  *