@clipbus/plugin-sdk 0.8.7 → 0.9.1
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/API.md +65 -6
- package/README.md +41 -8
- package/SPECIFICATION.md +12 -1
- package/dist/generated/capabilityClients.generated.d.ts +27 -1
- package/dist/generated/data.generated.d.ts +37 -3
- package/dist/generated/hostBootstrap.generated.d.ts +2 -1
- package/dist/generated/hostClients.generated.d.ts +3 -1
- package/dist/generated/runtime.actionResult.generated.d.ts +8 -0
- package/dist/generated/runtime.host.generated.d.ts +3 -1
- package/dist/generated/topicSubscribers.generated.d.ts +3 -1
- package/dist/generated/ui.bootstrap.generated.d.ts +2 -1
- package/dist/generated/ui.clipbus.generated.d.ts +8 -2
- package/dist/preview/index.cjs +12 -0
- package/dist/preview/index.js +12 -0
- package/dist/preview/inputPanel.d.ts +3 -3
- package/dist/preview/types.d.ts +3 -1
- package/dist/preview/wire.d.ts +2 -1
- package/dist/runtime/index.cjs +7 -1
- package/dist/runtime/index.js +7 -1
- package/dist/ui/index.cjs +16 -1
- package/dist/ui/index.js +16 -1
- package/dist/validate/index.cjs +32 -13
- package/dist/validate/index.d.cts +2 -2
- package/dist/validate/index.d.ts +2 -2
- package/dist/validate/index.js +32 -13
- package/docs/authoring.md +34 -4
- package/docs/capability-detection.md +2 -2
- package/docs/entry.md +2 -2
- package/docs/item-context.md +36 -6
- package/docs/manifest.md +13 -5
- package/docs/permissions.md +1 -1
- package/package.json +1 -1
package/API.md
CHANGED
|
@@ -9,10 +9,10 @@ Every entry below maps 1:1 to a catalog descriptor — there is no hidden surfac
|
|
|
9
9
|
|
|
10
10
|
## 1. Overview
|
|
11
11
|
|
|
12
|
-
- **Capabilities**:
|
|
13
|
-
- **Host events**:
|
|
12
|
+
- **Capabilities**: 33
|
|
13
|
+
- **Host events**: 11
|
|
14
14
|
- **Node IPC methods**: 6
|
|
15
|
-
- **Named types**:
|
|
15
|
+
- **Named types**: 31
|
|
16
16
|
|
|
17
17
|
## 2. Capabilities
|
|
18
18
|
|
|
@@ -26,6 +26,22 @@ Every entry below maps 1:1 to a catalog descriptor — there is no hidden surfac
|
|
|
26
26
|
- **Payload**: { formatHint: `string` }
|
|
27
27
|
- **Response**: { path: `string` }
|
|
28
28
|
|
|
29
|
+
#### `action.materializeInputImagePath`
|
|
30
|
+
|
|
31
|
+
- **Side**: runtime
|
|
32
|
+
- **Context**: action
|
|
33
|
+
- **Path**: `action.materializeInputImagePath`
|
|
34
|
+
- **Payload**: { }
|
|
35
|
+
- **Response**: { path: `string` }
|
|
36
|
+
|
|
37
|
+
#### `action.allocateOutputFilePath`
|
|
38
|
+
|
|
39
|
+
- **Side**: runtime
|
|
40
|
+
- **Context**: action
|
|
41
|
+
- **Path**: `action.allocateOutputFilePath`
|
|
42
|
+
- **Payload**: { suggestedName?: `string` }
|
|
43
|
+
- **Response**: { path: `string` }
|
|
44
|
+
|
|
29
45
|
#### `action.setButtons`
|
|
30
46
|
|
|
31
47
|
- **Side**: ui
|
|
@@ -60,6 +76,22 @@ Every entry below maps 1:1 to a catalog descriptor — there is no hidden surfac
|
|
|
60
76
|
- **Payload**: { index: `int` }
|
|
61
77
|
- **Response**: { url?: `string` }
|
|
62
78
|
|
|
79
|
+
#### `asset.currentActionInputImageUrl`
|
|
80
|
+
|
|
81
|
+
- **Side**: ui
|
|
82
|
+
- **Context**: action
|
|
83
|
+
- **Path**: `asset.currentActionInputImageUrl`
|
|
84
|
+
- **Payload**: { }
|
|
85
|
+
- **Response**: { url?: `string` }
|
|
86
|
+
|
|
87
|
+
#### `asset.currentActionInputPathReferenceImageUrl`
|
|
88
|
+
|
|
89
|
+
- **Side**: ui
|
|
90
|
+
- **Context**: action
|
|
91
|
+
- **Path**: `asset.currentActionInputPathReferenceImageUrl`
|
|
92
|
+
- **Payload**: { index: `int` }
|
|
93
|
+
- **Response**: { url?: `string` }
|
|
94
|
+
|
|
63
95
|
#### `asset.registerImage`
|
|
64
96
|
|
|
65
97
|
- **Side**: runtime
|
|
@@ -289,12 +321,16 @@ Every entry below maps 1:1 to a catalog descriptor — there is no hidden surfac
|
|
|
289
321
|
| `item.readAttachment` | `clipbus.item.readAttachment` | `host.item.readAttachment` | any |
|
|
290
322
|
| `asset.currentItemImageUrl` | `clipbus.asset.currentItemImageUrl` | — | any |
|
|
291
323
|
| `asset.pathReferenceImageUrl` | `clipbus.asset.pathReferenceImageUrl` | — | any |
|
|
324
|
+
| `asset.currentActionInputImageUrl` | `clipbus.asset.currentActionInputImageUrl` | — | action |
|
|
325
|
+
| `asset.currentActionInputPathReferenceImageUrl` | `clipbus.asset.currentActionInputPathReferenceImageUrl` | — | action |
|
|
292
326
|
| `asset.registerImage` | — | `host.asset.registerImage` | any |
|
|
293
327
|
| `clipboard.copyText` | `clipbus.clipboard.copyText` | `host.clipboard.copyText` | any |
|
|
294
328
|
| `navigation.openUrl` | `clipbus.navigation.openUrl` | `host.navigation.openUrl` | any |
|
|
295
329
|
| `navigation.revealInFinder` | `clipbus.navigation.revealInFinder` | `host.navigation.revealInFinder` | any |
|
|
296
330
|
| `navigation.openFilePath` | `clipbus.navigation.openFilePath` | `host.navigation.openFilePath` | any |
|
|
297
331
|
| `action.allocateImageTempPath` | — | `host.action.allocateImageTempPath` | action |
|
|
332
|
+
| `action.materializeInputImagePath` | — | `host.action.materializeInputImagePath` | action |
|
|
333
|
+
| `action.allocateOutputFilePath` | — | `host.action.allocateOutputFilePath` | action |
|
|
298
334
|
| `action.setButtons` | `clipbus.action.setButtons` | — | action |
|
|
299
335
|
| `action.complete` | `clipbus.action.complete` | — | action |
|
|
300
336
|
| `attachmentRenderer.setButtons` | `clipbus.attachmentRenderer.setButtons` | — | attachmentRenderer |
|
|
@@ -342,6 +378,14 @@ Every entry below maps 1:1 to a catalog descriptor — there is no hidden surfac
|
|
|
342
378
|
- **Context**: action
|
|
343
379
|
- **Payload**: record<`json`>
|
|
344
380
|
|
|
381
|
+
### `clipbus-plugin-action-input`
|
|
382
|
+
|
|
383
|
+
- **Window global**: `__CLIPBUS_PLUGIN_ACTION_INPUT__`
|
|
384
|
+
- **Topic**: `action.input`
|
|
385
|
+
- **Shape**: topic
|
|
386
|
+
- **Context**: action
|
|
387
|
+
- **Payload**: [`PluginActionUIInput`](#pluginactionuiinput)
|
|
388
|
+
|
|
345
389
|
### `clipbus-plugin-theme`
|
|
346
390
|
|
|
347
391
|
- **Window global**: `__CLIPBUS_PLUGIN_THEME__`
|
|
@@ -394,6 +438,7 @@ Every entry below maps 1:1 to a catalog descriptor — there is no hidden surfac
|
|
|
394
438
|
| `clipbus-plugin-item` | item | topic | `__CLIPBUS_PLUGIN_ITEM__` | any |
|
|
395
439
|
| `clipbus-plugin-attachment` | item.attachment | topic | `__CLIPBUS_PLUGIN_ATTACHMENT__` | attachmentRenderer |
|
|
396
440
|
| `clipbus-plugin-draft` | action.draft | topic | `__CLIPBUS_PLUGIN_DRAFT__` | action |
|
|
441
|
+
| `clipbus-plugin-action-input` | action.input | topic | `__CLIPBUS_PLUGIN_ACTION_INPUT__` | action |
|
|
397
442
|
| `clipbus-plugin-theme` | theme | topic | `__CLIPBUS_PLUGIN_THEME__` | any |
|
|
398
443
|
| `clipbus-plugin-attachment-host-invoke` | attachmentRenderer.onHostInvoke | stream | — | attachmentRenderer |
|
|
399
444
|
| `clipbus-plugin-action-host-invoke` | action.onHostInvoke | stream | — | action |
|
|
@@ -471,9 +516,13 @@ export interface PluginRegistry {
|
|
|
471
516
|
- `label?`: `string`
|
|
472
517
|
- `updatedAtMs?`: `int`
|
|
473
518
|
|
|
519
|
+
### `PluginActionPathResultEntry`
|
|
520
|
+
|
|
521
|
+
Discriminated union on `source`: { source: `'input'`, inputIndex: `int` } | { source: `'allocated_file'`, path: `string`, displayName: `string` }
|
|
522
|
+
|
|
474
523
|
### `PluginActionResult`
|
|
475
524
|
|
|
476
|
-
Discriminated union on `resultKind`: { resultKind: `'text'`, text: `string` } | { resultKind: `'image'`, imageTempPath: `string`, imageFormatHint?: `string` } | { resultKind: `'none'` }
|
|
525
|
+
Discriminated union on `resultKind`: { resultKind: `'text'`, text: `string` } | { resultKind: `'image'`, imageTempPath: `string`, imageFormatHint?: `string` } | { resultKind: `'path_reference'`, entries: [`PluginActionPathResultEntry`](#pluginactionpathresultentry)[] } | { resultKind: `'none'` }
|
|
477
526
|
|
|
478
527
|
### `PluginInfoPanelTextStyle`
|
|
479
528
|
|
|
@@ -532,6 +581,15 @@ Union: `'debug'` | `'info'` | `'warn'` | `'error'`
|
|
|
532
581
|
- `item`: [`PluginClipboardItem`](#pluginclipboarditem)
|
|
533
582
|
- `attachment`: [`PluginAttachmentEntry`](#pluginattachmententry)
|
|
534
583
|
|
|
584
|
+
### `PluginActionUIPathEntry`
|
|
585
|
+
|
|
586
|
+
- `kind`: `'file'` \| `'folder'`
|
|
587
|
+
- `displayName`: `string`
|
|
588
|
+
|
|
589
|
+
### `PluginActionUIInput`
|
|
590
|
+
|
|
591
|
+
Discriminated union on `kind`: { kind: `'text'`, text: `string` } | { kind: `'image'`, width: `int`, height: `int`, format: `string`, bytes: `int` } | { kind: `'path_reference'`, entries: [`PluginActionUIPathEntry`](#pluginactionuipathentry)[] }
|
|
592
|
+
|
|
535
593
|
### `PluginThemeTokens`
|
|
536
594
|
|
|
537
595
|
- `surface`: `string`
|
|
@@ -611,7 +669,7 @@ Discriminated union on `kind`: { kind: `'text'`, text: `string` } | { kind: `'im
|
|
|
611
669
|
|
|
612
670
|
### `PluginResolveActionSessionInput`
|
|
613
671
|
|
|
614
|
-
- `
|
|
672
|
+
- `sourceItem`: [`PluginClipboardItem`](#pluginclipboarditem)
|
|
615
673
|
- `content`: [`PluginContentEnvelope`](#plugincontentenvelope)
|
|
616
674
|
- `attachments`: [`PluginAttachmentRef`](#pluginattachmentref)[]
|
|
617
675
|
|
|
@@ -624,7 +682,7 @@ Discriminated union on `kind`: { kind: `'text'`, text: `string` } | { kind: `'im
|
|
|
624
682
|
|
|
625
683
|
### `PluginAutoRunActionInput`
|
|
626
684
|
|
|
627
|
-
- `
|
|
685
|
+
- `sourceItem`: [`PluginClipboardItem`](#pluginclipboarditem)
|
|
628
686
|
- `content`: [`PluginContentEnvelope`](#plugincontentenvelope)
|
|
629
687
|
- `attachments`: [`PluginAttachmentRef`](#pluginattachmentref)[]
|
|
630
688
|
|
|
@@ -645,6 +703,7 @@ Discriminated union on `kind`: { kind: `'text'`, text: `string` } | { kind: `'im
|
|
|
645
703
|
| `__CLIPBUS_PLUGIN_ITEM__` | `clipbus-plugin-item` |
|
|
646
704
|
| `__CLIPBUS_PLUGIN_ATTACHMENT__` | `clipbus-plugin-attachment` |
|
|
647
705
|
| `__CLIPBUS_PLUGIN_DRAFT__` | `clipbus-plugin-draft` |
|
|
706
|
+
| `__CLIPBUS_PLUGIN_ACTION_INPUT__` | `clipbus-plugin-action-input` |
|
|
648
707
|
| `__CLIPBUS_PLUGIN_THEME__` | `clipbus-plugin-theme` |
|
|
649
708
|
| `__CLIPBUS_PLUGIN_LOCALE__` | `clipbus-plugin-locale` |
|
|
650
709
|
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @clipbus/plugin-sdk
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@clipbus/plugin-sdk": "^0.
|
|
16
|
+
"@clipbus/plugin-sdk": "^0.9.0"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
```
|
|
@@ -58,12 +58,12 @@ Returns a locked `{ result: { resultKind: 'text', text }, userMessage }` shape.
|
|
|
58
58
|
|
|
59
59
|
| Param | Type | Description |
|
|
60
60
|
|---|---|---|
|
|
61
|
-
| `value` | `
|
|
61
|
+
| `value` | `string` | Text result passed to the next auto Action or copied by the user. |
|
|
62
62
|
| `options.userMessage` | `string?` | Optional message shown to the user. |
|
|
63
63
|
|
|
64
64
|
### `actionResult.none(options?)`
|
|
65
65
|
|
|
66
|
-
Returns `{ result: { resultKind: 'none'
|
|
66
|
+
Returns `{ result: { resultKind: 'none' }, userMessage }`. A `none` result cannot advance the Action cascade.
|
|
67
67
|
|
|
68
68
|
### `actionResult.image(value, options?)`
|
|
69
69
|
|
|
@@ -71,12 +71,28 @@ Returns a locked `{ result: { resultKind: 'image', imageTempPath, imageFormatHin
|
|
|
71
71
|
|
|
72
72
|
| Param | Type | Description |
|
|
73
73
|
|---|---|---|
|
|
74
|
-
| `value
|
|
75
|
-
| `
|
|
74
|
+
| `value` | `string` | Path returned by `allocateImageTempPath`. |
|
|
75
|
+
| `options.imageFormatHint` | `string?` | Optional format hint (e.g. `"png"`, `"jpeg"`). |
|
|
76
76
|
| `options.userMessage` | `string?` | Optional message shown to the user. |
|
|
77
77
|
|
|
78
|
+
### `actionResult.path_reference(entries, options?)`
|
|
79
|
+
|
|
80
|
+
Returns a safe path-reference result. Entries must either reuse a current input
|
|
81
|
+
entry (`{source: 'input', inputIndex}`) or reference a path allocated by
|
|
82
|
+
`ctx.host.action.allocateOutputFilePath()` (`{source: 'allocated_file', path, displayName}`).
|
|
83
|
+
Arbitrary filesystem paths are rejected by the host.
|
|
84
|
+
|
|
78
85
|
---
|
|
79
86
|
|
|
87
|
+
### Action input: source identity vs current value
|
|
88
|
+
|
|
89
|
+
Action handlers receive `{ sourceItem, content, attachments }`.
|
|
90
|
+
`sourceItem` remains the original clipboard item identity used by item mutation
|
|
91
|
+
verbs; `content` is the current cascade value and may change kind after every
|
|
92
|
+
auto Action. The Action `attachments` field is reserved for wire stability and
|
|
93
|
+
is currently always `[]` in SDK 0.9.0. Draft Actions can display and copy their
|
|
94
|
+
result, but do not advance to another Action.
|
|
95
|
+
|
|
80
96
|
### `messageHandlers` — handle UI → Runtime RPC calls
|
|
81
97
|
|
|
82
98
|
Register handlers that respond to calls made from UI via `clipbus.runtime.invoke`. Each key is a string; the value is an async function receiving `(request, ctx)`.
|
|
@@ -142,7 +158,9 @@ These verbs are available on the `ctx.host` object passed to every runtime handl
|
|
|
142
158
|
|
|
143
159
|
| Method | Returns | Description |
|
|
144
160
|
|---|---|---|
|
|
145
|
-
| `allocateImageTempPath({formatHint?})` | `Promise<{path: string}>` | Allocates a unique writable path for an image result.
|
|
161
|
+
| `allocateImageTempPath({formatHint?})` | `Promise<{path: string}>` | Allocates a unique writable path for an image result. Pass the returned path to `actionResult.image(imageTempPath, options)`. Cleaned up when invocation scope closes. |
|
|
162
|
+
| `materializeInputImagePath()` | `Promise<{path: string}>` | Materializes the current Action image value, even when `sourceItem` was originally text or a path reference. |
|
|
163
|
+
| `allocateOutputFilePath({suggestedName?})` | `Promise<{path: string}>` | Allocates a host-owned path for a file result. Return it only through an `allocated_file` path-reference entry. |
|
|
146
164
|
|
|
147
165
|
#### `ctx.host.asset`
|
|
148
166
|
|
|
@@ -259,6 +277,8 @@ Returns opaque `clipbus-asset://` URLs so a WebView can render local images in `
|
|
|
259
277
|
|---|---|---|
|
|
260
278
|
| `clipbus.asset.currentItemImageUrl()` | `Verb → {url?: string}` | URL of the current item's own image. `url` is absent when the item is not an image. |
|
|
261
279
|
| `clipbus.asset.pathReferenceImageUrl({index})` | `Verb → {url?: string}` | URL of the current item's `path_reference` entry at `index`. `url` is absent when out of range or the entry is not an image. |
|
|
280
|
+
| `clipbus.asset.currentActionInputImageUrl()` | `Verb → {url?: string}` | Action-context URL for the current image value, independent of `sourceItem.type`. |
|
|
281
|
+
| `clipbus.asset.currentActionInputPathReferenceImageUrl({index})` | `Verb → {url?: string}` | Action-context URL for a current path-reference entry. |
|
|
262
282
|
|
|
263
283
|
Arbitrary / generated images are minted only on the runtime side via `ctx.host.asset.registerImage({path})` (see above), so a WebView XSS cannot turn an arbitrary file into a renderable URL.
|
|
264
284
|
|
|
@@ -303,6 +323,17 @@ Namespace of verbs and sub-topics scoped to the action WebView. `clipbus.action`
|
|
|
303
323
|
| `clipbus.action.complete({result, userMessage?})` | `Verb` | Submit draft action result to host; triggers phase transition to `.success` |
|
|
304
324
|
| `clipbus.action.onHostInvoke(fn)` | `Stream` | Subscribe to host-dispatched button clicks; callback receives `{ buttonID }` |
|
|
305
325
|
|
|
326
|
+
#### `clipbus.action.input` — Topic\<PluginActionUIInput\>
|
|
327
|
+
|
|
328
|
+
The sanitized current Action value. Text is available directly; image exposes
|
|
329
|
+
metadata; path-reference entries expose only `kind` and `displayName`. Real
|
|
330
|
+
paths never enter the WebView.
|
|
331
|
+
|
|
332
|
+
| Member | Shape | Description |
|
|
333
|
+
|---|---|---|
|
|
334
|
+
| `clipbus.action.input.current()` | `() → PluginActionUIInput \| undefined` | Read the current cascade input. |
|
|
335
|
+
| `clipbus.action.input.on(fn)` | `(fn) → Unsubscribe` | Subscribe when the host replaces the current input. |
|
|
336
|
+
|
|
306
337
|
#### `clipbus.action.draft` — OptionalTopic\<Record\<string, unknown\>\>
|
|
307
338
|
|
|
308
339
|
Draft is **read-only** from the UI. The host pushes `initialDraft` (returned by `resolveSession`) as the topic value; the UI keeps form state locally and submits the final result via `clipbus.action.complete(...)`.
|
|
@@ -455,7 +486,9 @@ import type {
|
|
|
455
486
|
PluginActionResolveResult,
|
|
456
487
|
PluginAutoRunActionInput,
|
|
457
488
|
PluginActionOperationResult,
|
|
458
|
-
PluginActionResult, // discriminated union: text | image | none
|
|
489
|
+
PluginActionResult, // discriminated union: text | image | path_reference | none
|
|
490
|
+
PluginActionPathResultEntry,
|
|
491
|
+
PluginActionUIInput,
|
|
459
492
|
PluginActionButton,
|
|
460
493
|
PluginThemeTokens,
|
|
461
494
|
PluginThemeTokenSnapshot,
|
|
@@ -508,7 +541,7 @@ Unlike the host validator (which stops at the first error), this function collec
|
|
|
508
541
|
|
|
509
542
|
### `MANIFEST_VALIDATION_CODES`
|
|
510
543
|
|
|
511
|
-
`readonly string[]` — all
|
|
544
|
+
`readonly string[]` — all 27 error code strings, each a verbatim camelCase name that
|
|
512
545
|
matches the corresponding host error. Use for exhaustive handling or parity checks.
|
|
513
546
|
|
|
514
547
|
### CLI: `clipbus-validate-manifest`
|
package/SPECIFICATION.md
CHANGED
|
@@ -102,6 +102,13 @@ Both methods are required on the type. The **lifecycle in `manifest.json`** deci
|
|
|
102
102
|
|
|
103
103
|
There is no `PluginDraftActionHandler` convenience type — both lifecycles use the same interface.
|
|
104
104
|
|
|
105
|
+
Both Action inputs use `{ sourceItem, content, attachments }`. `sourceItem`
|
|
106
|
+
preserves the original clipboard identity for item mutations; `content` is the
|
|
107
|
+
current cascade value and can change kind between Actions. The Action
|
|
108
|
+
`attachments` field is reserved for wire stability and is currently always `[]`
|
|
109
|
+
in SDK 0.9.0. Draft results are terminal and are never forwarded to another
|
|
110
|
+
Action.
|
|
111
|
+
|
|
105
112
|
### Strongly typed drafts
|
|
106
113
|
|
|
107
114
|
`clipbus.action.draft.current()` returns `Record<string, unknown> | undefined`. Cast at the call site:
|
|
@@ -168,6 +175,9 @@ Capabilities are split by catalog `surface.side`: runtime capabilities are expos
|
|
|
168
175
|
| Replace action button list | `action.setButtons` | — | `clipbus.action.setButtons({buttons})` | Verb; buttons have `isEnabled?: boolean` field |
|
|
169
176
|
| Submit draft result | `action.complete` | — | `clipbus.action.complete({result, userMessage?})` | Verb; draft lifecycle only |
|
|
170
177
|
| Allocate image temp path | `action.allocateImageTempPath` | `ctx.host.action.allocateImageTempPath({formatHint?})` | — | Verb; runtime-only via user RPC bridge; removed from UI in plugin-api-shrink |
|
|
178
|
+
| Materialize current Action image | `action.materializeInputImagePath` | `ctx.host.action.materializeInputImagePath()` | — | Reads current cascade image, not the original item |
|
|
179
|
+
| Allocate Action output file | `action.allocateOutputFilePath` | `ctx.host.action.allocateOutputFilePath({suggestedName?})` | — | Path may only be returned as an `allocated_file` result entry |
|
|
180
|
+
| Current Action input | action input host event | input param | `clipbus.action.input.current()` | Sanitized Topic; path values omit real paths |
|
|
171
181
|
| UI → Runtime RPC | `runtime.invoke` | — (handler registered via `messageHandlers` in `definePlugin`) | `clipbus.runtime.invoke(key, payload, {timeoutMs?})` | Verb; UI side only; routes to plugin's own Node runtime; default timeout 30 s |
|
|
172
182
|
| Host-side action button click | `clipbus-plugin-action-host-invoke` (host event) | — | `clipbus.action.onHostInvoke(fn)` | Stream; receives `{ buttonID }` |
|
|
173
183
|
| Copy text | `clipboard.copyText` | `ctx.host.clipboard.copyText({text})` | `clipbus.clipboard.copyText({text})` | Verb; strict wire shape |
|
|
@@ -209,7 +219,7 @@ Node IPC inbound router rejects any UI-only method names at `PluginRuntimeHostMe
|
|
|
209
219
|
|
|
210
220
|
---
|
|
211
221
|
|
|
212
|
-
## Chapter 2.5: Host Events
|
|
222
|
+
## Chapter 2.5: Host Events
|
|
213
223
|
|
|
214
224
|
Host events declared in the catalog drive every state Topic / Stream the SDK exposes to plugin authors. Each event optionally carries a `windowGlobal` (host injects JSON for synchronous `.current()` read at WebView startup) and a `surface.feed` with `topic` (SDK Topic key) + `shape` (`'topic'` for state, `'stream'` for fire-and-forget events) + `context`.
|
|
215
225
|
|
|
@@ -219,6 +229,7 @@ Host events declared in the catalog drive every state Topic / Stream the SDK exp
|
|
|
219
229
|
| `clipbus-plugin-item` | `clipbus.item` | `__CLIPBUS_PLUGIN_ITEM__` | topic | any | `PluginClipboardItem` |
|
|
220
230
|
| `clipbus-plugin-attachment` | `clipbus.item.attachment` | `__CLIPBUS_PLUGIN_ATTACHMENT__` | topic | attachmentRenderer | `PluginAttachmentPayload` |
|
|
221
231
|
| `clipbus-plugin-draft` | `clipbus.action.draft` | `__CLIPBUS_PLUGIN_DRAFT__` | topic | action | `Record<string, unknown>` |
|
|
232
|
+
| `clipbus-plugin-action-input` | `clipbus.action.input` | `__CLIPBUS_PLUGIN_ACTION_INPUT__` | topic | action | `PluginActionUIInput` |
|
|
222
233
|
| `clipbus-plugin-theme` | `clipbus.theme` | `__CLIPBUS_PLUGIN_THEME__` | topic | any | `PluginThemeTokenSnapshot` |
|
|
223
234
|
| `clipbus-plugin-locale` | `clipbus.locale` | `__CLIPBUS_PLUGIN_LOCALE__` | topic | any | `PluginLocalePayload` |
|
|
224
235
|
| `clipbus-plugin-attachment-host-invoke` | `clipbus.attachmentRenderer.onHostInvoke` | — | stream | attachmentRenderer | `{ buttonID: string }` |
|
|
@@ -68,6 +68,17 @@ export interface PluginAssetPathReferenceImageUrlPayload {
|
|
|
68
68
|
export interface PluginAssetPathReferenceImageUrlResponse {
|
|
69
69
|
url?: string;
|
|
70
70
|
}
|
|
71
|
+
export interface PluginAssetCurrentActionInputImageUrlPayload {
|
|
72
|
+
}
|
|
73
|
+
export interface PluginAssetCurrentActionInputImageUrlResponse {
|
|
74
|
+
url?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface PluginAssetCurrentActionInputPathReferenceImageUrlPayload {
|
|
77
|
+
index: number;
|
|
78
|
+
}
|
|
79
|
+
export interface PluginAssetCurrentActionInputPathReferenceImageUrlResponse {
|
|
80
|
+
url?: string;
|
|
81
|
+
}
|
|
71
82
|
export interface PluginAssetRegisterImagePayload {
|
|
72
83
|
path: string;
|
|
73
84
|
}
|
|
@@ -100,6 +111,17 @@ export interface PluginActionAllocateImageTempPathPayload {
|
|
|
100
111
|
export interface PluginActionAllocateImageTempPathResponse {
|
|
101
112
|
path: string;
|
|
102
113
|
}
|
|
114
|
+
export interface PluginActionMaterializeInputImagePathPayload {
|
|
115
|
+
}
|
|
116
|
+
export interface PluginActionMaterializeInputImagePathResponse {
|
|
117
|
+
path: string;
|
|
118
|
+
}
|
|
119
|
+
export interface PluginActionAllocateOutputFilePathPayload {
|
|
120
|
+
suggestedName?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface PluginActionAllocateOutputFilePathResponse {
|
|
123
|
+
path: string;
|
|
124
|
+
}
|
|
103
125
|
export interface PluginActionSetButtonsPayload {
|
|
104
126
|
buttons: {
|
|
105
127
|
id: string;
|
|
@@ -172,7 +194,7 @@ export interface PluginLocaleGetPayload {
|
|
|
172
194
|
export interface PluginLocaleGetResponse {
|
|
173
195
|
locale: string;
|
|
174
196
|
}
|
|
175
|
-
export declare const CAPABILITY_METHOD_NAMES: readonly ["runtime.invoke", "item.setTags", "item.addTags", "item.removeTags", "item.setPinned", "item.setAttachments", "item.setSearchExtension", "item.materializeImagePath", "item.readAttachment", "asset.currentItemImageUrl", "asset.pathReferenceImageUrl", "asset.registerImage", "clipboard.copyText", "navigation.openUrl", "navigation.revealInFinder", "navigation.openFilePath", "action.allocateImageTempPath", "action.setButtons", "action.complete", "attachmentRenderer.setButtons", "window.setHeight", "window.autoFit", "infoPanel.open", "infoPanel.close", "settings.get", "settings.getAll", "console.log", "textInput.stateChanged", "locale.get"];
|
|
197
|
+
export declare const CAPABILITY_METHOD_NAMES: readonly ["runtime.invoke", "item.setTags", "item.addTags", "item.removeTags", "item.setPinned", "item.setAttachments", "item.setSearchExtension", "item.materializeImagePath", "item.readAttachment", "asset.currentItemImageUrl", "asset.pathReferenceImageUrl", "asset.currentActionInputImageUrl", "asset.currentActionInputPathReferenceImageUrl", "asset.registerImage", "clipboard.copyText", "navigation.openUrl", "navigation.revealInFinder", "navigation.openFilePath", "action.allocateImageTempPath", "action.materializeInputImagePath", "action.allocateOutputFilePath", "action.setButtons", "action.complete", "attachmentRenderer.setButtons", "window.setHeight", "window.autoFit", "infoPanel.open", "infoPanel.close", "settings.get", "settings.getAll", "console.log", "textInput.stateChanged", "locale.get"];
|
|
176
198
|
export type CapabilityMethodName = (typeof CAPABILITY_METHOD_NAMES)[number];
|
|
177
199
|
export declare const callRuntimeInvoke: (payload: PluginRuntimeInvokePayload) => Promise<PluginRuntimeInvokeResponse>;
|
|
178
200
|
export declare const callItemSetTags: (payload: PluginItemSetTagsPayload) => Promise<PluginItemSetTagsResponse>;
|
|
@@ -185,12 +207,16 @@ export declare const callItemMaterializeImagePath: () => Promise<PluginItemMater
|
|
|
185
207
|
export declare const callItemReadAttachment: (payload: PluginItemReadAttachmentPayload) => Promise<PluginItemReadAttachmentResponse>;
|
|
186
208
|
export declare const callAssetCurrentItemImageUrl: () => Promise<PluginAssetCurrentItemImageUrlResponse>;
|
|
187
209
|
export declare const callAssetPathReferenceImageUrl: (payload: PluginAssetPathReferenceImageUrlPayload) => Promise<PluginAssetPathReferenceImageUrlResponse>;
|
|
210
|
+
export declare const callAssetCurrentActionInputImageUrl: () => Promise<PluginAssetCurrentActionInputImageUrlResponse>;
|
|
211
|
+
export declare const callAssetCurrentActionInputPathReferenceImageUrl: (payload: PluginAssetCurrentActionInputPathReferenceImageUrlPayload) => Promise<PluginAssetCurrentActionInputPathReferenceImageUrlResponse>;
|
|
188
212
|
export declare const callAssetRegisterImage: (payload: PluginAssetRegisterImagePayload) => Promise<PluginAssetRegisterImageResponse>;
|
|
189
213
|
export declare const callClipboardCopyText: (payload: PluginClipboardCopyTextPayload) => Promise<PluginClipboardCopyTextResponse>;
|
|
190
214
|
export declare const callNavigationOpenUrl: (payload: PluginNavigationOpenUrlPayload) => Promise<PluginNavigationOpenUrlResponse>;
|
|
191
215
|
export declare const callNavigationRevealInFinder: (payload: PluginNavigationRevealInFinderPayload) => Promise<PluginNavigationRevealInFinderResponse>;
|
|
192
216
|
export declare const callNavigationOpenFilePath: (payload: PluginNavigationOpenFilePathPayload) => Promise<PluginNavigationOpenFilePathResponse>;
|
|
193
217
|
export declare const callActionAllocateImageTempPath: (payload: PluginActionAllocateImageTempPathPayload) => Promise<PluginActionAllocateImageTempPathResponse>;
|
|
218
|
+
export declare const callActionMaterializeInputImagePath: () => Promise<PluginActionMaterializeInputImagePathResponse>;
|
|
219
|
+
export declare const callActionAllocateOutputFilePath: (payload: PluginActionAllocateOutputFilePathPayload) => Promise<PluginActionAllocateOutputFilePathResponse>;
|
|
194
220
|
export declare const callActionSetButtons: (payload: PluginActionSetButtonsPayload) => Promise<PluginActionSetButtonsResponse>;
|
|
195
221
|
export declare const callActionComplete: (payload: PluginActionCompletePayload) => Promise<PluginActionCompleteResponse>;
|
|
196
222
|
export declare const callAttachmentRendererSetButtons: (payload: PluginAttachmentRendererSetButtonsPayload) => Promise<PluginAttachmentRendererSetButtonsResponse>;
|
|
@@ -11,6 +11,16 @@ export interface PluginSearchExtensionEntry {
|
|
|
11
11
|
label?: string;
|
|
12
12
|
updatedAtMs?: number;
|
|
13
13
|
}
|
|
14
|
+
export interface PluginActionPathResultEntryInput {
|
|
15
|
+
source: 'input';
|
|
16
|
+
inputIndex: number;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginActionPathResultEntryAllocated_file {
|
|
19
|
+
source: 'allocated_file';
|
|
20
|
+
path: string;
|
|
21
|
+
displayName: string;
|
|
22
|
+
}
|
|
23
|
+
export type PluginActionPathResultEntry = PluginActionPathResultEntryInput | PluginActionPathResultEntryAllocated_file;
|
|
14
24
|
export interface PluginActionResultText {
|
|
15
25
|
resultKind: 'text';
|
|
16
26
|
text: string;
|
|
@@ -20,10 +30,14 @@ export interface PluginActionResultImage {
|
|
|
20
30
|
imageTempPath: string;
|
|
21
31
|
imageFormatHint?: string;
|
|
22
32
|
}
|
|
33
|
+
export interface PluginActionResultPath_reference {
|
|
34
|
+
resultKind: 'path_reference';
|
|
35
|
+
entries: PluginActionPathResultEntry[];
|
|
36
|
+
}
|
|
23
37
|
export interface PluginActionResultNone {
|
|
24
38
|
resultKind: 'none';
|
|
25
39
|
}
|
|
26
|
-
export type PluginActionResult = PluginActionResultText | PluginActionResultImage | PluginActionResultNone;
|
|
40
|
+
export type PluginActionResult = PluginActionResultText | PluginActionResultImage | PluginActionResultPath_reference | PluginActionResultNone;
|
|
27
41
|
export type PluginInfoPanelTextStyle = 'body' | 'mono' | 'muted';
|
|
28
42
|
export type PluginInfoPanelCodeLanguage = 'plain' | 'json';
|
|
29
43
|
export interface PluginInfoPanelField {
|
|
@@ -92,6 +106,26 @@ export interface PluginAttachmentPayload {
|
|
|
92
106
|
item: PluginClipboardItem;
|
|
93
107
|
attachment: PluginAttachmentEntry;
|
|
94
108
|
}
|
|
109
|
+
export interface PluginActionUIPathEntry {
|
|
110
|
+
kind: 'file' | 'folder';
|
|
111
|
+
displayName: string;
|
|
112
|
+
}
|
|
113
|
+
export interface PluginActionUIInputText {
|
|
114
|
+
kind: 'text';
|
|
115
|
+
text: string;
|
|
116
|
+
}
|
|
117
|
+
export interface PluginActionUIInputImage {
|
|
118
|
+
kind: 'image';
|
|
119
|
+
width: number;
|
|
120
|
+
height: number;
|
|
121
|
+
format: string;
|
|
122
|
+
bytes: number;
|
|
123
|
+
}
|
|
124
|
+
export interface PluginActionUIInputPath_reference {
|
|
125
|
+
kind: 'path_reference';
|
|
126
|
+
entries: PluginActionUIPathEntry[];
|
|
127
|
+
}
|
|
128
|
+
export type PluginActionUIInput = PluginActionUIInputText | PluginActionUIInputImage | PluginActionUIInputPath_reference;
|
|
95
129
|
export interface PluginThemeTokens {
|
|
96
130
|
surface: string;
|
|
97
131
|
surfaceElevated: string;
|
|
@@ -172,7 +206,7 @@ export interface PluginDetectorArtifact {
|
|
|
172
206
|
updatedAtMs?: number;
|
|
173
207
|
}
|
|
174
208
|
export interface PluginResolveActionSessionInput {
|
|
175
|
-
|
|
209
|
+
sourceItem: PluginClipboardItem;
|
|
176
210
|
content: PluginContentEnvelope;
|
|
177
211
|
attachments: PluginAttachmentRef[];
|
|
178
212
|
}
|
|
@@ -183,7 +217,7 @@ export interface PluginActionResolveResult {
|
|
|
183
217
|
initialDraft: Record<string, unknown>;
|
|
184
218
|
}
|
|
185
219
|
export interface PluginAutoRunActionInput {
|
|
186
|
-
|
|
220
|
+
sourceItem: PluginClipboardItem;
|
|
187
221
|
content: PluginContentEnvelope;
|
|
188
222
|
attachments: PluginAttachmentRef[];
|
|
189
223
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginAttachmentPayload, PluginClipboardItem, PluginThemeTokenSnapshot } from './data.generated.js';
|
|
1
|
+
import type { PluginActionUIInput, PluginAttachmentPayload, PluginClipboardItem, PluginThemeTokenSnapshot } from './data.generated.js';
|
|
2
2
|
export interface PluginContextPayload {
|
|
3
3
|
mode: 'attachmentRenderer' | 'action';
|
|
4
4
|
pluginID: string;
|
|
@@ -17,6 +17,7 @@ export declare function emitActionBootstrap(p: {
|
|
|
17
17
|
context?: PluginContextPayload;
|
|
18
18
|
item?: PluginClipboardItem;
|
|
19
19
|
draft?: Record<string, unknown>;
|
|
20
|
+
actionInput?: PluginActionUIInput;
|
|
20
21
|
theme?: PluginThemeTokenSnapshot;
|
|
21
22
|
locale?: PluginLocalePayload;
|
|
22
23
|
}): void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { PluginActionAllocateImageTempPathPayload, PluginActionAllocateImageTempPathResponse, PluginAssetRegisterImagePayload, PluginAssetRegisterImageResponse, PluginClipboardCopyTextPayload, PluginClipboardCopyTextResponse, PluginConsoleLogPayload, PluginConsoleLogResponse, PluginItemAddTagsPayload, PluginItemAddTagsResponse, PluginItemMaterializeImagePathResponse, PluginItemReadAttachmentPayload, PluginItemReadAttachmentResponse, PluginItemRemoveTagsPayload, PluginItemRemoveTagsResponse, PluginItemSetAttachmentsPayload, PluginItemSetAttachmentsResponse, PluginItemSetPinnedPayload, PluginItemSetPinnedResponse, PluginItemSetSearchExtensionPayload, PluginItemSetSearchExtensionResponse, PluginItemSetTagsPayload, PluginItemSetTagsResponse, PluginLocaleGetResponse, PluginNavigationOpenFilePathPayload, PluginNavigationOpenFilePathResponse, PluginNavigationOpenUrlPayload, PluginNavigationOpenUrlResponse, PluginNavigationRevealInFinderPayload, PluginNavigationRevealInFinderResponse, PluginSettingsGetAllResponse, PluginSettingsGetPayload, PluginSettingsGetResponse } from './capabilityClients.generated.js';
|
|
1
|
+
import type { PluginActionAllocateImageTempPathPayload, PluginActionAllocateImageTempPathResponse, PluginActionAllocateOutputFilePathPayload, PluginActionAllocateOutputFilePathResponse, PluginActionMaterializeInputImagePathResponse, PluginAssetRegisterImagePayload, PluginAssetRegisterImageResponse, PluginClipboardCopyTextPayload, PluginClipboardCopyTextResponse, PluginConsoleLogPayload, PluginConsoleLogResponse, PluginItemAddTagsPayload, PluginItemAddTagsResponse, PluginItemMaterializeImagePathResponse, PluginItemReadAttachmentPayload, PluginItemReadAttachmentResponse, PluginItemRemoveTagsPayload, PluginItemRemoveTagsResponse, PluginItemSetAttachmentsPayload, PluginItemSetAttachmentsResponse, PluginItemSetPinnedPayload, PluginItemSetPinnedResponse, PluginItemSetSearchExtensionPayload, PluginItemSetSearchExtensionResponse, PluginItemSetTagsPayload, PluginItemSetTagsResponse, PluginLocaleGetResponse, PluginNavigationOpenFilePathPayload, PluginNavigationOpenFilePathResponse, PluginNavigationOpenUrlPayload, PluginNavigationOpenUrlResponse, PluginNavigationRevealInFinderPayload, PluginNavigationRevealInFinderResponse, PluginSettingsGetAllResponse, PluginSettingsGetPayload, PluginSettingsGetResponse } from './capabilityClients.generated.js';
|
|
2
2
|
export interface IPCBus {
|
|
3
3
|
request<Req, Resp>(method: string, payload: Req): Promise<Resp>;
|
|
4
4
|
}
|
|
5
5
|
export interface HostClient {
|
|
6
6
|
action: {
|
|
7
7
|
allocateImageTempPath(payload: PluginActionAllocateImageTempPathPayload): Promise<PluginActionAllocateImageTempPathResponse>;
|
|
8
|
+
materializeInputImagePath(): Promise<PluginActionMaterializeInputImagePathResponse>;
|
|
9
|
+
allocateOutputFilePath(payload: PluginActionAllocateOutputFilePathPayload): Promise<PluginActionAllocateOutputFilePathResponse>;
|
|
8
10
|
};
|
|
9
11
|
asset: {
|
|
10
12
|
registerImage(payload: PluginAssetRegisterImagePayload): Promise<PluginAssetRegisterImageResponse>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginActionPathResultEntry } from './data.generated.js';
|
|
1
2
|
export interface ActionResultOptions {
|
|
2
3
|
userMessage?: string;
|
|
3
4
|
}
|
|
@@ -19,6 +20,13 @@ export declare const actionResult: {
|
|
|
19
20
|
};
|
|
20
21
|
userMessage: string | undefined;
|
|
21
22
|
};
|
|
23
|
+
path_reference: (entries: PluginActionPathResultEntry[], options?: ActionResultOptions) => {
|
|
24
|
+
result: {
|
|
25
|
+
resultKind: "path_reference";
|
|
26
|
+
entries: PluginActionPathResultEntry[];
|
|
27
|
+
};
|
|
28
|
+
userMessage: string | undefined;
|
|
29
|
+
};
|
|
22
30
|
none: (options?: ActionResultOptions) => {
|
|
23
31
|
result: {
|
|
24
32
|
resultKind: "none";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginActionAllocateImageTempPathPayload, PluginActionAllocateImageTempPathResponse, PluginAssetRegisterImagePayload, PluginAssetRegisterImageResponse, PluginClipboardCopyTextPayload, PluginClipboardCopyTextResponse, PluginConsoleLogPayload, PluginConsoleLogResponse, PluginItemAddTagsPayload, PluginItemAddTagsResponse, PluginItemMaterializeImagePathResponse, PluginItemReadAttachmentPayload, PluginItemReadAttachmentResponse, PluginItemRemoveTagsPayload, PluginItemRemoveTagsResponse, PluginItemSetAttachmentsPayload, PluginItemSetAttachmentsResponse, PluginItemSetPinnedPayload, PluginItemSetPinnedResponse, PluginItemSetSearchExtensionPayload, PluginItemSetSearchExtensionResponse, PluginItemSetTagsPayload, PluginItemSetTagsResponse, PluginLocaleGetResponse, PluginNavigationOpenFilePathPayload, PluginNavigationOpenFilePathResponse, PluginNavigationOpenUrlPayload, PluginNavigationOpenUrlResponse, PluginNavigationRevealInFinderPayload, PluginNavigationRevealInFinderResponse, PluginSettingsGetAllResponse, PluginSettingsGetPayload, PluginSettingsGetResponse } from './capabilityClients.generated.js';
|
|
1
|
+
import type { PluginActionAllocateImageTempPathPayload, PluginActionAllocateImageTempPathResponse, PluginActionAllocateOutputFilePathPayload, PluginActionAllocateOutputFilePathResponse, PluginActionMaterializeInputImagePathResponse, PluginAssetRegisterImagePayload, PluginAssetRegisterImageResponse, PluginClipboardCopyTextPayload, PluginClipboardCopyTextResponse, PluginConsoleLogPayload, PluginConsoleLogResponse, PluginItemAddTagsPayload, PluginItemAddTagsResponse, PluginItemMaterializeImagePathResponse, PluginItemReadAttachmentPayload, PluginItemReadAttachmentResponse, PluginItemRemoveTagsPayload, PluginItemRemoveTagsResponse, PluginItemSetAttachmentsPayload, PluginItemSetAttachmentsResponse, PluginItemSetPinnedPayload, PluginItemSetPinnedResponse, PluginItemSetSearchExtensionPayload, PluginItemSetSearchExtensionResponse, PluginItemSetTagsPayload, PluginItemSetTagsResponse, PluginLocaleGetResponse, PluginNavigationOpenFilePathPayload, PluginNavigationOpenFilePathResponse, PluginNavigationOpenUrlPayload, PluginNavigationOpenUrlResponse, PluginNavigationRevealInFinderPayload, PluginNavigationRevealInFinderResponse, PluginSettingsGetAllResponse, PluginSettingsGetPayload, PluginSettingsGetResponse } from './capabilityClients.generated.js';
|
|
2
2
|
export declare const host: {
|
|
3
3
|
item: {
|
|
4
4
|
setTags: (payload: PluginItemSetTagsPayload) => Promise<PluginItemSetTagsResponse>;
|
|
@@ -23,6 +23,8 @@ export declare const host: {
|
|
|
23
23
|
};
|
|
24
24
|
action: {
|
|
25
25
|
allocateImageTempPath: (payload: PluginActionAllocateImageTempPathPayload) => Promise<PluginActionAllocateImageTempPathResponse>;
|
|
26
|
+
materializeInputImagePath: () => Promise<PluginActionMaterializeInputImagePathResponse>;
|
|
27
|
+
allocateOutputFilePath: (payload: PluginActionAllocateOutputFilePathPayload) => Promise<PluginActionAllocateOutputFilePathResponse>;
|
|
26
28
|
};
|
|
27
29
|
settings: {
|
|
28
30
|
get: (payload: PluginSettingsGetPayload) => Promise<PluginSettingsGetResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginAttachmentPayload, PluginClipboardItem, PluginThemeTokenSnapshot } from './data.generated.js';
|
|
1
|
+
import type { PluginActionUIInput, PluginAttachmentPayload, PluginClipboardItem, PluginThemeTokenSnapshot } from './data.generated.js';
|
|
2
2
|
export interface PluginContextPayload {
|
|
3
3
|
mode: 'attachmentRenderer' | 'action';
|
|
4
4
|
pluginID: string;
|
|
@@ -11,6 +11,8 @@ export declare function onAttachment(listener: (payload: PluginAttachmentPayload
|
|
|
11
11
|
export declare function getAttachmentSnapshot(): PluginAttachmentPayload | undefined;
|
|
12
12
|
export declare function onDraft(listener: (payload: Record<string, unknown>) => void): () => void;
|
|
13
13
|
export declare function getDraftSnapshot(): Record<string, unknown> | undefined;
|
|
14
|
+
export declare function onActionInput(listener: (payload: PluginActionUIInput) => void): () => void;
|
|
15
|
+
export declare function getActionInputSnapshot(): PluginActionUIInput | undefined;
|
|
14
16
|
export declare function onTheme(listener: (payload: PluginThemeTokenSnapshot) => void): () => void;
|
|
15
17
|
export declare function getThemeSnapshot(): PluginThemeTokenSnapshot | undefined;
|
|
16
18
|
export interface PluginAttachmentHostInvokePayload {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { PluginAttachmentPayload, PluginClipboardItem, PluginThemeTokenSnapshot } from './data.generated.js';
|
|
1
|
+
import type { PluginActionUIInput, PluginAttachmentPayload, PluginClipboardItem, PluginThemeTokenSnapshot } from './data.generated.js';
|
|
2
2
|
import type { PluginActionHostInvokePayload, PluginAttachmentHostInvokePayload, PluginContextPayload, PluginInfoPanelOnActionPayload, PluginInfoPanelOnClosePayload, PluginLocalePayload } from './topicSubscribers.generated.js';
|
|
3
3
|
export declare const _pluginContextTopic: import("../internal/topic.js").MutableTopic<PluginContextPayload>;
|
|
4
4
|
export declare const _itemTopic: import("../internal/topic.js").MutableTopic<PluginClipboardItem>;
|
|
5
5
|
export declare const _itemAttachmentTopic: import("../internal/topic.js").MutableTopic<PluginAttachmentPayload>;
|
|
6
6
|
export declare const _actionDraftTopic: import("../internal/topic.js").MutableTopic<Record<string, unknown>>;
|
|
7
|
+
export declare const _actionInputTopic: import("../internal/topic.js").MutableTopic<PluginActionUIInput>;
|
|
7
8
|
export declare const _themeTopic: import("../internal/topic.js").MutableTopic<PluginThemeTokenSnapshot>;
|
|
8
9
|
export declare const _attachmentRendererOnHostInvokeStream: import("../internal/topic.js").MutableStream<PluginAttachmentHostInvokePayload>;
|
|
9
10
|
export declare const _actionOnHostInvokeStream: import("../internal/topic.js").MutableStream<PluginActionHostInvokePayload>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginActionCompletePayload, PluginActionCompleteResponse, PluginActionSetButtonsPayload, PluginActionSetButtonsResponse, PluginAssetCurrentItemImageUrlResponse, PluginAssetPathReferenceImageUrlPayload, PluginAssetPathReferenceImageUrlResponse, PluginAttachmentRendererSetButtonsPayload, PluginAttachmentRendererSetButtonsResponse, PluginClipboardCopyTextPayload, PluginClipboardCopyTextResponse, PluginConsoleLogPayload, PluginConsoleLogResponse, PluginInfoPanelClosePayload, PluginInfoPanelCloseResponse, PluginInfoPanelOpenPayload, PluginInfoPanelOpenResponse, PluginItemReadAttachmentPayload, PluginItemReadAttachmentResponse, PluginNavigationOpenFilePathPayload, PluginNavigationOpenFilePathResponse, PluginNavigationOpenUrlPayload, PluginNavigationOpenUrlResponse, PluginNavigationRevealInFinderPayload, PluginNavigationRevealInFinderResponse, PluginRuntimeInvokePayload, PluginSettingsGetAllResponse, PluginSettingsGetPayload, PluginSettingsGetResponse, PluginTextInputStateChangedPayload, PluginTextInputStateChangedResponse, PluginWindowAutoFitResponse, PluginWindowSetHeightPayload, PluginWindowSetHeightResponse } from './capabilityClients.generated.js';
|
|
2
|
-
import type { PluginAttachmentPayload, PluginClipboardItem, PluginThemeTokenSnapshot } from './data.generated.js';
|
|
1
|
+
import type { PluginActionCompletePayload, PluginActionCompleteResponse, PluginActionSetButtonsPayload, PluginActionSetButtonsResponse, PluginAssetCurrentActionInputImageUrlResponse, PluginAssetCurrentActionInputPathReferenceImageUrlPayload, PluginAssetCurrentActionInputPathReferenceImageUrlResponse, PluginAssetCurrentItemImageUrlResponse, PluginAssetPathReferenceImageUrlPayload, PluginAssetPathReferenceImageUrlResponse, PluginAttachmentRendererSetButtonsPayload, PluginAttachmentRendererSetButtonsResponse, PluginClipboardCopyTextPayload, PluginClipboardCopyTextResponse, PluginConsoleLogPayload, PluginConsoleLogResponse, PluginInfoPanelClosePayload, PluginInfoPanelCloseResponse, PluginInfoPanelOpenPayload, PluginInfoPanelOpenResponse, PluginItemReadAttachmentPayload, PluginItemReadAttachmentResponse, PluginNavigationOpenFilePathPayload, PluginNavigationOpenFilePathResponse, PluginNavigationOpenUrlPayload, PluginNavigationOpenUrlResponse, PluginNavigationRevealInFinderPayload, PluginNavigationRevealInFinderResponse, PluginRuntimeInvokePayload, PluginSettingsGetAllResponse, PluginSettingsGetPayload, PluginSettingsGetResponse, PluginTextInputStateChangedPayload, PluginTextInputStateChangedResponse, PluginWindowAutoFitResponse, PluginWindowSetHeightPayload, PluginWindowSetHeightResponse } from './capabilityClients.generated.js';
|
|
2
|
+
import type { PluginActionUIInput, PluginAttachmentPayload, PluginClipboardItem, PluginThemeTokenSnapshot } from './data.generated.js';
|
|
3
3
|
import type { PluginActionHostInvokePayload, PluginAttachmentHostInvokePayload, PluginContextPayload, PluginInfoPanelOnActionPayload, PluginInfoPanelOnClosePayload, PluginLocalePayload } from './topicSubscribers.generated.js';
|
|
4
4
|
export declare const clipbus: {
|
|
5
5
|
capabilities: import("../internal/capabilities.js").CapabilitiesApi;
|
|
@@ -18,6 +18,8 @@ export declare const clipbus: {
|
|
|
18
18
|
asset: {
|
|
19
19
|
currentItemImageUrl: () => Promise<PluginAssetCurrentItemImageUrlResponse>;
|
|
20
20
|
pathReferenceImageUrl: (payload: PluginAssetPathReferenceImageUrlPayload) => Promise<PluginAssetPathReferenceImageUrlResponse>;
|
|
21
|
+
currentActionInputImageUrl: () => Promise<PluginAssetCurrentActionInputImageUrlResponse>;
|
|
22
|
+
currentActionInputPathReferenceImageUrl: (payload: PluginAssetCurrentActionInputPathReferenceImageUrlPayload) => Promise<PluginAssetCurrentActionInputPathReferenceImageUrlResponse>;
|
|
21
23
|
};
|
|
22
24
|
clipboard: {
|
|
23
25
|
copyText: (payload: PluginClipboardCopyTextPayload) => Promise<PluginClipboardCopyTextResponse>;
|
|
@@ -34,6 +36,10 @@ export declare const clipbus: {
|
|
|
34
36
|
current: () => Record<string, unknown> | undefined;
|
|
35
37
|
on: (fn: (payload: Record<string, unknown>) => void) => import("../internal/topic.js").Unsubscribe;
|
|
36
38
|
};
|
|
39
|
+
input: {
|
|
40
|
+
current: () => PluginActionUIInput | undefined;
|
|
41
|
+
on: (fn: (payload: PluginActionUIInput) => void) => import("../internal/topic.js").Unsubscribe;
|
|
42
|
+
};
|
|
37
43
|
onHostInvoke: {
|
|
38
44
|
on: (fn: (payload: PluginActionHostInvokePayload) => void) => import("../internal/topic.js").Unsubscribe;
|
|
39
45
|
};
|
package/dist/preview/index.cjs
CHANGED
|
@@ -1373,6 +1373,10 @@ function emitActionBootstrap(p) {
|
|
|
1373
1373
|
globalThis["__CLIPBUS_PLUGIN_DRAFT__"] = p.draft;
|
|
1374
1374
|
globalThis.dispatchEvent(new CustomEvent("clipbus-plugin-draft", { detail: p.draft }));
|
|
1375
1375
|
}
|
|
1376
|
+
if (p.actionInput !== void 0) {
|
|
1377
|
+
globalThis["__CLIPBUS_PLUGIN_ACTION_INPUT__"] = p.actionInput;
|
|
1378
|
+
globalThis.dispatchEvent(new CustomEvent("clipbus-plugin-action-input", { detail: p.actionInput }));
|
|
1379
|
+
}
|
|
1376
1380
|
if (p.theme !== void 0) {
|
|
1377
1381
|
globalThis["__CLIPBUS_PLUGIN_THEME__"] = p.theme;
|
|
1378
1382
|
globalThis.dispatchEvent(new CustomEvent("clipbus-plugin-theme", { detail: p.theme }));
|
|
@@ -1410,6 +1414,7 @@ function computeWirePayloads(scenario, themeKey = DEFAULT_THEME_KEY) {
|
|
|
1410
1414
|
context,
|
|
1411
1415
|
item: scenario.item,
|
|
1412
1416
|
draft: scenario.draft ?? {},
|
|
1417
|
+
actionInput: scenario.actionInput,
|
|
1413
1418
|
theme,
|
|
1414
1419
|
locale
|
|
1415
1420
|
};
|
|
@@ -1428,6 +1433,7 @@ function injectWire(_target, payloads) {
|
|
|
1428
1433
|
context: payloads.context,
|
|
1429
1434
|
item: payloads.item,
|
|
1430
1435
|
draft: payloads.draft,
|
|
1436
|
+
actionInput: payloads.actionInput,
|
|
1431
1437
|
theme: payloads.theme,
|
|
1432
1438
|
locale: payloads.locale
|
|
1433
1439
|
});
|
|
@@ -1484,6 +1490,12 @@ function classifyWireSections(payloads) {
|
|
|
1484
1490
|
defaultOpen: true,
|
|
1485
1491
|
value: payloads.draft
|
|
1486
1492
|
});
|
|
1493
|
+
sections.push({
|
|
1494
|
+
key: "actionInput",
|
|
1495
|
+
kind: "content",
|
|
1496
|
+
defaultOpen: true,
|
|
1497
|
+
value: payloads.actionInput
|
|
1498
|
+
});
|
|
1487
1499
|
}
|
|
1488
1500
|
sections.push({
|
|
1489
1501
|
key: "theme",
|