@tx5dr/plugin-api 1.0.0 → 1.2.0

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/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # @tx5dr/plugin-api
2
+
3
+ Public plugin API for the [TX-5DR](https://github.com/boybook/tx-5dr) digital radio engine.
4
+
5
+ Plugin authors should import from this package instead of reaching into internal monorepo packages. It provides TypeScript types for plugin definitions, runtime helpers, logbook sync providers, and the iframe Bridge SDK.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install --save-dev @tx5dr/plugin-api
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ### TypeScript
16
+
17
+ ```typescript
18
+ import type { PluginDefinition, PluginContext } from '@tx5dr/plugin-api';
19
+
20
+ const plugin: PluginDefinition = {
21
+ name: 'my-plugin',
22
+ version: '1.0.0',
23
+ type: 'utility',
24
+ hooks: {
25
+ onDecode(messages, ctx) {
26
+ for (const msg of messages) {
27
+ ctx.log.debug('Decoded', { raw: msg.rawMessage });
28
+ }
29
+ },
30
+ },
31
+ };
32
+
33
+ export default plugin;
34
+ ```
35
+
36
+ ### JavaScript (with JSDoc types)
37
+
38
+ ```javascript
39
+ /** @type {import('@tx5dr/plugin-api').PluginDefinition} */
40
+ export default {
41
+ name: 'my-plugin',
42
+ version: '1.0.0',
43
+ type: 'utility',
44
+ hooks: {
45
+ onDecode(messages, ctx) {
46
+ for (const msg of messages) {
47
+ ctx.log.debug('Decoded', { raw: msg.rawMessage });
48
+ }
49
+ },
50
+ },
51
+ };
52
+ ```
53
+
54
+ ## Exports
55
+
56
+ | Subpath | Description |
57
+ |---------|-------------|
58
+ | `@tx5dr/plugin-api` | Core types: `PluginDefinition`, `PluginContext`, `PluginHooks`, helper interfaces, radio/message types |
59
+ | `@tx5dr/plugin-api/testing` | Mock factories for unit testing: `createMockContext()`, `createMockSlotInfo()`, `createMockParsedMessage()` |
60
+ | `@tx5dr/plugin-api/bridge` | Ambient type declarations for the iframe Bridge SDK (`window.tx5dr`) |
61
+
62
+ ## Bridge SDK Types
63
+
64
+ Plugin iframe pages communicate with the host via the Bridge SDK (`window.tx5dr`), which is automatically injected by the host. To get IDE autocomplete for the Bridge SDK, add the type reference to your project:
65
+
66
+ **tsconfig.json / jsconfig.json:**
67
+
68
+ ```json
69
+ {
70
+ "compilerOptions": {
71
+ "types": ["@tx5dr/plugin-api/bridge"]
72
+ }
73
+ }
74
+ ```
75
+
76
+ **Or per-file:**
77
+
78
+ ```javascript
79
+ /// <reference types="@tx5dr/plugin-api/bridge" />
80
+
81
+ tx5dr.invoke('getState').then(function(state) {
82
+ // Full autocomplete for tx5dr methods
83
+ });
84
+ ```
85
+
86
+ ## CSS Design Tokens
87
+
88
+ The host injects CSS custom properties (`--tx5dr-*`) into every iframe page. A reference copy is included in this package at `tokens.css` — copy it into your project for CSS autocomplete in your IDE:
89
+
90
+ ```bash
91
+ cp node_modules/@tx5dr/plugin-api/tokens.css ./ui/
92
+ ```
93
+
94
+ Then use the tokens in your plugin CSS:
95
+
96
+ ```css
97
+ .container {
98
+ background: var(--tx5dr-bg-content);
99
+ color: var(--tx5dr-text);
100
+ border-radius: var(--tx5dr-radius-md);
101
+ padding: var(--tx5dr-spacing-md);
102
+ font-family: var(--tx5dr-font);
103
+ }
104
+ ```
105
+
106
+ ## Testing
107
+
108
+ ```typescript
109
+ import { describe, it, expect } from 'vitest';
110
+ import {
111
+ createMockContext,
112
+ createMockSlotInfo,
113
+ createMockParsedMessage,
114
+ } from '@tx5dr/plugin-api/testing';
115
+ import plugin from './index.js';
116
+
117
+ describe('my-plugin', () => {
118
+ it('processes decoded messages', () => {
119
+ const ctx = createMockContext();
120
+ const messages = [createMockParsedMessage({ rawMessage: 'CQ W1AW FN31' })];
121
+
122
+ plugin.hooks!.onDecode!(messages, ctx);
123
+
124
+ expect(ctx.log._calls.some(c => c.level === 'debug')).toBe(true);
125
+ });
126
+ });
127
+ ```
128
+
129
+ ## Documentation
130
+
131
+ For the full plugin system guide, see [docs/plugin-system.md](https://github.com/boybook/tx-5dr/blob/main/docs/plugin-system.md).
132
+
133
+ ## License
134
+
135
+ MIT
package/dist/context.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { KVStore, PluginLogger, PluginTimers, OperatorControl, RadioControl, LogbookAccess, BandAccess, UIBridge } from './helpers.js';
1
+ import type { KVStore, PluginLogger, PluginTimers, OperatorControl, RadioControl, LogbookAccess, BandAccess, UIBridge, PluginFileStore } from './helpers.js';
2
+ import type { LogbookSyncRegistrar } from './sync.js';
2
3
  /**
3
4
  * Runtime services exposed to a plugin instance.
4
5
  *
@@ -60,7 +61,13 @@ export interface PluginContext {
60
61
  */
61
62
  readonly radio: RadioControl;
62
63
  /**
63
- * Read-only access to logbook-derived history.
64
+ * Full logbook access read-only queries, record writes and UI notifications.
65
+ *
66
+ * Provides the original read-only helpers (`hasWorked`, `hasWorkedDXCC`,
67
+ * `hasWorkedGrid`) plus advanced query (`queryQSOs`, `countQSOs`), write
68
+ * (`addQSO`, `updateQSO`) and notification (`notifyUpdated`) capabilities.
69
+ * Sync providers and other data-oriented plugins use the write methods to
70
+ * self-orchestrate their flow without host-side special handling.
64
71
  */
65
72
  readonly logbook: LogbookAccess;
66
73
  /**
@@ -68,9 +75,26 @@ export interface PluginContext {
68
75
  */
69
76
  readonly band: BandAccess;
70
77
  /**
71
- * Bridge for pushing structured data into declarative plugin panels.
78
+ * Bridge for pushing structured data into declarative plugin panels and
79
+ * for communicating with custom iframe UI pages.
72
80
  */
73
81
  readonly ui: UIBridge;
82
+ /**
83
+ * Persistent binary file storage sandboxed to the plugin.
84
+ *
85
+ * Files are stored in the plugin data directory under a host-managed sandbox.
86
+ * Use this for binary assets such as certificates, images or cached data.
87
+ * For structured JSON data, prefer {@link PluginContext.store} instead.
88
+ */
89
+ readonly files: PluginFileStore;
90
+ /**
91
+ * Logbook sync registration entry point.
92
+ *
93
+ * Utility plugins that implement logbook synchronization call
94
+ * `ctx.logbookSync.register(provider)` during `onLoad` to register their
95
+ * sync provider. The host manages the provider lifecycle and UI integration.
96
+ */
97
+ readonly logbookSync: LogbookSyncRegistrar;
74
98
  /**
75
99
  * Permission-gated HTTP client.
76
100
  *
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,QAAQ,EACT,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEnD;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE;QACd;;WAEG;QACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QAEzB;;WAEG;QACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;KAC5B,CAAC;IAEF;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC;IAE3B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEnC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IAEtB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,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AM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CACzE"}
@@ -1,4 +1,4 @@
1
- import type { PluginSettingDescriptor, PluginQuickAction, PluginQuickSetting, PluginPanelDescriptor, PluginPermission, PluginType } from '@tx5dr/contracts';
1
+ import type { PluginSettingDescriptor, PluginQuickAction, PluginQuickSetting, PluginPanelDescriptor, PluginPermission, PluginType, PluginInstanceScope, PluginUIPageDescriptor } from '@tx5dr/contracts';
2
2
  import type { PluginContext } from './context.js';
3
3
  import type { PluginHooks } from './hooks.js';
4
4
  import type { StrategyRuntime } from './runtime.js';
@@ -91,6 +91,13 @@ export interface PluginDefinition {
91
91
  * do not own the core automation state machine.
92
92
  */
93
93
  type: PluginType;
94
+ /**
95
+ * Controls whether the host creates one instance per operator or a single
96
+ * shared instance for the whole station.
97
+ *
98
+ * Defaults to `operator` when omitted.
99
+ */
100
+ instanceScope?: PluginInstanceScope;
94
101
  /**
95
102
  * Human-readable summary shown in plugin management UIs.
96
103
  *
@@ -132,8 +139,14 @@ export interface PluginDefinition {
132
139
  /**
133
140
  * Panel descriptors used to render plugin-owned UI sections.
134
141
  *
135
- * Panels are declarative containers. Plugins push live data into them through
136
- * {@link PluginContext.ui} rather than rendering custom frontend code.
142
+ * Structured panels (`key-value`, `table`, `log`, `chart`) receive live data
143
+ * through {@link PluginContext.ui.send}. Iframe panels (`component: 'iframe'`)
144
+ * render a custom HTML page and communicate via `invoke` / `onPush`.
145
+ *
146
+ * Each panel has a `slot` that controls where it renders: `'operator'` (the
147
+ * default, shown in the operator card) or `'automation'` (shown in the
148
+ * top-right automation popover). Panels may also declare a preferred
149
+ * `width`, such as `'full'`, so hosts can promote more important live panels.
137
150
  */
138
151
  panels?: PluginPanelDescriptor[];
139
152
  /**
@@ -146,6 +159,25 @@ export interface PluginDefinition {
146
159
  storage?: {
147
160
  scopes: ('global' | 'operator')[];
148
161
  };
162
+ /**
163
+ * Declares custom UI pages served from the plugin's static file directory.
164
+ *
165
+ * Pages are rendered inside an iframe by the host's `PluginIframeHost`
166
+ * component. The host automatically injects CSS design tokens and a
167
+ * communication bridge SDK. Plugins can use any web technology inside the
168
+ * iframe.
169
+ *
170
+ * Pages are declarative — they only define _what_ exists, not _where_ it is
171
+ * rendered. The rendering location is decided by consumers (e.g. a logbook
172
+ * sync host renders the page in a settings modal tab, while a future
173
+ * dashboard host may render it in a side panel).
174
+ */
175
+ ui?: {
176
+ /** Static file directory relative to the plugin root (default: 'ui'). */
177
+ dir?: string;
178
+ /** Registered custom UI pages. */
179
+ pages?: PluginUIPageDescriptor[];
180
+ };
149
181
  /**
150
182
  * Creates the strategy runtime for a `strategy` plugin.
151
183
  *
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAEjC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,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+1,4 @@
1
- import type { ParsedFT8Message, SlotInfo, SlotPack, QSORecord, FrameMessage, OperatorSlots, ModeDescriptor } from '@tx5dr/contracts';
1
+ import type { ParsedFT8Message, SlotInfo, SlotPack, QSORecord, FrameMessage, OperatorSlots, ModeDescriptor, PermissionGrant } from '@tx5dr/contracts';
2
2
  import type { StrategyRuntimeSnapshot } from './runtime.js';
3
3
  /**
4
4
  * Simple persistent key-value store exposed to plugins.
@@ -25,6 +25,14 @@ export interface KVStore {
25
25
  * Returns a shallow snapshot of all stored entries in this scope.
26
26
  */
27
27
  getAll(): Record<string, unknown>;
28
+ /**
29
+ * Flushes pending writes to persistent storage.
30
+ *
31
+ * In normal operation the host flushes automatically. Call this explicitly
32
+ * only when you need to guarantee that recently written data survives a
33
+ * crash or restart (e.g. during a migration sequence).
34
+ */
35
+ flush(): Promise<void>;
28
36
  }
29
37
  /**
30
38
  * Structured logger dedicated to a plugin instance.
@@ -141,7 +149,71 @@ export interface RadioControl {
141
149
  setFrequency(freq: number): Promise<void>;
142
150
  }
143
151
  /**
144
- * Read-only helpers backed by the station logbook.
152
+ * Filter criteria for querying QSO records from the logbook.
153
+ *
154
+ * This type is defined in the plugin-api layer so plugins have no compile-time
155
+ * dependency on core internals. The host translates it to the storage layer's
156
+ * native query format.
157
+ */
158
+ export interface QSOQueryFilter {
159
+ /** Match a specific callsign (exact match). */
160
+ callsign?: string;
161
+ /** Restrict to a time window (epoch ms). */
162
+ timeRange?: {
163
+ start: number;
164
+ end: number;
165
+ };
166
+ /** Restrict to a frequency window (Hz). */
167
+ frequencyRange?: {
168
+ min: number;
169
+ max: number;
170
+ };
171
+ /** Mode filter (e.g. 'FT8'). */
172
+ mode?: string;
173
+ /**
174
+ * QSL confirmation status filter.
175
+ * - `'confirmed'`: at least one platform confirmed
176
+ * - `'uploaded'`: at least one platform uploaded but not confirmed
177
+ * - `'none'`: not uploaded to any platform
178
+ */
179
+ qslStatus?: 'confirmed' | 'uploaded' | 'none';
180
+ /** Maximum number of records to return. */
181
+ limit?: number;
182
+ /** Number of records to skip (for pagination). */
183
+ offset?: number;
184
+ /** Sort direction. Defaults to descending (newest first). */
185
+ orderDirection?: 'asc' | 'desc';
186
+ }
187
+ /**
188
+ * Callsign-bound view over a single logbook.
189
+ *
190
+ * The host resolves the concrete logbook lazily on each operation, which keeps
191
+ * the handle valid even if the underlying logbook is created or reloaded later.
192
+ */
193
+ export interface CallsignLogbookAccess {
194
+ /** Normalized callsign that scopes this accessor. */
195
+ readonly callsign: string;
196
+ /** Returns the resolved logbook id, or null when no logbook exists yet. */
197
+ getLogBookId(): Promise<string | null>;
198
+ /** Queries QSO records matching the given filter. */
199
+ queryQSOs(filter: QSOQueryFilter): Promise<import('@tx5dr/contracts').QSORecord[]>;
200
+ /** Counts QSO records matching the given filter. */
201
+ countQSOs(filter?: QSOQueryFilter): Promise<number>;
202
+ /** Adds a new QSO record to this callsign's logbook. */
203
+ addQSO(record: import('@tx5dr/contracts').QSORecord): Promise<void>;
204
+ /** Updates partial fields of an existing QSO record. */
205
+ updateQSO(qsoId: string, updates: Partial<import('@tx5dr/contracts').QSORecord>): Promise<void>;
206
+ /** Returns current statistics for this callsign's logbook. */
207
+ getStatistics(): Promise<import('@tx5dr/contracts').LogBookStatistics | null>;
208
+ /** Notifies the frontend that this callsign's logbook changed. */
209
+ notifyUpdated(operatorId?: string): Promise<void>;
210
+ }
211
+ /**
212
+ * Full logbook access for plugins.
213
+ *
214
+ * Extends the original read-only helpers with query, write and notification
215
+ * capabilities so that sync providers can self-orchestrate their entire flow
216
+ * without host-side special handling.
145
217
  */
146
218
  export interface LogbookAccess {
147
219
  /** Checks whether the callsign has already been worked. */
@@ -150,6 +222,18 @@ export interface LogbookAccess {
150
222
  hasWorkedDXCC(dxccEntity: string): Promise<boolean>;
151
223
  /** Checks whether the Maidenhead grid has already been worked. */
152
224
  hasWorkedGrid(grid: string): Promise<boolean>;
225
+ /** Queries QSO records matching the given filter. */
226
+ queryQSOs(filter: QSOQueryFilter): Promise<import('@tx5dr/contracts').QSORecord[]>;
227
+ /** Counts QSO records matching the given filter. */
228
+ countQSOs(filter?: QSOQueryFilter): Promise<number>;
229
+ /** Returns a callsign-bound accessor suitable for global plugin instances. */
230
+ forCallsign(callsign: string): CallsignLogbookAccess;
231
+ /** Adds a new QSO record. Deduplication is the caller's responsibility. */
232
+ addQSO(record: import('@tx5dr/contracts').QSORecord): Promise<void>;
233
+ /** Updates partial fields of an existing QSO record (e.g. QSL status). */
234
+ updateQSO(qsoId: string, updates: Partial<import('@tx5dr/contracts').QSORecord>): Promise<void>;
235
+ /** Notifies the frontend to refresh logbook data (call after batch writes). */
236
+ notifyUpdated(): Promise<void>;
153
237
  }
154
238
  /**
155
239
  * Optional constraints used when asking the host for a quieter transmit offset.
@@ -219,5 +303,104 @@ export interface UIBridge {
219
303
  * Publishes new panel data for the given declarative panel id.
220
304
  */
221
305
  send(panelId: string, data: unknown): void;
306
+ /**
307
+ * Registers a handler for custom messages sent from iframe UI pages via the
308
+ * `bridge.invoke()` SDK method. The host routes incoming invoke requests to
309
+ * the handler and sends the return value back to the iframe.
310
+ *
311
+ * Only one handler can be registered per plugin instance. Calling this method
312
+ * again replaces the previous handler.
313
+ */
314
+ registerPageHandler(handler: PluginUIHandler): void;
315
+ /**
316
+ * Pushes a custom message to the specific page session.
317
+ *
318
+ * Prefer this API whenever the plugin already knows the target session id
319
+ * (for example from {@link PluginUIRequestContext.pageSessionId} or
320
+ * `requestContext.page.sessionId`).
321
+ */
322
+ pushToSession(pageSessionId: string, action: string, data?: unknown): void;
323
+ /**
324
+ * Lists active page sessions for the current plugin instance and page id.
325
+ *
326
+ * This is useful for background timers or sync completions that need to
327
+ * notify every open page tied to the same runtime instance.
328
+ */
329
+ listActivePageSessions(pageId: string): PluginUIPageSessionInfo[];
330
+ /**
331
+ * Pushes a custom message to an iframe UI page by page id.
332
+ *
333
+ * This compatibility helper only succeeds when exactly one active session of
334
+ * the current plugin instance matches the page id. If multiple sessions are
335
+ * open, the host throws `explicit_page_session_required`.
336
+ */
337
+ pushToPage(pageId: string, action: string, data?: unknown): void;
338
+ }
339
+ /**
340
+ * Handler for custom messages sent from iframe UI pages.
341
+ *
342
+ * Plugins register a handler via `ctx.ui.registerPageHandler()` to receive
343
+ * arbitrary invoke requests from their iframe-based UIs. The host acts as a
344
+ * transparent router — it does not inspect or interpret the action or data.
345
+ */
346
+ export interface PluginUIHandler {
347
+ /**
348
+ * Called when the iframe sends an invoke request via `bridge.invoke(action, data)`.
349
+ *
350
+ * @param pageId - The page that sent the message.
351
+ * @param action - Developer-defined action identifier.
352
+ * @param data - Arbitrary payload from the iframe.
353
+ * @param requestContext - Host-authenticated page context, including any
354
+ * bound resource for this page session.
355
+ * @returns The response value sent back to the iframe.
356
+ */
357
+ onMessage(pageId: string, action: string, data: unknown, requestContext: PluginUIRequestContext): Promise<unknown>;
358
+ }
359
+ export interface PluginUIRequestUser {
360
+ readonly tokenId: string;
361
+ readonly role: 'viewer' | 'operator' | 'admin';
362
+ readonly operatorIds: string[];
363
+ readonly permissionGrants?: PermissionGrant[];
364
+ }
365
+ export interface PluginUIBoundResource {
366
+ readonly kind: 'callsign' | 'operator';
367
+ readonly value: string;
368
+ }
369
+ export type PluginUIInstanceTarget = {
370
+ readonly kind: 'global';
371
+ } | {
372
+ readonly kind: 'operator';
373
+ readonly operatorId: string;
374
+ };
375
+ export interface PluginUIPageSessionInfo {
376
+ readonly sessionId: string;
377
+ readonly pageId: string;
378
+ readonly resource?: PluginUIBoundResource;
379
+ }
380
+ export interface PluginUIPageContext extends PluginUIPageSessionInfo {
381
+ push(action: string, data?: unknown): void;
382
+ }
383
+ export interface PluginUIRequestContext {
384
+ readonly pageSessionId: string;
385
+ readonly user: PluginUIRequestUser;
386
+ readonly resource?: PluginUIBoundResource;
387
+ readonly instanceTarget: PluginUIInstanceTarget;
388
+ readonly page: PluginUIPageContext;
389
+ }
390
+ /**
391
+ * Persistent binary file storage for plugins.
392
+ *
393
+ * Files are stored in a sandboxed directory under the plugin's data path. Path
394
+ * traversal outside the sandbox is rejected by the host.
395
+ */
396
+ export interface PluginFileStore {
397
+ /** Writes (or overwrites) a file at the given path. */
398
+ write(path: string, data: Buffer): Promise<void>;
399
+ /** Reads a file. Returns `null` when the path does not exist. */
400
+ read(path: string): Promise<Buffer | null>;
401
+ /** Deletes a file. Returns `true` if the file existed and was removed. */
402
+ delete(path: string): Promise<boolean>;
403
+ /** Lists file paths under the given prefix (or all files when omitted). */
404
+ list(prefix?: string): Promise<string[]>;
222
405
  }
223
406
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,aAAa,EACb,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB;;;;OAIG;IACH,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAEnD;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,mDAAmD;IACnD,IAAI,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CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC1C"}
package/dist/index.d.ts CHANGED
@@ -25,9 +25,20 @@ export type { PluginContext } from './context.js';
25
25
  export type { PluginHooks, AutoCallProposal, AutoCallExecutionRequest, AutoCallExecutionPlan, ScoredCandidate, StrategyDecision, StrategyDecisionMeta, LastMessageInfo, } from './hooks.js';
26
26
  export type { StrategyRuntime, StrategyRuntimeContext, StrategyRuntimeSnapshot, StrategyRuntimeSlot, StrategyRuntimeSlotContentUpdate, } from './runtime.js';
27
27
  /** Host-provided helper interfaces available through {@link PluginContext}. */
28
- export type { KVStore, PluginLogger, PluginTimers, OperatorControl, RadioControl, LogbookAccess, BandAccess, IdleTransmitFrequencyOptions, AutoTargetEligibilityReason, AutoTargetEligibilityDecision, UIBridge, } from './helpers.js';
28
+ export type { KVStore, PluginLogger, PluginTimers, OperatorControl, RadioControl, LogbookAccess, CallsignLogbookAccess, QSOQueryFilter, BandAccess, IdleTransmitFrequencyOptions, AutoTargetEligibilityReason, AutoTargetEligibilityDecision, UIBridge, PluginUIHandler, PluginUIRequestContext, PluginUIRequestUser, PluginUIBoundResource, PluginUIInstanceTarget, PluginUIPageSessionInfo, PluginUIPageContext, PluginFileStore, } from './helpers.js';
29
29
  /** Common radio/message/settings types re-exported for plugin author convenience. */
30
- export type { FT8Message, FT8MessageBase, FT8MessageCQ, FT8MessageCall, FT8MessageSignalReport, FT8MessageRogerReport, FT8MessageRRR, FT8MessageSeventyThree, FT8MessageFoxRR73, FT8MessageCustom, FT8MessageUnknown, ParsedFT8Message, LogbookAnalysis, SlotInfo, SlotPack, QSORecord, FrameMessage, ModeDescriptor, OperatorSlots, DxccStatus, TargetSelectionPriorityMode, PluginType, PluginPermission, PluginSettingType, PluginSettingDescriptor, PluginSettingScope, PluginQuickAction, PluginQuickSetting, PluginCapability, PluginPanelDescriptor, PluginPanelComponent, PluginSettingOption, PluginStorageScope, PluginStorageConfig, PluginManifest, PluginStatus, } from '@tx5dr/contracts';
30
+ export type { FT8Message, FT8MessageBase, FT8MessageCQ, FT8MessageCall, FT8MessageSignalReport, FT8MessageRogerReport, FT8MessageRRR, FT8MessageSeventyThree, FT8MessageFoxRR73, FT8MessageCustom, FT8MessageUnknown, ParsedFT8Message, LogbookAnalysis, SlotInfo, SlotPack, QSORecord, FrameMessage, ModeDescriptor, OperatorSlots, DxccStatus, TargetSelectionPriorityMode, PluginType, PluginInstanceScope, PluginPermission, PluginSettingType, PluginSettingDescriptor, PluginSettingScope, PluginQuickAction, PluginQuickSetting, PluginCapability, PluginPanelDescriptor, PluginPanelComponent, PluginPanelWidth, PluginSettingOption, PluginStorageScope, PluginStorageConfig, PluginManifest, PluginStatus, PluginUIPageDescriptor, PluginUIConfig, } from '@tx5dr/contracts';
31
+ /** Logbook sync provider interfaces. */
32
+ export type { LogbookSyncProvider, LogbookSyncRegistrar, SyncAction, SyncTestResult, SyncUploadOptions, SyncUploadResult, SyncPreflightIssue, SyncUploadPreflightResult, SyncDownloadResult, SyncDownloadOptions, } from './sync.js';
31
33
  /** Stable runtime enum values commonly referenced by plugin implementations. */
32
34
  export { FT8MessageType } from './ft8-message-type.js';
35
+ /** Utility functions for plugin authors. */
36
+ export { normalizeCallsign } from './utils/callsign.js';
37
+ /** ADIF (Amateur Data Interchange Format) utilities. */
38
+ export { parseADIFContent, parseADIFRecord, parseADIFFields, convertQSOToADIF, generateADIFFile, formatADIFDate, formatADIFTime, parseADIFDateTime, } from './utils/adif.js';
39
+ /** Plugin page scope path utilities. */
40
+ export { getPluginPageScopePath, getPluginPageScopeSegments, } from './utils/page-scope.js';
41
+ export type { PluginPageBoundResource } from './utils/page-scope.js';
42
+ /** QSO text field utilities. */
43
+ export { parseLegacyComment, resolveQsoComment, buildCommentFromMessageHistory, normalizeMessageHistory, } from './utils/qso-text-fields.js';
33
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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BAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAE1B,wCAAwC;AACxC,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAEnB,gFAAgF;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,4CAA4C;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,wDAAwD;AACxD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,wCAAwC;AACxC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,gCAAgC;AAChC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -21,4 +21,12 @@
21
21
  */
22
22
  /** Stable runtime enum values commonly referenced by plugin implementations. */
23
23
  export { FT8MessageType } from './ft8-message-type.js';
24
+ /** Utility functions for plugin authors. */
25
+ export { normalizeCallsign } from './utils/callsign.js';
26
+ /** ADIF (Amateur Data Interchange Format) utilities. */
27
+ export { parseADIFContent, parseADIFRecord, parseADIFFields, convertQSOToADIF, generateADIFFile, formatADIFDate, formatADIFTime, parseADIFDateTime, } from './utils/adif.js';
28
+ /** Plugin page scope path utilities. */
29
+ export { getPluginPageScopePath, getPluginPageScopeSegments, } from './utils/page-scope.js';
30
+ /** QSO text field utilities. */
31
+ export { parseLegacyComment, resolveQsoComment, buildCommentFromMessageHistory, normalizeMessageHistory, } from './utils/qso-text-fields.js';
24
32
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA8EH,gFAAgF;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA0GH,gFAAgF;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,4CAA4C;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,wDAAwD;AACxD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,wCAAwC;AACxC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAG/B,gCAAgC;AAChC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,4BAA4B,CAAC"}