gloomberb 0.20.3 → 0.20.4

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 (154) hide show
  1. package/package.json +1 -1
  2. package/src/account/auth-dialog.tsx +17 -0
  3. package/src/api-client/data.ts +6 -0
  4. package/src/api-client/fx-interventions.ts +64 -0
  5. package/src/api-client/index.ts +1 -0
  6. package/src/api-client/release-summaries.ts +21 -0
  7. package/src/app/keybindings/actions.ts +2 -2
  8. package/src/app/pane-runtime/ticker-open-runtime.ts +245 -66
  9. package/src/cli/commands/market.ts +77 -1
  10. package/src/cli/commands/news-search.ts +1 -3
  11. package/src/cli/commands/plugins.ts +27 -5
  12. package/src/cli/commands/system.ts +19 -3
  13. package/src/cli/commands/ticker.ts +60 -19
  14. package/src/cli/index.ts +8 -8
  15. package/src/cli/pane-functions/function-help.ts +3 -3
  16. package/src/cli/report-tables.ts +18 -6
  17. package/src/cli/result.ts +15 -7
  18. package/src/cli/types.ts +2 -0
  19. package/src/components/chart/composite/axis-overlays.tsx +22 -0
  20. package/src/components/chart/composite/composite-chart.tsx +54 -13
  21. package/src/components/chart/composite/event-captions.ts +109 -0
  22. package/src/components/chart/composite/event-guides.ts +74 -0
  23. package/src/components/chart/composite/rasterizer.ts +2 -0
  24. package/src/components/chart/composite/text-renderer.ts +2 -0
  25. package/src/components/chart/composite/types.ts +31 -0
  26. package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
  27. package/src/components/command-bar/routes/root/provider-search.ts +5 -4
  28. package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
  29. package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
  30. package/src/components/layout/detached-pane-shell.tsx +1 -1
  31. package/src/components/layout/floating-pane.tsx +5 -1
  32. package/src/components/layout/pane/footer/index.tsx +21 -14
  33. package/src/components/layout/pane/footer/model.ts +6 -0
  34. package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
  35. package/src/components/layout/shell/active-drag.ts +149 -105
  36. package/src/components/layout/shell/drag/drop-zones.ts +162 -0
  37. package/src/components/layout/shell/drag/index.ts +47 -218
  38. package/src/components/layout/shell/drag/live.ts +10 -3
  39. package/src/components/layout/shell/drag/overlays.tsx +182 -5
  40. package/src/components/layout/shell/drag/runtime.ts +29 -6
  41. package/src/components/layout/shell/drag/shared-edges.ts +156 -0
  42. package/src/components/layout/shell/index.tsx +11 -6
  43. package/src/components/layout/shell/menu.ts +11 -2
  44. package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
  45. package/src/components/layout/shell/native/window-state.ts +2 -2
  46. package/src/components/layout/shell/pane/layers.tsx +71 -7
  47. package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
  48. package/src/components/layout/shell/window-mode/index.ts +8 -10
  49. package/src/components/layout/window-edit/mode.ts +39 -7
  50. package/src/components/layout/window-edit/presentation.ts +1 -1
  51. package/src/components/onboarding/onboarding-keyboard.ts +4 -0
  52. package/src/components/onboarding/onboarding-wizard.tsx +8 -3
  53. package/src/components/ui/button.tsx +2 -0
  54. package/src/components/ui/choice-dialog.tsx +1 -0
  55. package/src/components/ui/data-table/index.tsx +4 -3
  56. package/src/components/ui/list-view.tsx +7 -12
  57. package/src/components/ui/loading.tsx +10 -3
  58. package/src/components/ui/menu.tsx +6 -2
  59. package/src/components/ui/quote.ts +14 -1
  60. package/src/data/config/layout.ts +5 -2
  61. package/src/docs/snapshot.json +29 -5
  62. package/src/i18n/es.ts +9 -8
  63. package/src/i18n/ja.ts +9 -8
  64. package/src/i18n/ko.ts +9 -8
  65. package/src/i18n/zh-cn.ts +9 -8
  66. package/src/i18n/zh-tw.ts +9 -8
  67. package/src/layout/pane-manager/floating-actions.ts +17 -0
  68. package/src/layout/pane-manager/floating-stack.ts +187 -0
  69. package/src/layout/pane-manager/floating.ts +4 -2
  70. package/src/layout/pane-manager/gridlock.ts +5 -1
  71. package/src/layout/pane-manager/index.ts +11 -0
  72. package/src/layout/pane-manager/layout-state.ts +10 -3
  73. package/src/market-data/futures-board.ts +46 -1
  74. package/src/market-data/futures-contract.ts +12 -3
  75. package/src/market-data/fx-interventions.ts +270 -0
  76. package/src/news/news-model.ts +44 -2
  77. package/src/plugins/builtin/alerts/cli.ts +4 -4
  78. package/src/plugins/builtin/alerts/format.ts +1 -2
  79. package/src/plugins/builtin/alerts/headless.ts +1 -2
  80. package/src/plugins/builtin/alerts/move-checks.ts +12 -6
  81. package/src/plugins/builtin/alerts/move.ts +30 -9
  82. package/src/plugins/builtin/alerts/pane.tsx +0 -2
  83. package/src/plugins/builtin/alerts/storage.ts +4 -2
  84. package/src/plugins/builtin/alerts/types.ts +12 -0
  85. package/src/plugins/builtin/changelog/index.tsx +292 -101
  86. package/src/plugins/builtin/changelog/versions.ts +293 -0
  87. package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
  88. package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
  89. package/src/plugins/builtin/chat/message/render-state.ts +2 -5
  90. package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
  91. package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
  92. package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
  93. package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
  94. package/src/plugins/builtin/cloud/askg/model.ts +14 -4
  95. package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
  96. package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
  97. package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
  98. package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
  99. package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
  100. package/src/plugins/builtin/cloud/terminal-relay/redact.ts +47 -6
  101. package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
  102. package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
  103. package/src/plugins/builtin/cot/headless.ts +14 -2
  104. package/src/plugins/builtin/earnings/index.tsx +2 -2
  105. package/src/plugins/builtin/futures/index.tsx +25 -4
  106. package/src/plugins/builtin/futures/model.ts +28 -32
  107. package/src/plugins/builtin/futures/series.ts +4 -3
  108. package/src/plugins/builtin/futures/table.tsx +16 -9
  109. package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
  110. package/src/plugins/builtin/help/index.tsx +3 -3
  111. package/src/plugins/builtin/help/keybindings-editor.tsx +18 -4
  112. package/src/plugins/builtin/layout-manager/index.tsx +8 -8
  113. package/src/plugins/builtin/news/headless.ts +2 -2
  114. package/src/plugins/builtin/news/index.tsx +3 -3
  115. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  116. package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
  117. package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
  118. package/src/plugins/builtin/research/event-model.ts +9 -1
  119. package/src/plugins/builtin/research/event-sources.ts +22 -0
  120. package/src/plugins/builtin/research/headless.ts +3 -3
  121. package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
  122. package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
  123. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +28 -13
  124. package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
  125. package/src/plugins/installer.ts +45 -0
  126. package/src/remote/resources.ts +12 -1
  127. package/src/remote/schema.ts +1 -0
  128. package/src/remote/semantic-helpers.ts +29 -1
  129. package/src/remote/semantic-tree.tsx +32 -15
  130. package/src/renderers/cloudflare/worker.ts +16 -1
  131. package/src/renderers/dom/styles.css +40 -6
  132. package/src/renderers/share/layout-view.tsx +1 -1
  133. package/src/sources/gloomberb-cloud/news.ts +35 -12
  134. package/src/state/opening-ticker-panes.ts +47 -0
  135. package/src/test-support/cli-context.ts +2 -0
  136. package/src/test-support/preload.ts +4 -1
  137. package/src/tickers/instrument-kind.ts +23 -3
  138. package/src/types/config.ts +5 -0
  139. package/src/types/context-menu.ts +2 -0
  140. package/src/types/plugin-commands.ts +140 -0
  141. package/src/types/plugin-context.ts +125 -0
  142. package/src/types/plugin-contributions.ts +55 -0
  143. package/src/types/plugin-definition.ts +234 -0
  144. package/src/types/plugin-notifications.ts +38 -0
  145. package/src/types/plugin-pane-settings.ts +114 -0
  146. package/src/types/plugin-pane-templates.ts +160 -0
  147. package/src/types/plugin-panes.ts +221 -0
  148. package/src/types/plugin-reports.ts +35 -0
  149. package/src/types/plugin-shared.ts +14 -0
  150. package/src/types/plugin-state.ts +71 -0
  151. package/src/types/plugin.ts +14 -1169
  152. package/src/ui/index.tsx +14 -3
  153. package/src/updater/github-releases.ts +23 -0
  154. package/src/utils/cli-output.ts +22 -9
@@ -0,0 +1,221 @@
1
+ import type { ReactNode } from "react";
2
+ import type { PaneInstanceConfig } from "./config";
3
+ import type { HeadlessPaneArgumentDef, HeadlessPaneDefinition, HeadlessPaneFreshness } from "./headless";
4
+ import type { TickerInstrumentKind } from "./instrument";
5
+ import type { PaneSettingsContext, PaneSettingsDef } from "./plugin-pane-settings";
6
+ import type { PaneLock, PaneReportOptionDef } from "./plugin-reports";
7
+ import type { TickerRecord } from "./ticker";
8
+
9
+ export interface PaneProps {
10
+ paneId: string;
11
+ paneType: string;
12
+ focused: boolean;
13
+ width: number;
14
+ height: number;
15
+ close?: () => void;
16
+ }
17
+
18
+ export type PaneSharePrivateFields = true | readonly string[];
19
+
20
+ export interface PanePortableShareDef {
21
+ /** Fields excluded before pane configuration or state leaves the device. */
22
+ private?: {
23
+ title?: boolean;
24
+ params?: PaneSharePrivateFields;
25
+ settings?: PaneSharePrivateFields;
26
+ state?: PaneSharePrivateFields;
27
+ };
28
+ /**
29
+ * Rewrites the instance before it leaves the device, on every publish. The
30
+ * receiver has none of the sender's local ticker records, so anything
31
+ * resolved through them (a listing's venue, for example) must be pinned into
32
+ * the instance here; a layout published to the gallery passes none.
33
+ */
34
+ prepare?(pane: PaneInstanceConfig, context: {
35
+ tickers: ReadonlyMap<string, TickerRecord>;
36
+ /** The moment the pane's layout tab has its crosshair pinned at, so a link opens there. */
37
+ pinnedTime?: number;
38
+ }): PaneInstanceConfig;
39
+ }
40
+
41
+ export interface PaneDef {
42
+ id: string;
43
+ name: string;
44
+ icon?: string;
45
+ component: (props: PaneProps) => ReactNode;
46
+ defaultPosition: "left" | "right";
47
+ defaultWidth?: string;
48
+ defaultFloatingSize?: { width: number; height: number };
49
+ defaultMode?: "docked" | "floating";
50
+ /** Pane publishes its selected symbol as pane-state `cursorSymbol`, so ticker panes can follow it. */
51
+ tickerSource?: boolean;
52
+ /**
53
+ * Pane shows one ticker read through its binding (`usePaneTicker`, `usePaneTickerIdentity`), so
54
+ * its pane menu offers "Link to" each visible list, scanner, and other single-ticker pane, and
55
+ * it then follows that pane's selection. A function decides per instance (a chart with one
56
+ * security, not a comparison). A follower must never write its own `cursorSymbol`: that would
57
+ * win over the binding.
58
+ */
59
+ tickerFollower?: boolean | ((pane: PaneInstanceConfig) => boolean);
60
+ /**
61
+ * A single-ticker pane that keeps its ticker somewhere besides its binding (a chart's series)
62
+ * moves it here when ticker search changes the ticker the pane shows. The host has already set
63
+ * the binding and the title; `previous` is the ticker the pane showed until now.
64
+ */
65
+ retargetTicker?(pane: PaneInstanceConfig, symbol: string, previous: string | null): PaneInstanceConfig;
66
+ /**
67
+ * Instrument kinds this pane has data for, such as `["equity"]` for company
68
+ * data, as a research tab declares them. Bound to a ticker of another known
69
+ * kind (an index, an ETF), the pane says so in place of its data, and `fn`
70
+ * and `shot` answer before loading. Omit when every ticker has it.
71
+ */
72
+ instruments?: readonly TickerInstrumentKind[];
73
+ /**
74
+ * For a pane type that two or more functions open (ERN and EVTS): the settings that say
75
+ * what a window shows, as against how (a range, a toggle, a column choice). Opening a
76
+ * function again focuses a window whose binding, params and settings match what the
77
+ * function opens; a window with a setting of its own that is not listed here is still that
78
+ * window, and one with a listed setting the function does not set belongs to another
79
+ * function and is left alone. Without it, a pane type opened by several functions is
80
+ * matched on its settings exactly, and a window that picked up any setting is not found.
81
+ * An empty list says binding and params alone name the window.
82
+ */
83
+ identitySettings?: readonly string[];
84
+ /**
85
+ * The title a saved window of this pane has, from its params and settings,
86
+ * for lists that name windows without rendering them (the Layouts browser).
87
+ * A pane that titles itself by what it shows ("Curve \u00b7 BZ") gives the same
88
+ * title here, so two of its windows are told apart before either is opened.
89
+ */
90
+ instanceTitle?(pane: PaneInstanceConfig): string | null;
91
+ /** Renderer-neutral data model used by CLI functions, automation, and hosted tools. */
92
+ headless?: HeadlessPaneDefinition;
93
+ /**
94
+ * Source and status a rendered-view report (`fn` on a pane without a
95
+ * `headless` model) cites, when "Gloom Cloud" with the state the footer
96
+ * shows would be wrong: local data, a calculator, filed records.
97
+ */
98
+ reportFreshness?: Pick<HeadlessPaneFreshness, "source" | "status" | "basis" | "local">;
99
+ /**
100
+ * Options a rendered-view report takes (`fn OMON AAPL --strikes 10`):
101
+ * each sets the pane setting of its key, is checked by its `normalize`, and
102
+ * is listed with its example by `gloom catalog`.
103
+ */
104
+ reportOptions?: readonly PaneReportOptionDef[];
105
+ /**
106
+ * A rendered-view report that takes its `reportOptions` and nothing else:
107
+ * any other option is refused with the ones it takes (`fn FUT --bogus 1`),
108
+ * as a `headless` report refuses one, instead of being set as a pane
109
+ * setting of that name.
110
+ */
111
+ reportOptionsOnly?: boolean;
112
+ /**
113
+ * What a rendered-view report takes after the function, for a pane whose
114
+ * template reads it with no shortcut to say so (X Feed's query): the
115
+ * catalog lists it, and `fn` refuses an argument from a function that
116
+ * declares none here, in its shortcut or in a `headless` model.
117
+ */
118
+ reportArgument?: Pick<HeadlessPaneArgumentDef, "kind" | "placeholder" | "description" | "optional"> & {
119
+ /**
120
+ * The argument names something the pane opens by its own id (the story
121
+ * pane's story id), never a symbol: `fn` does not look it up as a ticker.
122
+ * A query (X Feed's) leaves it unset and keeps its ticker reading.
123
+ */
124
+ identifier?: boolean;
125
+ };
126
+ /**
127
+ * Lines a rendered-view report prints above its table, from the settings it
128
+ * ran with: what the default view leaves out and how to see more. `--json`
129
+ * carries them in `data.metadata.notices`.
130
+ */
131
+ reportNotices?(settings: Readonly<Record<string, unknown>>): string[];
132
+ /**
133
+ * What a rendered-view report prints in place of the pane when a sign-in
134
+ * wall or the Pro lock covers all of it: what is locked, what can still be
135
+ * read without it and where, and how to unlock it. A `headless` pane's report
136
+ * prints it when the server refuses the read (401, 402 or 403). Without it
137
+ * the report prints the wall's own words, or the refusal. Either way it cites
138
+ * no source, since nothing was read. A free route it names must have data
139
+ * for the symbol (`lock.context` reads it), so the note may resolve later.
140
+ */
141
+ reportLockNote?(lock: PaneLock): string | Promise<string>;
142
+ /**
143
+ * The sign-in wall covers the whole pane whenever there is no Gloom Cloud
144
+ * session (ASKG): a rendered-view report without one prints its
145
+ * `reportLockNote` at once rather than render the wall to read it.
146
+ */
147
+ signInWall?: boolean;
148
+ /**
149
+ * What a rendered-view report needs before it shows anything, such as a
150
+ * sign-in: `gloom catalog` lists it under Requires, as it does a
151
+ * `headless` model's `discovery.dataRequirements`.
152
+ */
153
+ reportRequirements?: readonly string[];
154
+ /**
155
+ * A `shot` without `--height` grows to the pane's natural height, up to the
156
+ * height limit, so a fixed board (FUT) shows every row instead of cutting
157
+ * the last ones. Leave it off for long or paged lists; a pane with tabs
158
+ * answers for the instance shown, so only its fixed board's tab grows.
159
+ */
160
+ shotFitsRows?: true | ((pane: PaneInstanceConfig) => boolean);
161
+ /**
162
+ * A report of the pane grows to the whole text of the page its reader has
163
+ * open (a docs page), so it is not cut at the first screen. A list the reader
164
+ * opens from keeps its height.
165
+ */
166
+ shotFitsReader?: true;
167
+ /** Add an Excel-compatible CSV action for the pane's single active DataTable. */
168
+ tableExport?: true;
169
+ settings?: PaneSettingsDef | ((context: PaneSettingsContext) => PaneSettingsDef | null);
170
+ /** Portable sharing is public by default; list the few pane-owned fields that must remain local. */
171
+ portableShare?: PanePortableShareDef;
172
+ /**
173
+ * The person's own data the pane shows, so copying a public link to it,
174
+ * posting its picture in a bug report and attaching it to an Ask Gloom
175
+ * question ask first. A function decides
176
+ * per instance from what it shows now (a chat pane on a public channel, a
177
+ * quote of a ticker not held), and a function that returns null opts that
178
+ * instance out. Leave it off for market data. A pane that says nothing is
179
+ * still asked about when its plugin connects a broker (`holdings`) or the
180
+ * pane keeps fields private when shared (`portableShare.private`,
181
+ * `personal`), for plugins written before this field existed; declare it
182
+ * to say exactly what the pane shows.
183
+ */
184
+ personalData?: PanePersonalData | ((context: PanePersonalDataContext) => PanePersonalData | null);
185
+ /**
186
+ * Compact controls surfaced next to the pane title. A key references a
187
+ * toggle field in settings, or a two-option select field when `onValue` is set.
188
+ */
189
+ quickSettings?: readonly PaneQuickSettingDef[];
190
+ }
191
+
192
+ /**
193
+ * Kinds of personal data a pane can show: `holdings` (positions, balances,
194
+ * orders, profit and loss), `account` (account numbers, email, plan),
195
+ * `messages` (private conversations) and `personal` (the person's own data
196
+ * of a kind the pane does not name).
197
+ */
198
+ export type PanePersonalData = "holdings" | "account" | "messages" | "personal";
199
+
200
+ export interface PaneQuickSettingDef {
201
+ type: "toggle";
202
+ key: string;
203
+ icon: "zap" | "sqrt";
204
+ label?: string;
205
+ /**
206
+ * For a two-option select field: the option the control turns on. Turning
207
+ * it off picks the field's other option.
208
+ */
209
+ onValue?: string;
210
+ /**
211
+ * Shows the control only where it changes something, for a setting that
212
+ * applies to some of what the pane can show. The field stays in the
213
+ * settings dialog either way.
214
+ */
215
+ visible?: (context: PaneSettingsContext) => boolean;
216
+ }
217
+
218
+ /** What `PaneDef.personalData` decides from: the pane's settings context and the tickers with their positions. */
219
+ export interface PanePersonalDataContext extends PaneSettingsContext {
220
+ tickers: ReadonlyMap<string, TickerRecord>;
221
+ }
@@ -0,0 +1,35 @@
1
+ import type { HeadlessPaneContext, HeadlessPaneOptionDef } from "./headless";
2
+
3
+ /** What covers a pane when a report of it is refused: see `PaneDef.reportLockNote`. */
4
+ export interface PaneLock {
5
+ /** Sign-in is the wall of a session that is missing or unverified; pro the one of a plan without access. */
6
+ gate: "sign-in" | "pro";
7
+ /** The first symbol the report was asked for, or null. */
8
+ symbol: string | null;
9
+ /** The function code the report was run for, for a pane that serves several (EM and GUID). */
10
+ token?: string;
11
+ /** The session is signed in and its email is not verified yet. */
12
+ verifyEmail?: boolean;
13
+ /**
14
+ * Reads data as the report does, so a note can check that a free route it
15
+ * would name has data for the symbol before naming it. Absent where nothing
16
+ * can be read.
17
+ */
18
+ context?: HeadlessPaneContext;
19
+ }
20
+
21
+ /**
22
+ * An option of a rendered-view report, which sets the pane setting of its key,
23
+ * or of `settingKey` when the flag reads better than the setting's name
24
+ * (`--columns` for `optionColumnIds`); with `pluginState`, the pane state the
25
+ * view reads it from (a workspace's tab), and the setting too when it also
26
+ * names a `settingKey`.
27
+ */
28
+ export interface PaneReportOptionDef extends HeadlessPaneOptionDef {
29
+ /** The value's name in the catalog's flag, `--currencies <codes>`; the type when absent. */
30
+ placeholder?: string;
31
+ /** The option in use as typed after the function, such as `--currencies USD,ZAR,NGN`; the catalog shows it as an example. */
32
+ example?: string;
33
+ /** Checks a typed value and returns it as the pane reads it; throws an Error that names what is wrong. */
34
+ normalize?(value: string): string;
35
+ }
@@ -0,0 +1,14 @@
1
+ export interface WizardStep {
2
+ key: string;
3
+ label: string;
4
+ placeholder?: string;
5
+ defaultValue?: string;
6
+ required?: boolean;
7
+ type?: "text" | "password" | "info" | "select" | "number" | "textarea";
8
+ options?: Array<{ label: string; value: string }>;
9
+ /** Shown only while the earlier answer holds the value; with several, while every one does. */
10
+ dependsOn?: { key: string; value: string } | ReadonlyArray<{ key: string; value: string }>;
11
+ /** Later wizard values to clear when this selection changes from its default. */
12
+ clearOnChange?: string[];
13
+ body?: string[];
14
+ }
@@ -0,0 +1,71 @@
1
+ import type { CachePolicy, PersistedResourceValue } from "./persistence";
2
+
3
+ export interface PluginPersistence {
4
+ getState<T = unknown>(key: string, options?: { schemaVersion?: number }): T | null;
5
+ setState(key: string, value: unknown, options?: { schemaVersion?: number }): void;
6
+ deleteState(key: string): void;
7
+ getResource<T = unknown>(
8
+ kind: string,
9
+ key: string,
10
+ options?: { sourceKey?: string; schemaVersion?: number; allowExpired?: boolean },
11
+ ): PersistedResourceValue<T> | null;
12
+ setResource<T = unknown>(
13
+ kind: string,
14
+ key: string,
15
+ value: T,
16
+ options: {
17
+ cachePolicy: CachePolicy;
18
+ sourceKey?: string;
19
+ schemaVersion?: number;
20
+ provenance?: unknown;
21
+ },
22
+ ): PersistedResourceValue<T>;
23
+ deleteResource(kind: string, key: string, options?: { sourceKey?: string }): void;
24
+ }
25
+
26
+ export interface PluginResumeState {
27
+ getState<T = unknown>(key: string, options?: { schemaVersion?: number }): T | null;
28
+ setState(key: string, value: unknown, options?: { schemaVersion?: number }): void;
29
+ deleteState(key: string): void;
30
+ getPaneState<T = unknown>(paneId: string, key: string): T | null;
31
+ setPaneState(paneId: string, key: string, value: unknown): void;
32
+ deletePaneState(paneId: string, key: string): void;
33
+ }
34
+
35
+ export interface PluginConfigState {
36
+ get<T = unknown>(key: string): T | null;
37
+ set(key: string, value: unknown): Promise<void>;
38
+ delete(key: string): Promise<void>;
39
+ keys(): string[];
40
+ }
41
+
42
+ export interface PluginTeamStateEntry<T> {
43
+ value: T;
44
+ revision: number;
45
+ updatedBy: string;
46
+ updatedAt: string;
47
+ }
48
+
49
+ /**
50
+ * Plugin-owned data shared with a team, keyed per plugin. Writes take the
51
+ * revision they expect and fail when a teammate wrote first, so nothing is
52
+ * overwritten silently. Scoped to the active team unless a teamId is given.
53
+ */
54
+ export interface PluginTeamState {
55
+ activeTeamId(): string | null;
56
+ get<T>(key: string, options?: { teamId?: string }): Promise<PluginTeamStateEntry<T> | null>;
57
+ list<T>(options?: { teamId?: string }): Promise<Array<PluginTeamStateEntry<T> & { key: string }>>;
58
+ set<T>(key: string, value: T, options?: { teamId?: string; expectRevision?: number }): Promise<{ revision: number }>;
59
+ delete(key: string, options?: { teamId?: string }): Promise<void>;
60
+ subscribe<T>(
61
+ key: string,
62
+ listener: (entry: PluginTeamStateEntry<T> | null) => void,
63
+ options?: { teamId?: string },
64
+ ): () => void;
65
+ }
66
+
67
+ export interface PluginPaneSettingsState {
68
+ get<T = unknown>(paneId: string, key: string): T | null;
69
+ set(paneId: string, key: string, value: unknown): Promise<void>;
70
+ delete(paneId: string, key: string): Promise<void>;
71
+ }