@markupai/sidebar-adapter 1.3.3 → 1.5.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 CHANGED
@@ -16,8 +16,9 @@ You do **not** need prior knowledge of how the sidebar is built internally. As a
16
16
  8. [createSidebarHost](#createsidebarhost) (iframe + overlay + adapter in one step)
17
17
  9. [Authentication](#authentication-optional) (declaring an Auth0 login strategy)
18
18
  10. [Sidebar load overlay (standalone)](#sidebarloadoverlay-editor-ui)
19
- 11. [Agentic issue lifecycle](#agentic-issue-lifecycle)
20
- 12. [API reference](#api-reference) · [Development](#development)
19
+ 11. [Agentic issue lifecycle](#agentic-issue-lifecycle) · [Document references](#document-references)
20
+ 12. [Multi-document hosts](#multi-document-hosts)
21
+ 13. [API reference](#api-reference) · [Development](#development)
21
22
 
22
23
  ## Features
23
24
 
@@ -122,6 +123,14 @@ await adapter.selectContent({ start: 0, end: 11 });
122
123
  // Replace content in the editor (apply suggestion to [start, end))
123
124
  await adapter.replaceContent("Hello universe", { start: 0, end: 11 });
124
125
 
126
+ // Multi-document hosts: pass the range's owning documentReference as the
127
+ // trailing argument so the host applies it to the right document even if a
128
+ // different one is currently active. Omit (or pass null) for "whichever
129
+ // document the host currently considers active" — the single-document
130
+ // default. See "Multi-document hosts" below.
131
+ await adapter.selectContent({ start: 0, end: 11 }, content.documentReference);
132
+ await adapter.replaceContent("Hello universe", { start: 0, end: 11 }, content.documentReference);
133
+
125
134
  // Replace multiple contents in the editor
126
135
  await adapter.replaceMultipleContents([
127
136
  { suggestion: "Hello universe", range: { start: 0, end: 11 } },
@@ -150,6 +159,7 @@ import {
150
159
  type ContentRange,
151
160
  type ContentReplacement,
152
161
  type ContentInfo,
162
+ buildDocumentReference,
153
163
  } from "@markupai/sidebar-adapter";
154
164
 
155
165
  // Implement the PluginInterface
@@ -160,7 +170,9 @@ const pluginInterface: PluginInterface = {
160
170
  const content = getContentFromEditor();
161
171
  return {
162
172
  content: content,
163
- documentReference: "my-document.md", // Required: unique identifier for the document
173
+ // Required. "<prefix>:<id>" so the same document correlates across Markup surfaces.
174
+ // Pick the prefix once for your platform and never change it.
175
+ documentReference: buildDocumentReference("my-host", getStableDocumentId()),
164
176
  mimeType: MimeType.TEXT_MARKDOWN, // Optional: can use MimeType enum or any string
165
177
  };
166
178
  },
@@ -184,6 +196,11 @@ const pluginInterface: PluginInterface = {
184
196
  integrationId: "my-editor",
185
197
  useCheckPreviewDialog: true,
186
198
  supportCheckSelection: true,
199
+ // Optional. Allow the sidebar to run several agents in one check, each
200
+ // cancellable on its own. Defaults to false (Style agent only). The
201
+ // agents actually offered are the intersection of this flag and the
202
+ // organization's entitlement.
203
+ multiAgent: false,
187
204
  pluginOrigin: globalThis.location.origin,
188
205
  // Optional. Declare the Auth0 login strategy the sidebar should run.
189
206
  // Omit to let the sidebar pick heuristically (legacy behavior).
@@ -192,16 +209,26 @@ const pluginInterface: PluginInterface = {
192
209
  };
193
210
  },
194
211
 
195
- // Select content in the editor
196
- selectContent: async (range: ContentRange) => {
197
- console.log("Select content range:", range);
198
- selectContentInEditor(range);
212
+ // Select content in the editor.
213
+ // documentReference identifies which document `range` belongs to. In a
214
+ // single-document host, or when this integration hasn't opted into
215
+ // multiDocument, it's always null — ignore it. In a multi-document host,
216
+ // omitted/null means "whichever document I currently consider active";
217
+ // otherwise resolve it to the target document first. See
218
+ // "Multi-document hosts" below.
219
+ selectContent: async (range: ContentRange, documentReference: string | null) => {
220
+ console.log("Select content range:", range, "in document:", documentReference);
221
+ selectContentInEditor(range, documentReference);
199
222
  },
200
223
 
201
- // Replace content in the editor
202
- replaceContent: async (suggestion: string, range: ContentRange) => {
203
- console.log("Replace content span:", range, "with:", suggestion);
204
- replaceContentInEditor(suggestion, range);
224
+ // Replace content in the editor. Same documentReference rule as selectContent.
225
+ replaceContent: async (
226
+ suggestion: string,
227
+ range: ContentRange,
228
+ documentReference: string | null,
229
+ ) => {
230
+ console.log("Replace content span:", range, "with:", suggestion, "in:", documentReference);
231
+ replaceContentInEditor(suggestion, range, documentReference);
205
232
  },
206
233
 
207
234
  // Replace multiple contents in the editor
@@ -475,16 +502,16 @@ Implement these **on the host** as async functions. The sidebar calls them over
475
502
  - `getInitConfig(): Promise<SidebarConfig>` — Integration display name (`integrationName`), stable machine id (`integrationId`), version, feature flags, dialog closing script, etc. See the `integrationName` vs `integrationId` note above.
476
503
  - `getContent(): Promise<ContentInfo>` — Full document (or main buffer) text; must include `documentReference`; `mimeType` optional
477
504
  - `getSelectedContent(): Promise<ContentInfo>` — Current selection; same `ContentInfo` rules as `getContent`
478
- - `selectContent(range: ContentRange): Promise<void>` — Focus/highlight the document span `[range.start, range.end)`
479
- - `replaceContent(suggestion: string, range: ContentRange): Promise<void>` — Apply a single edit to `[range.start, range.end)`
480
- - `replaceMultipleContents(replacements: ContentReplacement[]): Promise<void>` — Batch edits
505
+ - `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))
506
+ - `replaceContent(suggestion: string, range: ContentRange, documentReference?: string | null): Promise<void>` — Apply a single edit to `[range.start, range.end)`. Same `documentReference` rule as `selectContent`
507
+ - `replaceMultipleContents(replacements: ContentReplacement[]): Promise<void>` — Batch edits, always against the currently active document (no per-item `documentReference`)
481
508
  - `showDialog?(dialogHtml: string, width?: number, height?: number, title?: string): Promise<void>` — Host-rendered dialog chrome around HTML from the sidebar. **Optional** — omit on hosts without dialog support (also leave `useCheckPreviewDialog: false`).
482
509
  - `closeDialog?(): Promise<void>` — Dismiss that dialog. **Optional**, pairs with `showDialog`.
483
510
 
484
511
  Optional (agentic / streaming flows):
485
512
 
486
- - `onAgenticAgentResults?(agentName: string, issues: AgenticIssuePayload[]): Promise<void>` — Per-agent results as they stream
487
- - `onAgenticStreamComplete?(): Promise<void>` — Stream finished (success or terminal state)
513
+ - `onAgenticAgentResults?(agentName: string, issues: AgenticIssuePayload[], documentReference: string | null): Promise<void>` — Per-agent results as they stream. `documentReference` is the document the check ran against — the run's _originating_ document, not necessarily whichever one is active when the callback fires, since a check keeps streaming in the background after the active document changes (see [Multi-document hosts](#multi-document-hosts)). `null` when `multiDocument` is not enabled
514
+ - `onAgenticStreamComplete?(documentReference: string | null): Promise<void>` — Stream finished (success or terminal state). Same `documentReference` rule as `onAgenticAgentResults`
488
515
  - `onAgenticIssueStatusChanged?(issueId: string, status: "active" | "resolved" | "dismissed", source: "user" | "host"): Promise<void>` — Fired after every successful per-issue status transition. `source` is `"user"` for sidebar-card-driven transitions and `"host"` for transitions driven by the inbound `SidebarInterface` RPCs (`invalidateAgenticIssue` / `markAgenticIssueResolved` / `restoreAgenticIssue`). Best-effort: an absent or throwing handler MUST NOT block sidebar UI transitions. No-op RPC calls do not re-emit this notification.
489
516
 
490
517
  Optional (authentication):
@@ -596,14 +623,16 @@ Notes:
596
623
 
597
624
  ### Driving transitions (host → sidebar)
598
625
 
599
- `SidebarAdapter` exposes three host-driven RPCs, all idempotent and optional on the sidebar side:
626
+ `SidebarAdapter` exposes four host-driven RPCs, all idempotent and optional on the sidebar side:
600
627
 
601
628
  ```typescript
629
+ await sidebarAdapter.activateAgenticIssue(issueId); // expand + scroll to the card
602
630
  await sidebarAdapter.invalidateAgenticIssue(issueId); // → status: "dismissed"
603
631
  await sidebarAdapter.markAgenticIssueResolved(issueId); // → status: "resolved"
604
632
  await sidebarAdapter.restoreAgenticIssue(issueId); // → status: "active"
605
633
  ```
606
634
 
635
+ - **`activateAgenticIssue(issueId, documentReference?)`** — Expands and scrolls to the card for `issueId` (e.g. the user clicked an underline in the document, or picked the issue from a context menu). In a **multi-document** host, pass the issue's owning `documentReference` as the second argument if it may not be the document the sidebar is currently displaying — the sidebar switches to it first, then activates. Omitted/`null` activates against whichever document the sidebar currently displays (the single-document default). See [Multi-document hosts](#multi-document-hosts).
607
636
  - **`invalidateAgenticIssue(issueId)`** — Existing dismiss RPC. Use after the host clears the underlying range from its document, or to programmatically dismiss in response to host UI.
608
637
  - **`markAgenticIssueResolved(issueId)`** — Marks an open issue resolved **without applying a suggestion**. The resulting issue is restorable via `restoreAgenticIssue`. Silent no-op for ids that are already in a non-open state or unknown.
609
638
  - **`restoreAgenticIssue(issueId)`** — Moves a manually-resolved or dismissed issue back to the open state. Silent no-op for ids that are already open, **resolved via an applied suggestion** (terminal — see below), or unknown.
@@ -652,6 +681,130 @@ async function onHostReopenClicked(issueId: string) {
652
681
  }
653
682
  ```
654
683
 
684
+ ## Document references
685
+
686
+ `ContentInfo.documentReference` identifies a document across scans. The backend keys its document registry on it, and the Markup session id derives its document component from `SHA-256(documentReference)`.
687
+
688
+ That only works if every Markup surface spells the same document the same way, so the format is `<prefix>:<id>` — a prefix naming your platform, then an id that is stable for the document. **You supply both**, because you know what platform you are and which identifier is stable there:
689
+
690
+ ```ts
691
+ import { buildDocumentReference } from "@markupai/sidebar-adapter";
692
+
693
+ buildDocumentReference("word", fileGuid); // → "word:aabb"
694
+ buildDocumentReference("gdocs", `${docId}/tab:${tabId}`); // → "gdocs:1A2B3C/tab:t.0"
695
+ buildDocumentReference("url", "https://example.com/page"); // → "url:https://example.com/page"
696
+ ```
697
+
698
+ Reuse an existing prefix when your platform already has one, so the same document seen from another Markup surface correlates: `gdocs`, `word`, `heretto`, `madcapflare`, `ixiasoft`, or `url` for anything addressed by a plain URL. If none fits, pick a new one — there is no fixed list, and adding a platform needs no adapter release.
699
+
700
+ ### What you are responsible for
701
+
702
+ - **Choose a prefix once and never change it.** The prefix is part of the document's identity. Changing it re-keys every document you have ever checked and breaks continuity with your own history — coordinate a change with the data team rather than shipping one quietly.
703
+ - **Use an id that is stable for the document.** Not the editor URL with its volatile query parameters, not a per-session handle — the thing that still identifies the document tomorrow.
704
+ - **Use the same reference for the whole document and for a selection.** A selection is a view of one document, not a different document; varying the reference between the two splits one document into two everywhere downstream.
705
+
706
+ `buildDocumentReference` is idempotent for its own prefix, so a host that stores composed references can pass them straight back. It throws on an empty id or a prefix that is not a lowercase name, since both would yield a reference that silently fails to correlate. `isDocumentReference(value)` reports whether a value already carries the `<prefix>:<id>` shape.
707
+
708
+ A bare, unprefixed value is still accepted and behaves exactly as before; it simply cannot be correlated with the same document seen on another surface.
709
+
710
+ ## Multi-document hosts
711
+
712
+ Everything above assumes **one** document at a time — the sidebar's implicit "the document" is whatever your host's `PluginInterface` currently answers with. Tabbed editors (multiple open documents, one active at a time) need more: the sidebar has to retain each document's check results separately, keep background checks running when the user switches away, and let the host act on a document that isn't the one currently on screen. All of that is **opt-in**; a host that never sets `multiDocument` sees no behavior change from this section.
713
+
714
+ ### Enabling it
715
+
716
+ Set `multiDocument: true` in your `getInitConfig` response:
717
+
718
+ ```typescript
719
+ getInitConfig: async () => ({
720
+ // ...other fields...
721
+ multiDocument: true,
722
+ });
723
+ ```
724
+
725
+ With it on, the sidebar retains check results and issue decisions **per document** — switching away from a document and back restores its issues, resolved/dismissed state, and tab selection exactly as the user left them. With it off (or omitted, the default), the sidebar holds one shared check state regardless of any `notifyActiveDocumentChanged` calls you make.
726
+
727
+ **In-flight checks keep running in the background.** Calling `notifyActiveDocumentChanged` — including with `null`, e.g. because the user closed the document's tab — does **not** stop a check already running against the outgoing document; it keeps streaming `onAgenticAgentResults`/`onAgenticStreamComplete` (tagged with its own `documentReference`) until it finishes, even after the document is no longer active or open in your host. There is currently **no host-facing RPC to cancel it** — cancellation is a sidebar-UI-only affordance (the Cancel button), not something `SidebarAdapter` exposes today. If your host needs to stop wasted work when a document closes mid-check, that isn't possible through this contract yet.
728
+
729
+ There is also **no dedicated "check started" signal** — nothing tells you a document is currently mid-check, or lets you distinguish "not yet checked" from "checking right now" from your own state alone. The closest thing is indirect: the sidebar calls your `getContent`/`getSelectedContent` implementation at the moment it starts a check, so seeing that call for a given `documentReference` implies a check just began for it — but that's an inference from a side effect, not a documented guarantee (nothing rules out `getContent` being called for other reasons in the future), and once a check is running there is nothing further until its first `onAgenticAgentResults` or its `onAgenticStreamComplete` arrives.
730
+
731
+ ### Reporting the initial document at init time
732
+
733
+ **Recommended:** report the document open at load via `initialActiveDocumentReference` in your `getInitConfig` response, then use `notifyActiveDocumentChanged` (below) only for changes after that. Without this, a fresh sidebar load can't tell "no document is open" apart from "not yet known" — it only learns the initially open document passively from the first `getContent` call, which doesn't happen until the user (or the sidebar) triggers one. If your host already knows the answer when it responds to `getInitConfig`, report it there instead of waiting:
734
+
735
+ ```typescript
736
+ getInitConfig: async () => ({
737
+ // ...other fields...
738
+ multiDocument: true,
739
+ initialActiveDocumentReference: currentlyOpenDocumentReference, // or null if nothing is open/checkable
740
+ });
741
+ ```
742
+
743
+ This is a **one-time snapshot** — `getInitConfig` is called once per session, so it does not replace `notifyActiveDocumentChanged` for subsequent switches; keep calling that as usual. Only meaningful alongside `multiDocument: true`; omit it (rather than guessing) if your host cannot answer the question synchronously at init — the sidebar falls back to passive detection exactly as before.
744
+
745
+ ### Telling the sidebar which document is active
746
+
747
+ Call `notifyActiveDocumentChanged` every time the user switches tabs in your host, and when the last tab closes:
748
+
749
+ ```typescript
750
+ await sidebarAdapter.notifyActiveDocumentChanged(newlyActiveDocumentReference);
751
+
752
+ // No checkable document is open (every tab closed, or the active tab is a
753
+ // content type the sidebar shouldn't try to check) — null is a deliberate
754
+ // signal, not "unknown":
755
+ await sidebarAdapter.notifyActiveDocumentChanged(null);
756
+ ```
757
+
758
+ You do **not** need to call it for the very first document a user opens — the sidebar learns that one passively from the `documentReference` your first `getContent`/`getSelectedContent` response carries. Every switch **after** that needs an explicit call, or the sidebar keeps attributing checks to the stale document. An empty string is ignored as malformed (active document unchanged); `null` is accepted and treated identically to "every tab closed."
759
+
760
+ ### `documentReference` on document-scoped actions
761
+
762
+ Once `multiDocument` is on, several calls in both directions carry an explicit `documentReference` alongside their usual arguments, precisely because "the currently active document" stops being a safe assumption:
763
+
764
+ | Direction | Method | Why it needs to name a document |
765
+ | -------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
766
+ | Sidebar → host | `selectContent`, `replaceContent` | The issue the user is acting on may belong to a document you checked earlier and the user has since switched away from — see below. |
767
+ | Sidebar → host | `onAgenticAgentResults`, `onAgenticStreamComplete` | A check keeps streaming results in the background after the user switches to a different document; results must stay attributed to the document that was actually checked, not whichever one happens to be on screen when they arrive. |
768
+ | Host → sidebar | `activateAgenticIssue` | The host may want to activate an issue belonging to a document that isn't the one the sidebar is currently displaying (e.g. a background check just finished elsewhere). |
769
+
770
+ In every case, **omitted or `null` means "the currently active document"** — the same behavior as before `multiDocument` existed. A non-null value names a document that may differ from whatever is currently active.
771
+
772
+ ### Maintaining your document ↔ `documentReference` lookup
773
+
774
+ This is the part that's on you: `documentReference` is an opaque string as far as the sidebar's transport is concerned, but it has to round-trip correctly through **your** code so a call that names a document actually resolves back to the right one in your editor. Concretely:
775
+
776
+ 1. **Return the same `documentReference` for the same document, every time, for the life of the session.** Build it once per document (typically with [`buildDocumentReference`](#document-references), keyed off whatever id is stable in your platform — a file GUID, a tab id) and reuse it across every `getContent`/`getSelectedContent` call for that document. If the string drifts, the sidebar's per-document retention and your own lookup both silently split into two "documents."
777
+ 2. **Keep a lookup from `documentReference` back to your internal document/tab handle.** A simple `Map<string, YourDocumentHandle>`, populated at the same place you mint each document's reference, is enough:
778
+
779
+ ```typescript
780
+ const documentsByReference = new Map<string, YourDocumentHandle>();
781
+
782
+ function registerDocument(handle: YourDocumentHandle): string {
783
+ const reference = buildDocumentReference("my-host", handle.stableId);
784
+ documentsByReference.set(reference, handle);
785
+ return reference;
786
+ }
787
+ ```
788
+
789
+ 3. **Resolve incoming `documentReference` arguments through that lookup — don't assume "whatever's on screen."** When `selectContent`/`replaceContent` names a document other than your currently active tab, look it up and act on _that_ document (switch your editor's visible tab if that's the only way you can apply an edit, or edit it in the background if your editor supports that):
790
+
791
+ ```typescript
792
+ selectContent: async (range, documentReference) => {
793
+ const handle = documentReference
794
+ ? (documentsByReference.get(documentReference) ?? activeDocumentHandle)
795
+ : activeDocumentHandle;
796
+ selectContentInEditor(handle, range);
797
+ },
798
+ ```
799
+
800
+ Silently applying the range to whichever document happens to be visible — ignoring a non-null `documentReference` — is the bug this parameter exists to prevent: it edits the wrong document as soon as the user has checked more than one.
801
+
802
+ 4. **Evict lookup entries when a document is actually closed**, not merely switched away from. The sidebar caps its own per-document retention at **20 documents** internally (least-recently-used eviction, skipping any document with a check still running), so it doesn't expect you to remember a document forever either — but it also doesn't tell you when to forget one, since that's a host-side lifecycle event (tab closed, file closed) the sidebar has no visibility into. A host tracking more than ~20 concurrently open documents should not assume the sidebar retains state for all of them.
803
+
804
+ ### Single-document hosts (the default)
805
+
806
+ If you don't set `multiDocument`, none of the above applies: every `documentReference` argument on `selectContent`, `replaceContent`, and `activateAgenticIssue` is always `null`, and `onAgenticAgentResults`/`onAgenticStreamComplete` receive `null` too. You don't need a lookup — "the document" is implicit, exactly as it was before this feature existed. Most integrations should stay here unless they genuinely support multiple concurrently open documents.
807
+
655
808
  ## Integration settings
656
809
 
657
810
  A host MAY declare a small schema of settings it wants the sidebar to render and persist on its behalf. The sidebar shows a section in its Settings surface, persists user choices per-`integrationId` in `localStorage`, and notifies the host on user edits. The host can also push values and per-field UI state (`disabled`, `hidden`, `allowedValues`) to enforce its own rules — for example, "annotations off ⇒ view mode locked to `original`".
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": "1.3.3",
5
+ "version": "1.5.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": {
@@ -105,6 +105,12 @@
105
105
  },
106
106
  "getIntegrationSettings_response": {
107
107
  "$ref": "#/components/messages/getIntegrationSettings_response"
108
+ },
109
+ "onActiveDocumentChanged_call": {
110
+ "$ref": "#/components/messages/onActiveDocumentChanged_call"
111
+ },
112
+ "onActiveDocumentChanged_response": {
113
+ "$ref": "#/components/messages/onActiveDocumentChanged_response"
108
114
  }
109
115
  }
110
116
  }
@@ -234,7 +240,7 @@
234
240
  "action": "send",
235
241
  "channel": { "$ref": "#/channels/sidebarToPlugin" },
236
242
  "title": "onAgenticAgentResults",
237
- "description": "Stream one agent's agentic results to the plugin.",
243
+ "description": "Stream one agent's agentic results to the plugin. documentReference is the run's originating document (null when multiDocument is not enabled).",
238
244
  "x-optional": false,
239
245
  "messages": [{ "$ref": "#/channels/sidebarToPlugin/messages/onAgenticAgentResults_call" }],
240
246
  "reply": {
@@ -249,7 +255,7 @@
249
255
  "action": "send",
250
256
  "channel": { "$ref": "#/channels/sidebarToPlugin" },
251
257
  "title": "onAgenticStreamComplete",
252
- "description": "Notify plugin the agentic stream finished.",
258
+ "description": "Notify plugin the agentic stream finished. documentReference is the run's originating document (null when multiDocument is not enabled).",
253
259
  "x-optional": false,
254
260
  "messages": [{ "$ref": "#/channels/sidebarToPlugin/messages/onAgenticStreamComplete_call" }],
255
261
  "reply": {
@@ -428,6 +434,21 @@
428
434
  { "$ref": "#/channels/pluginToSidebar/messages/ipc_error" }
429
435
  ]
430
436
  }
437
+ },
438
+ "onActiveDocumentChanged": {
439
+ "action": "send",
440
+ "channel": { "$ref": "#/channels/pluginToSidebar" },
441
+ "title": "onActiveDocumentChanged",
442
+ "description": "Notify the sidebar that the active document changed (multiDocument hosts). null means no checkable document is active.",
443
+ "x-optional": true,
444
+ "messages": [{ "$ref": "#/channels/pluginToSidebar/messages/onActiveDocumentChanged_call" }],
445
+ "reply": {
446
+ "channel": { "$ref": "#/channels/pluginToSidebar" },
447
+ "messages": [
448
+ { "$ref": "#/channels/pluginToSidebar/messages/onActiveDocumentChanged_response" },
449
+ { "$ref": "#/channels/pluginToSidebar/messages/ipc_error" }
450
+ ]
451
+ }
431
452
  }
432
453
  },
433
454
  "components": {
@@ -781,10 +802,14 @@
781
802
  "type": "array",
782
803
  "prefixItems": [
783
804
  { "type": "string" },
784
- { "type": "array", "items": { "$ref": "#/components/schemas/AgenticIssuePayload" } }
805
+ {
806
+ "type": "array",
807
+ "items": { "$ref": "#/components/schemas/AgenticIssuePayload" }
808
+ },
809
+ { "type": ["string", "null"] }
785
810
  ],
786
811
  "minItems": 2,
787
- "maxItems": 2,
812
+ "maxItems": 3,
788
813
  "items": false
789
814
  }
790
815
  }
@@ -820,9 +845,9 @@
820
845
  "name": { "const": "onAgenticStreamComplete" },
821
846
  "data": {
822
847
  "type": "array",
823
- "prefixItems": [],
848
+ "prefixItems": [{ "type": ["string", "null"] }],
824
849
  "minItems": 0,
825
- "maxItems": 0,
850
+ "maxItems": 1,
826
851
  "items": false
827
852
  }
828
853
  }
@@ -1271,6 +1296,44 @@
1271
1296
  "data": { "$ref": "#/components/schemas/IntegrationSettingsSnapshot" }
1272
1297
  }
1273
1298
  }
1299
+ },
1300
+ "onActiveDocumentChanged_call": {
1301
+ "name": "onActiveDocumentChanged_call",
1302
+ "title": "call onActiveDocumentChanged",
1303
+ "payload": {
1304
+ "title": "onActiveDocumentChanged_call",
1305
+ "type": "object",
1306
+ "additionalProperties": false,
1307
+ "required": ["type", "id", "name", "data"],
1308
+ "properties": {
1309
+ "type": { "const": "call" },
1310
+ "id": { "type": "integer" },
1311
+ "name": { "const": "onActiveDocumentChanged" },
1312
+ "data": {
1313
+ "type": "array",
1314
+ "prefixItems": [{ "type": ["string", "null"] }],
1315
+ "minItems": 1,
1316
+ "maxItems": 1,
1317
+ "items": false
1318
+ }
1319
+ }
1320
+ }
1321
+ },
1322
+ "onActiveDocumentChanged_response": {
1323
+ "name": "onActiveDocumentChanged_response",
1324
+ "title": "response onActiveDocumentChanged",
1325
+ "payload": {
1326
+ "title": "onActiveDocumentChanged_response",
1327
+ "type": "object",
1328
+ "additionalProperties": false,
1329
+ "required": ["type", "id", "name", "data"],
1330
+ "properties": {
1331
+ "type": { "const": "response" },
1332
+ "id": { "type": "integer" },
1333
+ "name": { "const": "onActiveDocumentChanged" },
1334
+ "data": { "type": "null" }
1335
+ }
1336
+ }
1274
1337
  }
1275
1338
  },
1276
1339
  "schemas": {
@@ -1319,7 +1382,7 @@
1319
1382
  },
1320
1383
  "required": ["content", "documentReference"],
1321
1384
  "additionalProperties": false,
1322
- "description": "Content information including the content, document reference, optional document name, and optional mime type The integration must provide content and documentReference - documentName and mimeType are optional\n\n- documentReference: A unique identifier for the document (e.g., URL, file path, or document ID). Required because the API uses it to track a document across scans.\n- documentName: A human-readable name/title for the document (e.g., \"My Report.docx\"). Optional; when absent, the sidebar will attempt to derive it from documentReference if it contains a filename with extension.\n- mimeType: Any valid MIME type string, not limited to MimeType enum values.",
1385
+ "description": "Content information including the content, document reference, optional document name, and optional mime type The integration must provide content and documentReference - documentName and mimeType are optional\n\n- documentReference: A unique identifier for the document, used to track it across scans. Compose it with `buildDocumentReference(prefix, id)`: you pick a prefix naming your platform and supply an id that is stable for the document. The `<prefix>:<id>` format is shared with every other Markup surface, so the same document correlates across products, and the Markup session id's document component is derived from it.\n\n Choose the prefix once and never change it — it is part of the document's identity, and changing it re-keys every document you have checked. Use the same reference for a whole document and for a selection within it. A bare, unprefixed value is still accepted and behaves as before; it simply cannot be correlated with the same document seen elsewhere.\n- documentName: A human-readable name/title for the document (e.g., \"My Report.docx\"). Optional; when absent, the sidebar will attempt to derive it from documentReference if it contains a filename with extension.\n- mimeType: Any valid MIME type string, not limited to MimeType enum values.",
1323
1386
  "title": "ContentInfo"
1324
1387
  },
1325
1388
  "AuthConfigMediation": {
@@ -1391,6 +1454,18 @@
1391
1454
  "type": "boolean",
1392
1455
  "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"
1393
1456
  },
1457
+ "multiAgent": {
1458
+ "type": "boolean",
1459
+ "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`."
1460
+ },
1461
+ "multiDocument": {
1462
+ "type": "boolean",
1463
+ "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."
1464
+ },
1465
+ "initialActiveDocumentReference": {
1466
+ "type": ["string", "null"],
1467
+ "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."
1468
+ },
1394
1469
  "auth": {
1395
1470
  "$ref": "#/components/schemas/AuthConfig",
1396
1471
  "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`."
@@ -1519,21 +1594,22 @@
1519
1594
  "properties": {
1520
1595
  "getContent": {
1521
1596
  "$comment": "() => Promise<ContentInfo>",
1522
- "description": "Get content from the editor in whatever format the integration supports The integration must provide content and documentReference; documentName and mimeType are optional"
1597
+ "description": "Get content from the editor in whatever format the integration supports The integration must provide content and documentReference; documentName and mimeType are optional. Compose `documentReference` with the exported `buildDocumentReference(prefix, id)` helper — see {@link ContentInfo.documentReference } for why."
1523
1598
  },
1524
1599
  "getSelectedContent": {
1525
1600
  "$comment": "() => Promise<ContentInfo>",
1526
- "description": "Get selected content from the editor in whatever format the integration supports The integration must provide content and documentReference; documentName and mimeType are optional"
1601
+ "description": "Get selected content from the editor in whatever format the integration supports The integration must provide content and documentReference; documentName and mimeType are optional. Same `documentReference` as the whole document — see {@link ContentInfo.documentReference } ."
1527
1602
  },
1528
1603
  "replaceContent": {
1529
- "$comment": "(suggestion: string, range: ContentRange) => Promise<void>",
1604
+ "$comment": "(\n suggestion: string,\n range: ContentRange,\n documentReference?: string | null) => Promise<void>",
1530
1605
  "type": "object",
1531
1606
  "properties": {
1532
1607
  "namedArgs": {
1533
1608
  "type": "object",
1534
1609
  "properties": {
1535
1610
  "suggestion": { "type": "string" },
1536
- "range": { "$ref": "#/components/schemas/ContentRange" }
1611
+ "range": { "$ref": "#/components/schemas/ContentRange" },
1612
+ "documentReference": { "type": ["string", "null"] }
1537
1613
  },
1538
1614
  "required": ["suggestion", "range"],
1539
1615
  "additionalProperties": false
@@ -1542,12 +1618,15 @@
1542
1618
  "description": "Replace content in the editor using document offsets only."
1543
1619
  },
1544
1620
  "selectContent": {
1545
- "$comment": "(range: ContentRange) => Promise<void>",
1621
+ "$comment": "(range: ContentRange, documentReference?: string | null) => Promise<void>",
1546
1622
  "type": "object",
1547
1623
  "properties": {
1548
1624
  "namedArgs": {
1549
1625
  "type": "object",
1550
- "properties": { "range": { "$ref": "#/components/schemas/ContentRange" } },
1626
+ "properties": {
1627
+ "range": { "$ref": "#/components/schemas/ContentRange" },
1628
+ "documentReference": { "type": ["string", "null"] }
1629
+ },
1551
1630
  "required": ["range"],
1552
1631
  "additionalProperties": false
1553
1632
  }
@@ -1599,7 +1678,7 @@
1599
1678
  "description": "Get initialization configuration from the editor Called by the sidebar when it's ready to initialize"
1600
1679
  },
1601
1680
  "onAgenticAgentResults": {
1602
- "$comment": "(agentName: string, issues: AgenticIssuePayload[]) => Promise<void>",
1681
+ "$comment": "(\n agentName: string,\n issues: AgenticIssuePayload[],\n documentReference: string | null) => Promise<void>",
1603
1682
  "type": "object",
1604
1683
  "properties": {
1605
1684
  "namedArgs": {
@@ -1609,16 +1688,26 @@
1609
1688
  "issues": {
1610
1689
  "type": "array",
1611
1690
  "items": { "$ref": "#/components/schemas/AgenticIssuePayload" }
1612
- }
1691
+ },
1692
+ "documentReference": { "type": ["string", "null"] }
1613
1693
  },
1614
- "required": ["agentName", "issues"],
1694
+ "required": ["agentName", "issues", "documentReference"],
1615
1695
  "additionalProperties": false
1616
1696
  }
1617
1697
  },
1618
1698
  "description": "Called when one agent's results are available during agentic streaming. Enables the plugin to render underlines or update UI per agent as results arrive."
1619
1699
  },
1620
1700
  "onAgenticStreamComplete": {
1621
- "$comment": "() => Promise<void>",
1701
+ "$comment": "(documentReference: string | null) => Promise<void>",
1702
+ "type": "object",
1703
+ "properties": {
1704
+ "namedArgs": {
1705
+ "type": "object",
1706
+ "properties": { "documentReference": { "type": ["string", "null"] } },
1707
+ "required": ["documentReference"],
1708
+ "additionalProperties": false
1709
+ }
1710
+ },
1622
1711
  "description": "Called when the agentic stream has finished (all agents done or completion/error event)."
1623
1712
  },
1624
1713
  "onAgenticIssueStatusChanged": {
@@ -1738,12 +1827,15 @@
1738
1827
  "description": "Example method: Called when plugin status changes (e.g., initialization complete) This serves as a template for adding future Plugin → Sidebar communication"
1739
1828
  },
1740
1829
  "activateAgenticIssue": {
1741
- "$comment": "(issueId: string) => Promise<void>",
1830
+ "$comment": "(issueId: string, documentReference?: string | null) => Promise<void>",
1742
1831
  "type": "object",
1743
1832
  "properties": {
1744
1833
  "namedArgs": {
1745
1834
  "type": "object",
1746
- "properties": { "issueId": { "type": "string" } },
1835
+ "properties": {
1836
+ "issueId": { "type": "string" },
1837
+ "documentReference": { "type": ["string", "null"] }
1838
+ },
1747
1839
  "required": ["issueId"],
1748
1840
  "additionalProperties": false
1749
1841
  }
@@ -1807,6 +1899,19 @@
1807
1899
  "getIntegrationSettings": {
1808
1900
  "$comment": "() => Promise<IntegrationSettingsSnapshot>",
1809
1901
  "description": "Read back the sidebar's current integration-settings state — the persisted user values plus any session-only field states the host has pushed via {@link applyIntegrationSettings } . Hosts call this when they re-mount mid-session and need to mirror sidebar state without clobbering the user's persisted choices.\n\nReturns an empty snapshot (`{ values: {}, fieldStates: {} }`) when no integration-settings schema has been declared.\n\nOptional on the `SidebarInterface` type for the same reason as {@link applyIntegrationSettings } ; the sidebar app's actual implementation always provides it."
1902
+ },
1903
+ "onActiveDocumentChanged": {
1904
+ "$comment": "(documentReference: string | null) => Promise<void>",
1905
+ "type": "object",
1906
+ "properties": {
1907
+ "namedArgs": {
1908
+ "type": "object",
1909
+ "properties": { "documentReference": { "type": ["string", "null"] } },
1910
+ "required": ["documentReference"],
1911
+ "additionalProperties": false
1912
+ }
1913
+ },
1914
+ "description": "Notify the sidebar that the user switched which document is active in a multi-document host (e.g. a tabbed editor). Only meaningful when the host's init config sets `multiDocument: true`; the sidebar SHALL ignore this call otherwise.\n\n`documentReference` must match the `documentReference` returned in that document's `ContentInfo` — the same value built with `buildDocumentReference(prefix, id)`, not a re-derivation. Pass `null` when there is no checkable document currently active — every tab closed, or the active tab is content the host does not consider checkable — which the sidebar treats as a deliberate signal, not a malformed value. An empty string, by contrast, is ignored as malformed; the sidebar's active document stays whatever it was."
1810
1915
  }
1811
1916
  },
1812
1917
  "additionalProperties": false,
@@ -32,11 +32,11 @@ export declare class PluginAdapter {
32
32
  /**
33
33
  * Replace content in the editor
34
34
  */
35
- replaceContent(suggestion: string, range: ContentRange): Promise<void>;
35
+ replaceContent(suggestion: string, range: ContentRange, documentReference?: string | null): Promise<void>;
36
36
  /**
37
37
  * Select content in the editor
38
38
  */
39
- selectContent(range: ContentRange): Promise<void>;
39
+ selectContent(range: ContentRange, documentReference?: string | null): Promise<void>;
40
40
  /**
41
41
  * Show a dialog in the editor
42
42
  */
@@ -52,11 +52,11 @@ export declare class PluginAdapter {
52
52
  /**
53
53
  * Notify plugin that one agent's results are available (streaming).
54
54
  */
55
- onAgenticAgentResults(agentName: string, issues: AgenticIssuePayload[]): Promise<void>;
55
+ onAgenticAgentResults(agentName: string, issues: AgenticIssuePayload[], documentReference?: string | null): Promise<void>;
56
56
  /**
57
57
  * Notify plugin that the agentic stream has finished.
58
58
  */
59
- onAgenticStreamComplete(): Promise<void>;
59
+ onAgenticStreamComplete(documentReference?: string | null): Promise<void>;
60
60
  /**
61
61
  * Notify plugin after a successful agentic-issue status transition.
62
62
  * Optional on the host side — the returned promise rejects if the host
@@ -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,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;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAKpD;;;OAGG;IACU,UAAU,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAKpE;;;OAGG;IACU,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAK5E;;OAEG;IACU,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnF;;OAEG;IACU,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9D;;OAEG;IACU,UAAU,CACrB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAKhB;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAKzC;;OAEG;IACU,uBAAuB,CAAC,YAAY,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvF;;OAEG;IACI,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7F;;OAEG;IACI,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/C;;;;;OAKG;IACI,2BAA2B,CAChC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,EAC3C,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;OAIG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C;;;;;OAKG;IACI,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD;;;;;OAKG;IACI,2BAA2B,CAChC,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;IAIlD;;OAEG;IACI,eAAe,IAAI,MAAM;CAGjC"}
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,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;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAKpD;;;OAGG;IACU,UAAU,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAKpE;;;OAGG;IACU,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAK5E;;OAEG;IACU,cAAc,CACzB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,iBAAiB,GAAE,MAAM,GAAG,IAAW,GACtC,OAAO,CAAC,IAAI,CAAC;IAKhB;;OAEG;IACU,aAAa,CACxB,KAAK,EAAE,YAAY,EACnB,iBAAiB,GAAE,MAAM,GAAG,IAAW,GACtC,OAAO,CAAC,IAAI,CAAC;IAKhB;;OAEG;IACU,UAAU,CACrB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAKhB;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAKzC;;OAEG;IACU,uBAAuB,CAAC,YAAY,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvF;;OAEG;IACI,qBAAqB,CAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAAE,EAC7B,iBAAiB,GAAE,MAAM,GAAG,IAAW,GACtC,OAAO,CAAC,IAAI,CAAC;IAIhB;;OAEG;IACI,uBAAuB,CAAC,iBAAiB,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAItF;;;;;OAKG;IACI,2BAA2B,CAChC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,EAC3C,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;OAIG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C;;;;;OAKG;IACI,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD;;;;;OAKG;IACI,2BAA2B,CAChC,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;IAIlD;;OAEG;IACI,eAAe,IAAI,MAAM;CAGjC"}
@@ -34,8 +34,13 @@ export declare class SidebarAdapter {
34
34
  notifyPluginStatus(status: string, type?: PluginStatusType): Promise<void>;
35
35
  /**
36
36
  * Request sidebar to activate (expand and scroll to) the card for the given issue.
37
+ *
38
+ * @param documentReference - The document the issue belongs to. When it
39
+ * differs from the sidebar's currently displayed document, the sidebar
40
+ * switches to it before activating. Omitted or `null` means the
41
+ * sidebar's currently displayed document.
37
42
  */
38
- activateAgenticIssue(issueId: string): Promise<void>;
43
+ activateAgenticIssue(issueId: string, documentReference?: string | null): Promise<void>;
39
44
  /**
40
45
  * Request sidebar to invalidate (dismiss) the card for the given issue.
41
46
  */
@@ -75,6 +80,12 @@ export declare class SidebarAdapter {
75
80
  * `integrationSettings` in its `SidebarConfig`.
76
81
  */
77
82
  getIntegrationSettings(): Promise<IntegrationSettingsSnapshot>;
83
+ /**
84
+ * Notify the sidebar that the active document changed, for hosts that
85
+ * enable `multiDocument`. Pass `null` when there is no checkable document
86
+ * currently active. No-op if the sidebar has not registered a handler.
87
+ */
88
+ notifyActiveDocumentChanged(documentReference: string | null): Promise<void>;
78
89
  /**
79
90
  * Update IPC configuration
80
91
  */