@markupai/sidebar-adapter 2.1.0 → 2.3.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 +45 -3
- package/asyncapi.json +121 -4
- package/dist/adapters/pluginAdapter.d.ts +9 -0
- package/dist/adapters/pluginAdapter.d.ts.map +1 -1
- package/dist/errors.d.ts +38 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/ipc/call-signatures.d.ts +4 -2
- package/dist/ipc/call-signatures.d.ts.map +1 -1
- package/dist/ipc/ipc-core.d.ts.map +1 -1
- package/dist/ipc/plugin-ipc-adapter.d.ts +8 -0
- package/dist/ipc/plugin-ipc-adapter.d.ts.map +1 -1
- package/dist/ipc/sidebar-build-info.d.ts +10 -0
- package/dist/ipc/sidebar-build-info.d.ts.map +1 -1
- package/dist/ipc/sidebar-ipc-adapter.d.ts.map +1 -1
- package/dist/main.js +298 -242
- package/dist/main.umd.cjs +6 -6
- package/dist/types/common.d.ts +16 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/errors.d.ts +47 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/pluginInterface.d.ts +3 -0
- package/dist/types/pluginInterface.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ You do **not** need prior knowledge of how the sidebar is built internally. As a
|
|
|
29
29
|
- **createSidebarHost** — Optional one-shot setup: create/mount iframe, optional load-failed overlay, and `SidebarAdapter` (or iframe-only when your UI and document logic run in separate contexts)
|
|
30
30
|
- **Host shell helpers** — `ensureSidebarHostShell` / `buildSidebarHostHtmlDocument` so you don’t duplicate container markup and layout CSS
|
|
31
31
|
- **MIME helpers** — `MimeType` enum plus arbitrary MIME strings for `ContentInfo`
|
|
32
|
-
- **Errors** — `TextLookupError` and guards for editor lookup failures
|
|
32
|
+
- **Errors** — `TextLookupError` / `ReplaceBatchError` and guards for editor lookup failures
|
|
33
33
|
- **Auth** — `SidebarConfig.auth` for declaring the Auth0 login strategy (`"mediation" | "popup"`) and optional `PluginInterface.openAuthUrl` for routing the authorize URL through a host-owned external-browser primitive (see [Authentication](#authentication-optional))
|
|
34
34
|
- **Cleanup** — `destroy()` / teardown functions on adapters and hosts
|
|
35
35
|
|
|
@@ -487,7 +487,7 @@ For agentic streaming callbacks, issue objects match the exported **`AgenticIssu
|
|
|
487
487
|
|
|
488
488
|
Implement these **on the host** as async functions. The sidebar calls them over IPC and waits on the returned promises (pull style):
|
|
489
489
|
|
|
490
|
-
- `getInitConfig(sidebarBuildInfo?: SidebarBuildInfo): Promise<SidebarConfig>` — Integration display name (`integrationName`), stable machine id (`integrationId`), version, feature flags, etc. See the `integrationName` vs `integrationId` note above. Called once per sidebar load; `sidebarBuildInfo` is the sidebar build that is executing (see [Sidebar build reporting](#sidebar-build-reporting)) — declaring the parameter is optional.
|
|
490
|
+
- `getInitConfig(sidebarBuildInfo?: SidebarBuildInfo): Promise<SidebarConfig>` — Integration display name (`integrationName`), stable machine id (`integrationId`), version, feature flags, etc. See the `integrationName` vs `integrationId` note above. Called once per sidebar load; `sidebarBuildInfo` is the sidebar build that is executing (see [Sidebar build reporting](#sidebar-build-reporting)) — declaring the parameter is optional. On the wire the reply is an `InitConfigResponse` (your `SidebarConfig` plus a `hostAdapterVersion` the adapter stamps itself, see [Host adapter version, sidebar side](#host-adapter-version-sidebar-side)).
|
|
491
491
|
- `getContent(): Promise<ContentInfo>` — Full document (or main buffer) text; must include `documentReference`; `mimeType` optional
|
|
492
492
|
- `getSelectedContent(): Promise<ContentInfo>` — Current selection; same `ContentInfo` rules as `getContent`
|
|
493
493
|
- `selectContent(range: ContentRange, documentReference?: string | null): Promise<void>` — Focus/highlight the document span `[range.start, range.end)`. `documentReference` names the target document for multi-document hosts; omitted/`null` means "whichever document is currently active" (the single-document default — see [Multi-document hosts](#multi-document-hosts))
|
|
@@ -539,7 +539,29 @@ try {
|
|
|
539
539
|
}
|
|
540
540
|
```
|
|
541
541
|
|
|
542
|
-
|
|
542
|
+
For `replaceMultipleContents`, throw `ReplaceBatchError` when the batch could not be applied in full and you know which ranges landed. It extends `TextLookupError` and carries `applied` (`ContentRange[]`) and `failed` (`ReplaceBatchFailedRange[]`), the ranges as they were sent; a range in neither list was left untouched. The sidebar resolves the applied occurrences, invalidates the failed ones, and leaves the rest active. The error's `message` describes the batch, so it is shown only on the card the user applied from. Give a failed range its own `message` to explain that one occurrence on its card; without one, the sidebar shows its own "text could not be found" message. A host that verifies every range before editing throws it with an empty `applied`; a plain `TextLookupError` is still accepted and treated as a failure of the whole batch.
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
import { ReplaceBatchError } from "@markupai/sidebar-adapter";
|
|
546
|
+
|
|
547
|
+
// In replaceMultipleContents, after verifying every range against the document:
|
|
548
|
+
if (unverifiable.length > 0) {
|
|
549
|
+
throw new ReplaceBatchError(
|
|
550
|
+
`None of the ${replacements.length} occurrences were replaced because one of them could not be verified in the document.`,
|
|
551
|
+
{
|
|
552
|
+
applied: [],
|
|
553
|
+
failed: unverifiable.map((r) => ({
|
|
554
|
+
...r.range,
|
|
555
|
+
message: "This text was edited since the last check.",
|
|
556
|
+
})),
|
|
557
|
+
},
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
Non-JS ports serialize it as `{ name: "ReplaceBatchError", message, applied, failed }` — see `ReplaceBatchErrorPayload` in `asyncapi.json`.
|
|
563
|
+
|
|
564
|
+
Note: We document thrown errors via JSDoc `@throws` on the plugin interface and export union types `SelectContentError`, `ReplaceContentError` and `ReplaceMultipleContentsError` for control-flow typing when catching.
|
|
543
565
|
|
|
544
566
|
### Message Format
|
|
545
567
|
|
|
@@ -945,6 +967,26 @@ const build = sidebarAdapter.getSidebarBuildInfo(); // SidebarBuildInfo | null
|
|
|
945
967
|
- `swControlled: true` alone does not mean "stale" — compare `version`/`commitHash` with the server's `/sidebar-info.json` if you need that verdict.
|
|
946
968
|
- Fully backward compatible: handlers declared without the parameter keep compiling, older adapters ignore the argument, and older sidebars simply don't send it.
|
|
947
969
|
|
|
970
|
+
### Host adapter version, sidebar side
|
|
971
|
+
|
|
972
|
+
The report also flows the other way. The host-side adapter stamps its own compiled version onto every `getInitConfig` reply, so the sidebar can tell which `@markupai/sidebar-adapter` your integration bundles and attribute analytics (adapter adoption, sidebar-vs-host version skew) to it. **You do nothing**: your `getInitConfig` handler keeps returning a plain `SidebarConfig`, and the adapter adds the stamp on the wire — always with its own version, overwriting any `hostAdapterVersion` an integration might return.
|
|
973
|
+
|
|
974
|
+
```ts
|
|
975
|
+
// Wire shape of the reply (you never construct this yourself)
|
|
976
|
+
interface InitConfigResponse extends SidebarConfig {
|
|
977
|
+
hostAdapterVersion?: string; // @markupai/sidebar-adapter version inside the host, e.g. "2.2.0"
|
|
978
|
+
}
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
On the sidebar side, `PluginAdapter` sanitizes the stamp (non-empty string, capped at 64 characters), strips it from the config it resolves, and exposes it separately:
|
|
982
|
+
|
|
983
|
+
```ts
|
|
984
|
+
const config = await pluginAdapter.getInitConfig(buildInfo); // plain SidebarConfig
|
|
985
|
+
const hostAdapter = pluginAdapter.getHostAdapterVersion(); // string | null
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
`null` means no valid stamp arrived — the host adapter predates 2.2.0. Non-JS host ports set `hostAdapterVersion` on their own reply; the field is described in `asyncapi.json` as the `getInitConfig` response payload.
|
|
989
|
+
|
|
948
990
|
## Development
|
|
949
991
|
|
|
950
992
|
The commands below are for **contributors** working on this npm package’s source. If you only consume **`@markupai/sidebar-adapter`** from your app, you do not need to run them.
|
package/asyncapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"asyncapi": "3.0.0",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Markup AI Sidebar IPC contract",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.3.0",
|
|
6
6
|
"description": "Bidirectional RPC-over-postMessage contract between the Markup AI sidebar and its host. Generated from the @markupai/sidebar-adapter TypeScript types — do not hand-edit."
|
|
7
7
|
},
|
|
8
8
|
"channels": {
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
"action": "send",
|
|
198
198
|
"channel": { "$ref": "#/channels/sidebarToPlugin" },
|
|
199
199
|
"title": "getInitConfig",
|
|
200
|
-
"description": "Get initialization configuration from the editor. sidebarBuildInfo reports the sidebar build that is executing (absent from sidebars that predate build reporting).",
|
|
200
|
+
"description": "Get initialization configuration from the editor. sidebarBuildInfo reports the sidebar build that is executing (absent from sidebars that predate build reporting). The reply is the integration's SidebarConfig plus hostAdapterVersion, stamped by the host adapter itself (absent from host adapters that predate version stamping).",
|
|
201
201
|
"x-optional": false,
|
|
202
202
|
"messages": [{ "$ref": "#/channels/sidebarToPlugin/messages/getInitConfig_call" }],
|
|
203
203
|
"reply": {
|
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
"name": { "type": "string" },
|
|
455
455
|
"errorJSON": {
|
|
456
456
|
"type": "string",
|
|
457
|
-
"description": "JSON-stringified error: {message, name
|
|
457
|
+
"description": "JSON-stringified error: {message, name?, ...own properties}. The receiver rebuilds a typed error from `name`; the payloads it recognises are TextLookupErrorPayload and ReplaceBatchErrorPayload (see components/schemas). Any other name arrives as a plain Error."
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
}
|
|
@@ -692,7 +692,7 @@
|
|
|
692
692
|
"type": { "const": "response" },
|
|
693
693
|
"id": { "type": "integer" },
|
|
694
694
|
"name": { "const": "getInitConfig" },
|
|
695
|
-
"data": { "$ref": "#/components/schemas/
|
|
695
|
+
"data": { "$ref": "#/components/schemas/InitConfigResponse" }
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
},
|
|
@@ -1516,6 +1516,67 @@
|
|
|
1516
1516
|
"description": "A single option in an {@link IntegrationSettingEnumField } dropdown. `value` is the stable persisted key; `label` is the user-visible display text.",
|
|
1517
1517
|
"title": "IntegrationSettingEnumOption"
|
|
1518
1518
|
},
|
|
1519
|
+
"InitConfigResponse": {
|
|
1520
|
+
"type": "object",
|
|
1521
|
+
"properties": {
|
|
1522
|
+
"integrationName": {
|
|
1523
|
+
"type": "string",
|
|
1524
|
+
"description": "Human-readable name of the underlying integration. **Display only** — shown verbatim to the user (e.g. on the sidebar's About page). Never derive a machine identifier from this string; use {@link SidebarConfig.integrationId } for that. Example: `\"Madcap Flare Desktop\"`."
|
|
1525
|
+
},
|
|
1526
|
+
"integrationVersion": {
|
|
1527
|
+
"type": "string",
|
|
1528
|
+
"description": "Version string of the host integration (the plugin/add-in build, not the sidebar or this adapter). Display only — e.g. shown on the sidebar's About page next to {@link SidebarConfig.integrationName } . Free-form; hosts typically pass their own package/build version such as `\"1.4.2\"`."
|
|
1529
|
+
},
|
|
1530
|
+
"hostAppVersion": {
|
|
1531
|
+
"type": "string",
|
|
1532
|
+
"description": "Version string of the host application/editor itself — the surrounding app the plugin/add-in runs inside (e.g. the Figma desktop app build, or the Madcap Flare version), not the plugin's own version ( {@link SidebarConfig.integrationVersion } ) or the sidebar's/adapter's. Display only — appended to the integration name/version line on the sidebar's About page when present. Omit when the host cannot report its own version; the About page leaves it out rather than showing a placeholder."
|
|
1533
|
+
},
|
|
1534
|
+
"integrationId": {
|
|
1535
|
+
"type": "string",
|
|
1536
|
+
"description": "Stable, machine-readable identifier for the integration. Used for everything non-display: the Auth0 mediation login provider, PostHog analytics keys, the `x-integration-id` API header, and per-integration settings storage. Should be a stable slug (lowercase, hyphenated, no spaces) that does not change between releases. Example: `\"madcap-flare-desktop\"`.\n\nOptional for backward compatibility: when omitted the sidebar falls back to `DEFAULT_SIDEBAR_CONFIG.integrationId` (`\"markupai-sidebar-app\"`). Hosts that use mediation login or want per-integration analytics/storage should set it."
|
|
1537
|
+
},
|
|
1538
|
+
"hideBanner": {
|
|
1539
|
+
"type": "boolean",
|
|
1540
|
+
"description": "Hide the promotional/upsell banner the sidebar shows by default. Set `true` for embedded hosts where the banner is inappropriate (e.g. Figma, Office task pane). Defaults to `false` when omitted."
|
|
1541
|
+
},
|
|
1542
|
+
"pluginOrigin": {
|
|
1543
|
+
"type": "string",
|
|
1544
|
+
"description": "Origin of the plugin/editor window where messages should be sent This is the origin where the plugin is listening for messages from the sidebar"
|
|
1545
|
+
},
|
|
1546
|
+
"supportCheckSelection": {
|
|
1547
|
+
"type": "boolean",
|
|
1548
|
+
"description": "Whether to support selection-based check and rewrite functionality If true or undefined (default), the selection toggle UI will be shown and users can toggle between full content and selection modes If false, the selection toggle UI will be hidden and checkSelectionEnabled will be forced to false"
|
|
1549
|
+
},
|
|
1550
|
+
"multiAgent": {
|
|
1551
|
+
"type": "boolean",
|
|
1552
|
+
"description": "Whether the sidebar may run several agents concurrently in one check.\n\nWhen `false` or omitted (the default), only the Style agent is offered and run, and a check is dispatched as a single-agent run. When `true`, the sidebar offers every agent the organization is entitled to and fans the selected ones out through the parallel executor, streaming results per agent; each agent can then be cancelled independently of the others.\n\nThe host flag and the organization's entitlement **intersect**: enabling this never grants access to an agent the organization does not have, and an entitled agent is never offered while this is `false`."
|
|
1553
|
+
},
|
|
1554
|
+
"multiDocument": {
|
|
1555
|
+
"type": "boolean",
|
|
1556
|
+
"description": "Whether the sidebar retains check results and issue decisions separately per document, for hosts that let a user switch between several open documents (e.g. a tabbed editor).\n\nWhen `false` or omitted (the default), the sidebar holds a single shared check state regardless of any `onActiveDocumentChanged` calls the host makes. When `true`, switching the active document preserves the outgoing document's results and restores the incoming document's previously retained results, if any."
|
|
1557
|
+
},
|
|
1558
|
+
"initialActiveDocumentReference": {
|
|
1559
|
+
"type": ["string", "null"],
|
|
1560
|
+
"description": "The document the host considers active at the moment it responds to `getInitConfig()` — `null` if none is checkable right now, or omitted if the host doesn't know or doesn't support reporting it yet.\n\nThis is a **one-time snapshot resolved at init**, not a live-updating field — `SidebarConfig` is fetched once per session, so later changes to the active document must still go through `notifyActiveDocumentChanged`. Only meaningful when `multiDocument` is `true`; ignored otherwise.\n\nSupplying this lets the sidebar show its \"nothing to check\" state immediately on load instead of only after a subsequent `notifyActiveDocumentChanged` call. Omit it if the host cannot answer the question at init time — the sidebar falls back to waiting for that later call (or its own passive detection from the first `getContent()` response) exactly as it does today."
|
|
1561
|
+
},
|
|
1562
|
+
"auth": {
|
|
1563
|
+
"$ref": "#/components/schemas/AuthConfig",
|
|
1564
|
+
"description": "How the sidebar should run the Auth0 login flow. When omitted, the sidebar falls back to heuristic strategy selection (iframe context, secure origin, etc.) for backwards compatibility. New integrations should set this explicitly; `\"mediation\"` is the correct choice for hosts that embed the sidebar in an iframe (Figma, Office task pane).\n\nIn dev builds, the sidebar also honors a `localStorage` override at the key exported as `AUTH_CONFIG_OVERRIDE_STORAGE_KEY` — see `getAuthConfigWithOverride` in `sidebar-host`."
|
|
1565
|
+
},
|
|
1566
|
+
"integrationSettings": {
|
|
1567
|
+
"$ref": "#/components/schemas/IntegrationSettingsSchema",
|
|
1568
|
+
"description": "Optional declarative schema of host-supplied settings rendered in the sidebar's Settings surface. When omitted, no integration-settings section is rendered and no related IPC traffic is emitted.\n\nSee `@markupai/sidebar-adapter` README → \"Integration settings\" for the shape and lifecycle."
|
|
1569
|
+
},
|
|
1570
|
+
"hostAdapterVersion": {
|
|
1571
|
+
"type": "string",
|
|
1572
|
+
"description": "Version of `@markupai/sidebar-adapter` compiled into the host, e.g. `\"2.2.0\"`."
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
"additionalProperties": false,
|
|
1576
|
+
"required": ["integrationName", "integrationVersion"],
|
|
1577
|
+
"description": "The `getInitConfig` reply as it crosses the IPC boundary: the integration's {@link SidebarConfig } plus the host adapter's own version stamp.\n\n`hostAdapterVersion` is written by the host-side adapter itself from its compiled-in {@link ADAPTER_VERSION } ; it always overwrites whatever the integration returned. Integrations never set it — their {@link PluginInterface.getInitConfig } keeps returning a plain `SidebarConfig`. The sidebar-side adapter strips it again before handing the config to the sidebar app and exposes it through `PluginAdapter.getHostAdapterVersion()`. Non-JS host ports set it themselves from their own version.",
|
|
1578
|
+
"title": "InitConfigResponse"
|
|
1579
|
+
},
|
|
1519
1580
|
"AgenticIssuePosition": {
|
|
1520
1581
|
"type": "object",
|
|
1521
1582
|
"properties": {
|
|
@@ -1986,6 +2047,62 @@
|
|
|
1986
2047
|
}
|
|
1987
2048
|
},
|
|
1988
2049
|
"title": "isIntegrationSettingField"
|
|
2050
|
+
},
|
|
2051
|
+
"TextLookupErrorPayload": {
|
|
2052
|
+
"type": "object",
|
|
2053
|
+
"properties": {
|
|
2054
|
+
"name": { "type": "string", "const": "TextLookupError" },
|
|
2055
|
+
"message": { "type": "string" }
|
|
2056
|
+
},
|
|
2057
|
+
"required": ["name", "message"],
|
|
2058
|
+
"additionalProperties": false,
|
|
2059
|
+
"description": "Wire shape of the `errorJSON` payload for a `TextLookupError` thrown by a host's `selectContent` / `replaceContent` / `replaceMultipleContents`.\n\nThe receiving side rebuilds the typed error from `name` through the error registry (`ipcErrorReconstructors`), so a non-JS port must send exactly this `name` for the sidebar to recognise the failure.",
|
|
2060
|
+
"title": "TextLookupErrorPayload"
|
|
2061
|
+
},
|
|
2062
|
+
"ReplaceBatchFailedRange": {
|
|
2063
|
+
"type": "object",
|
|
2064
|
+
"properties": {
|
|
2065
|
+
"start": {
|
|
2066
|
+
"type": "number",
|
|
2067
|
+
"description": "The zero-based character offset from the beginning of the document where the content to replace starts. Must be a non-negative integer."
|
|
2068
|
+
},
|
|
2069
|
+
"end": {
|
|
2070
|
+
"type": "number",
|
|
2071
|
+
"description": "The zero-based exclusive end offset; the span replaced or selected is `[start, end)` in the document."
|
|
2072
|
+
},
|
|
2073
|
+
"message": {
|
|
2074
|
+
"type": "string",
|
|
2075
|
+
"description": "Why this occurrence failed, written for the author (e.g. \"This text was edited since the last check.\"). The sidebar shows it on that occurrence's card; when omitted it shows its own \"text could not be found\" message. The error's top-level `message` describes the batch and is shown only on the card the user applied from."
|
|
2076
|
+
}
|
|
2077
|
+
},
|
|
2078
|
+
"additionalProperties": false,
|
|
2079
|
+
"required": ["end", "start"],
|
|
2080
|
+
"description": "A range (as sent in the call) that the host could not apply, optionally with the reason for that one occurrence.",
|
|
2081
|
+
"title": "ReplaceBatchFailedRange"
|
|
2082
|
+
},
|
|
2083
|
+
"ReplaceBatchErrorPayload": {
|
|
2084
|
+
"type": "object",
|
|
2085
|
+
"properties": {
|
|
2086
|
+
"name": { "type": "string", "const": "ReplaceBatchError" },
|
|
2087
|
+
"message": { "type": "string" },
|
|
2088
|
+
"applied": { "type": "array", "items": { "$ref": "#/components/schemas/ContentRange" } },
|
|
2089
|
+
"failed": {
|
|
2090
|
+
"type": "array",
|
|
2091
|
+
"items": { "$ref": "#/components/schemas/ReplaceBatchFailedRange" }
|
|
2092
|
+
}
|
|
2093
|
+
},
|
|
2094
|
+
"required": ["name", "message", "applied", "failed"],
|
|
2095
|
+
"additionalProperties": false,
|
|
2096
|
+
"description": "Wire shape of the `errorJSON` payload for a `ReplaceBatchError`: a `replaceMultipleContents` batch that the host could not apply in full.\n\n`applied` lists the ranges (as sent in the call) whose replacement landed in the document; `failed` lists the ranges the host could not locate or verify, each with an optional per-occurrence `message`. A range in neither list was left untouched. A host that verifies the whole batch before editing sends every unverifiable range in `failed` and an empty `applied`.",
|
|
2097
|
+
"title": "ReplaceBatchErrorPayload"
|
|
2098
|
+
},
|
|
2099
|
+
"KnownIpcErrorPayload": {
|
|
2100
|
+
"anyOf": [
|
|
2101
|
+
{ "$ref": "#/components/schemas/TextLookupErrorPayload" },
|
|
2102
|
+
{ "$ref": "#/components/schemas/ReplaceBatchErrorPayload" }
|
|
2103
|
+
],
|
|
2104
|
+
"description": "Every `errorJSON` payload the sidebar reconstructs into a typed error.",
|
|
2105
|
+
"title": "KnownIpcErrorPayload"
|
|
1989
2106
|
}
|
|
1990
2107
|
}
|
|
1991
2108
|
}
|
|
@@ -22,6 +22,15 @@ export declare class PluginAdapter {
|
|
|
22
22
|
* automatically. Omit to send no report.
|
|
23
23
|
*/
|
|
24
24
|
getInitConfig(sidebarBuildInfo?: SidebarBuildInfo): Promise<SidebarConfig>;
|
|
25
|
+
/**
|
|
26
|
+
* The `@markupai/sidebar-adapter` version the host stamped onto its most
|
|
27
|
+
* recent `getInitConfig` reply — the adapter compiled into the host, not a
|
|
28
|
+
* value the integration chose. Compare it with the sidebar's own
|
|
29
|
+
* {@link ADAPTER_VERSION} to spot contract skew. `null` before the first
|
|
30
|
+
* reply, and when the host adapter predates version stamping (below 2.2.0).
|
|
31
|
+
* Replaced on every reply, so it tracks host reloads.
|
|
32
|
+
*/
|
|
33
|
+
getHostAdapterVersion(): string | null;
|
|
25
34
|
/**
|
|
26
35
|
* Request content from the editor in whatever format the integration supports
|
|
27
36
|
* @param options - Optional per-call overrides (e.g. timeout in ms; overrides default IPC timeout)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/pluginAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;gBAElC,OAAO,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,MAAM;IAKjF;;OAEG;IACI,OAAO,IAAI,IAAI;IAKtB;;;;;OAKG;IACU,aAAa,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAKvF;;;OAGG;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1,3 +1,5 @@
|
|
|
1
|
+
import type { ContentRange } from "./types/common";
|
|
2
|
+
import type { ReplaceBatchFailedRange } from "./types/errors";
|
|
1
3
|
/**
|
|
2
4
|
* Error thrown by integration/plugin code when text lookup (e.g. selection or
|
|
3
5
|
* positioning) fails. The sidebar treats this as a selection failure and can
|
|
@@ -7,9 +9,38 @@
|
|
|
7
9
|
* replaceContent) when the requested text cannot be found or located.
|
|
8
10
|
*/
|
|
9
11
|
export declare class TextLookupError extends Error {
|
|
10
|
-
readonly name
|
|
12
|
+
readonly name: string;
|
|
11
13
|
constructor(message: string);
|
|
12
14
|
}
|
|
15
|
+
/** Per-range outcome of a `replaceMultipleContents` batch the host could not apply in full. */
|
|
16
|
+
export interface ReplaceBatchOutcome {
|
|
17
|
+
/** Ranges (as sent in the call) whose replacement landed in the document. */
|
|
18
|
+
applied: ContentRange[];
|
|
19
|
+
/** Ranges the host could not locate or verify, each with an optional reason for that occurrence. */
|
|
20
|
+
failed: ReplaceBatchFailedRange[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown by `replaceMultipleContents` when the batch could not be applied
|
|
24
|
+
* in full, carrying which ranges were `applied` and which `failed`. A range in
|
|
25
|
+
* neither list was left untouched.
|
|
26
|
+
*
|
|
27
|
+
* A `TextLookupError`, so a sidebar that predates this type still handles it
|
|
28
|
+
* as a batch failure; a sidebar that knows it resolves the applied
|
|
29
|
+
* occurrences, invalidates the failed ones and leaves the rest active. Throw
|
|
30
|
+
* it with an empty `applied` when the batch is verified before any edit.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ReplaceBatchError extends TextLookupError {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly applied: ContentRange[];
|
|
35
|
+
readonly failed: ReplaceBatchFailedRange[];
|
|
36
|
+
constructor(message: string, outcome: ReplaceBatchOutcome);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Type guard for ReplaceBatchError. Check it before `isTextLookupError` when
|
|
40
|
+
* catching from `replaceMultipleContents`: every ReplaceBatchError is also a
|
|
41
|
+
* TextLookupError.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isReplaceBatchError(error: unknown): error is ReplaceBatchError;
|
|
13
44
|
/**
|
|
14
45
|
* Type guard for TextLookupError. Use when catching errors from adapter methods
|
|
15
46
|
* (e.g. selectContent, replaceContent) to narrow the type and handle text
|
|
@@ -26,6 +57,12 @@ export type SelectContentError = TextLookupError;
|
|
|
26
57
|
* catching. Extend when adding new known errors for replaceContent.
|
|
27
58
|
*/
|
|
28
59
|
export type ReplaceContentError = TextLookupError;
|
|
60
|
+
/**
|
|
61
|
+
* Union of errors that replaceMultipleContents may throw. A host that can say
|
|
62
|
+
* which ranges landed throws `ReplaceBatchError`; older hosts throw a plain
|
|
63
|
+
* `TextLookupError` for the whole batch.
|
|
64
|
+
*/
|
|
65
|
+
export type ReplaceMultipleContentsError = TextLookupError | ReplaceBatchError;
|
|
29
66
|
/**
|
|
30
67
|
* Serialized shape of an error sent over IPC (name + message; extend for custom payloads).
|
|
31
68
|
*/
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAkB,IAAI,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAE9D;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAkB,IAAI,EAAE,MAAM,CAAqB;gBAEvC,OAAO,EAAE,MAAM;CAI5B;AAED,+FAA+F;AAC/F,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E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
import type { ContentRange, ContentReplacement, ContentInfo, InitConfigResponse, SidebarBuildInfo, AgenticIssuePayload, PluginStatusType } from "../types/common";
|
|
2
2
|
import type { IntegrationSettingsValues, IntegrationSettingsChangeMeta, IntegrationSettingsPatch, IntegrationSettingsSnapshot } from "../types/integrationSettings";
|
|
3
3
|
/**
|
|
4
4
|
* Call signatures for all bidirectional IPC communication.
|
|
@@ -39,8 +39,10 @@ export interface CallSignatures {
|
|
|
39
39
|
* `sidebarBuildInfo` reports the sidebar build that is executing — see
|
|
40
40
|
* {@link PluginInterface.getInitConfig}. Optional so an older sidebar that
|
|
41
41
|
* sends no argument, and a host receiver declared with none, keep working.
|
|
42
|
+
* The reply is the integration's `SidebarConfig` plus the host adapter's own
|
|
43
|
+
* `hostAdapterVersion` stamp — see {@link InitConfigResponse}.
|
|
42
44
|
*/
|
|
43
|
-
getInitConfig(sidebarBuildInfo?: SidebarBuildInfo): Promise<
|
|
45
|
+
getInitConfig(sidebarBuildInfo?: SidebarBuildInfo): Promise<InitConfigResponse>;
|
|
44
46
|
/**
|
|
45
47
|
* Notify plugin when one agent's agentic results are available (streaming).
|
|
46
48
|
* `documentReference` is the run's originating document (`null` when
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-signatures.d.ts","sourceRoot":"","sources":["../../src/ipc/call-signatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"call-signatures.d.ts","sourceRoot":"","sources":["../../src/ipc/call-signatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,yBAAyB,EACzB,6BAA6B,EAC7B,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,6BAA6B,CA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C,EACP,GAAG,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAClD,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAItD;;;;;;;OAOG;IACI,eAAe,CAAC,CAAC,SAAS,MAAM,cAAc,EACnD,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,WAAW,EACpB,GAAG,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAClD,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IA+BtD;;;;;;OAMG;IACI,OAAO,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI;IAKhF;;;;OAIG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMjC;;;OAGG;IACU,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB9D;;OAEG;YACW,UAAU;IAgDxB;;OAEG;IACH,OAAO,CAAC,cAAc;IActB;;OAEG;IACH,OAAO,CAAC,WAAW;IAuBnB;;OAEG;IACI,OAAO,IAAI,IAAI;CAWvB"}
|
|
@@ -13,6 +13,7 @@ export declare class PluginIPCAdapter {
|
|
|
13
13
|
private readonly ipc;
|
|
14
14
|
private readonly sidebar;
|
|
15
15
|
private targetOrigin;
|
|
16
|
+
private latestHostAdapterVersion;
|
|
16
17
|
constructor(sidebar?: SidebarInterface, config?: IPCConfig, targetOrigin?: string);
|
|
17
18
|
private readonly handleMessage;
|
|
18
19
|
private registerReceivers;
|
|
@@ -23,6 +24,13 @@ export declare class PluginIPCAdapter {
|
|
|
23
24
|
* the caller leaves it out. Omit to send no report.
|
|
24
25
|
*/
|
|
25
26
|
getInitConfig(sidebarBuildInfo?: SidebarBuildInfo): Promise<SidebarConfig>;
|
|
27
|
+
/**
|
|
28
|
+
* The `@markupai/sidebar-adapter` version the host stamped onto its most
|
|
29
|
+
* recent `getInitConfig` reply, sanitized. `null` before the first reply,
|
|
30
|
+
* and when the host adapter predates version stamping. Replaced on every
|
|
31
|
+
* reply.
|
|
32
|
+
*/
|
|
33
|
+
getHostAdapterVersion(): string | null;
|
|
26
34
|
/**
|
|
27
35
|
* Request content from the editor in whatever format the integration supports
|
|
28
36
|
* @param options - Optional per-call overrides (e.g. timeout in ms; overrides default IPC timeout)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-ipc-adapter.d.ts","sourceRoot":"","sources":["../../src/ipc/plugin-ipc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAc,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-ipc-adapter.d.ts","sourceRoot":"","sources":["../../src/ipc/plugin-ipc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAc,MAAM,qBAAqB,CAAC;AAE9E,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,yBAAyB,EACzB,6BAA6B,EAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,wBAAwB,CAAuB;gBAE3C,OAAO,CAAC,EAAE,gBAAgB,EAAE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;OAKG;IACU,sBAAsB,CAAC,iBAAiB,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3F;;;;OAIG;IACU,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpD;;;;OAIG;IACU,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzD;;;;OAIG;IACU,2BAA2B,CACtC,MAAM,EAAE,yBAAyB,EACjC,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,IAAI,CAAC;IAIhB;;OAEG;IACI,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAIzC;;OAEG;IACI,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAkBlD;;OAEG;IACI,eAAe,IAAI,MAAM;IAIhC;;OAEG;IACI,OAAO,IAAI,IAAI;CAKvB"}
|
|
@@ -12,6 +12,16 @@ export declare const SIDEBAR_BUILD_INFO_MAX_STRING_LENGTH = 64;
|
|
|
12
12
|
* a usable `version` or `commitHash`.
|
|
13
13
|
*/
|
|
14
14
|
export declare function sanitizeSidebarBuildInfo(raw: unknown): SidebarBuildInfo | null;
|
|
15
|
+
/**
|
|
16
|
+
* Validate the `hostAdapterVersion` a host stamped onto its `getInitConfig`
|
|
17
|
+
* reply. It crosses a frame boundary, so it is treated as untrusted: only a
|
|
18
|
+
* non-empty string is accepted, truncated to
|
|
19
|
+
* {@link SIDEBAR_BUILD_INFO_MAX_STRING_LENGTH} characters.
|
|
20
|
+
*
|
|
21
|
+
* @returns The sanitized version, or `null` when absent or invalid (a host
|
|
22
|
+
* adapter that predates version stamping sends none).
|
|
23
|
+
*/
|
|
24
|
+
export declare function sanitizeHostAdapterVersion(raw: unknown): string | null;
|
|
15
25
|
/**
|
|
16
26
|
* The adapter's development/test log line for one `getInitConfig` request
|
|
17
27
|
* (stripped from the published build), e.g.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-build-info.d.ts","sourceRoot":"","sources":["../../src/ipc/sidebar-build-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,oFAAoF;AACpF,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAUvD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAgB9E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAC7B,kBAAkB,EAAE,MAAM,GACzB,MAAM,CAYR"}
|
|
1
|
+
{"version":3,"file":"sidebar-build-info.d.ts","sourceRoot":"","sources":["../../src/ipc/sidebar-build-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,oFAAoF;AACpF,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAUvD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAgB9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAGtE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAC7B,kBAAkB,EAAE,MAAM,GACzB,MAAM,CAYR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-ipc-adapter.d.ts","sourceRoot":"","sources":["../../src/ipc/sidebar-ipc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"sidebar-ipc-adapter.d.ts","sourceRoot":"","sources":["../../src/ipc/sidebar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