@plannotator/ui 0.50.0 → 0.52.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/HANDOFF.md +295 -11
- package/README.md +8 -0
- package/components/AISettingsTab.tsx +32 -0
- package/components/AgentToolAnnouncementDialog.tsx +347 -0
- package/components/AgentsTab.tsx +9 -9
- package/components/AnnotationToolbar.tsx +2 -2
- package/components/AskSessionAnnouncementDialog.tsx +329 -0
- package/components/BlockRenderer.tsx +10 -1
- package/components/CommentPopover.tsx +36 -18
- package/components/CompletionOverlay.tsx +12 -5
- package/components/DecisionControl.tsx +2 -7
- package/components/DiagramBlock.tsx +46 -4
- package/components/DocBadges.tsx +12 -8
- package/components/FloatingQuickLabelPicker.tsx +2 -2
- package/components/PlanHeaderMenu.tsx +1 -1
- package/components/QuickLabelDropdown.tsx +9 -4
- package/components/ServerSessionReplacedBanner.tsx +29 -0
- package/components/Settings.tsx +76 -192
- package/components/TerminalToolsAnnouncementDialog.tsx +1 -1
- package/components/Viewer.tsx +30 -1
- package/components/ai/AIProviderBar.tsx +18 -1
- package/components/ai/DocumentAIChatPanel.tsx +4 -9
- package/components/ai/SessionAskNotice.tsx +33 -21
- package/components/blocks/QuestionBlock.tsx +99 -27
- package/components/blocks/QuestionContext.tsx +81 -0
- package/components/diagram/DiagramComposer.tsx +54 -3
- package/components/diagram/DiagramViewer.tsx +31 -2
- package/components/diagram/index.ts +1 -1
- package/components/html-viewer/HtmlViewer.tsx +13 -3
- package/components/html-viewer/bridge-script.asset.js +230 -14
- package/components/html-viewer/bridge-script.ts +230 -14
- package/components/html-viewer/useHtmlAnnotation.ts +36 -55
- package/components/settings/QuickLabelsTab.tsx +378 -0
- package/hooks/useAIChat.ts +83 -6
- package/hooks/useAIProviderActivation.ts +13 -0
- package/hooks/useAIProviderConfig.ts +3 -3
- package/hooks/useActiveSection.ts +3 -2
- package/hooks/useAgentToolSetting.ts +33 -0
- package/hooks/useAnnotationDraft.ts +53 -7
- package/hooks/useAnnotationHighlighter.ts +129 -5
- package/hooks/useExternalAnnotations.ts +21 -1
- package/hooks/useFirstRunAnnouncementWindow.ts +114 -0
- package/hooks/useLatchedTrue.ts +15 -0
- package/hooks/useLinkedDoc.ts +64 -4
- package/hooks/useModelCatalogs.ts +9 -2
- package/package.json +2 -2
- package/styles.css +1 -1
- package/themes/gruvbox.css +6 -0
- package/types.ts +19 -0
- package/utils/agentClosed.ts +33 -0
- package/utils/agentToolAnnouncement.ts +109 -0
- package/utils/agentToolSetting.ts +108 -0
- package/utils/aiProvider.ts +13 -40
- package/utils/annotationOwnsHighlight.ts +27 -0
- package/utils/annotationScope.ts +15 -0
- package/utils/askSessionAnnouncement.ts +107 -0
- package/utils/blockTargeting.ts +61 -2
- package/utils/diagramAskAI.ts +161 -0
- package/utils/parser.ts +382 -114
- package/utils/questionAnswers.ts +3 -1
- package/utils/quickLabels.ts +82 -2
- package/utils/serverSession.ts +85 -0
package/HANDOFF.md
CHANGED
|
@@ -95,7 +95,7 @@ Pass any subset of these to `configurePlannotatorUI({ ... })`. Anything omitted
|
|
|
95
95
|
| `mathRendererLoader` | `() => Promise<MathRenderer>` | How KaTeX is loaded when no renderer is registered before the first math node renders (see "Lazy renderers and eager entries"). Once registered, the package default is never called, not even as a fallback after a rejected load, and `resetMathRenderer()` keeps the registration (0.34.0); a default load already in flight at registration still fills the slot (pre-existing, see `setMathRendererLoader`), so register before the first math render | `utils/math-default-loader`'s `import('katex')`, JS only; CSS stays yours |
|
|
96
96
|
| `identityGenerator` | `() => string` | The synchronous generator behind the default "tater" display name when no `identityProvider` is installed | A built-in 16 x 16 word pool of the same `adjective-noun-tater` shape; Plannotator registers the full dictionary via `utils/identity-tater` |
|
|
97
97
|
| `alertIconRenderer` | `(name: string) => ReactNode | null` | The icon rendered for a GitHub alert whose title line carries `<!-- icon: name -->` (0.38.0; grammar in `utils/alertTitle`). Called only for a title line with an icon comment and no leading emoji; a null return falls back to the type icon | `null` for every name: the type's own icon, the package bundles no icon set |
|
|
98
|
-
| `fenceTheme` | `(colorTheme: string, mode: 'light' \| 'dark') => string \| undefined` | The Shiki theme every fence-style surface renders in (Viewer fences, `CodeBlock`, the code-file hover preview, the plan diff view, code review suggestion snippets: everything that reads `useFenceTheme` / `resolveFenceTheme`). Return a theme name to use it, `undefined` to keep the default for that (palette, mode); a throw or an empty string also falls through, and a name Shiki does not know renders the block as plain text. Install it before the first render; it is read on every render, so a later change applies the next time a fence re-renders. The code-review diff pane's dark/light pair (`resolveSyntaxTheme`) is not affected. Also `setFenceThemeResolver` / `resetFenceThemeResolver` on `utils/syntaxTheme` (
|
|
98
|
+
| `fenceTheme` | `(colorTheme: string, mode: 'light' \| 'dark') => string \| undefined` | The Shiki theme every fence-style surface renders in (Viewer fences, `CodeBlock`, the code-file hover preview, the plan diff view, code review suggestion snippets: everything that reads `useFenceTheme` / `resolveFenceTheme`). Return a theme name to use it, `undefined` to keep the default for that (palette, mode); a throw or an empty string also falls through, and a name Shiki does not know renders the block as plain text. Install it before the first render; it is read on every render, so a later change applies the next time a fence re-renders. The code-review diff pane's dark/light pair (`resolveSyntaxTheme`) is not affected. Also `setFenceThemeResolver` / `resetFenceThemeResolver` on `utils/syntaxTheme` (0.50.0) | The palette's `SHIKI_THEME_MAP` entry, else `pierre-dark` / `pierre-light`. Replaces mutating the exported `SHIKI_THEME_MAP`, which keeps working but is not a supported seam |
|
|
99
99
|
|
|
100
100
|
### Interface details worth knowing
|
|
101
101
|
|
|
@@ -109,7 +109,7 @@ Pass any subset of these to `configurePlannotatorUI({ ... })`. Anything omitted
|
|
|
109
109
|
|
|
110
110
|
**`UploadTransport`** — `upload(file: File): Promise<{ path: string; originalName? }>`. The default does Plannotator's `POST /api/upload` and returns the server path. For Workspaces, send the bytes to your asset API (`PUT /v1/workspaces/:wsId/assets/:assetPath`) and return the content-addressed URL (or an opaque ref) in `path`. Notes from the Workspaces asset layer: your API makes the **caller choose the asset path** and 409s if a document owns it, so your adapter — not the UI — owns path selection (namespace uploads, e.g. an `assets/` prefix); it enforces a **10 MiB cap + content-type allowlist**, so surface upload failures; and because asset URLs need **no signing** (content-addressed, served from the cookieless `tot.page` origin), `imageSrcResolver` can be a pass-through — returning a full URL in `path` renders directly (the default resolver passes http(s) URLs through).
|
|
111
111
|
|
|
112
|
-
**`DraftTransport`** — `load()`, `save(body, { keepalive })`, `remove(generation, { keepalive })`. The generation-gated tombstone and keepalive retry logic stay inside the hook; you only provide the three transport calls. `keepalive: true` means "best-effort deliver this even though the page is closing" (maps to `fetch(..., { keepalive: true })` or `navigator.sendBeacon`). One non-obvious contract on `load()`: it returns `{ data, generation }`, where `generation` is the **deletion tombstone counter** for the no-draft case — Plannotator's server encodes it in the 404 body so a stale tab can't resurrect a deleted draft. If your backend tracks draft deletions, return the tombstone generation with `data: null`; if it doesn't, return `{ data, generation: null }` and the hook still works (you just lose stale-tab deletion protection).
|
|
112
|
+
**`DraftTransport`** — `load()`, `save(body, { keepalive })`, `remove(generation, { keepalive })`. The generation-gated tombstone and keepalive retry logic stay inside the hook; you only provide the three transport calls. `keepalive: true` means "best-effort deliver this even though the page is closing" (maps to `fetch(..., { keepalive: true })` or `navigator.sendBeacon`). One non-obvious contract on `load()`: it returns `{ data, generation }`, where `generation` is the **deletion tombstone counter** for the no-draft case — Plannotator's server encodes it in the 404 body so a stale tab can't resurrect a deleted draft. If your backend tracks draft deletions, return the tombstone generation with `data: null`; if it doesn't, return `{ data, generation: null }` and the hook still works (you just lose stale-tab deletion protection). Optionally, `save()` may resolve `{ staleGeneration }` when your store refused the body as stale (Plannotator's server answers `409 { draftGeneration }`); the hook then raises its counter above that generation and saves once more. Resolving nothing (the old `Promise<void>`) keeps the previous behavior.
|
|
113
113
|
|
|
114
114
|
**`ExternalAnnotationTransport<T>`** — `subscribe(onEvent, onError) => unsubscribe`, `getSnapshot(since) => { annotations, version } | null` (return `null` for "no changes", i.e. the 304 case), plus `add/remove/update/clear`. For Workspaces this is your realtime layer — a Durable Object WebSocket or SSE fanning out comment events. `T` extends `{ id: string; source?: string }`; if your annotation type adds fields, call `setExternalAnnotationTransport<YourType>()` directly for full type safety (the `configure` front door pins the base type for ergonomics).
|
|
115
115
|
|
|
@@ -1636,25 +1636,91 @@ Additive. What a host that keeps question answers ITSELF needs (Workspaces store
|
|
|
1636
1636
|
|
|
1637
1637
|
Not here (dropped with the owner's Q2 answer): record lines inside the block (`Other:`, `Answer:`, `Note:`, `Answered:`) and a `writeQuestionAnswer` byte rewriter.
|
|
1638
1638
|
|
|
1639
|
-
## Fence theme seam and srcdoc frame height (
|
|
1639
|
+
## Fence theme seam and srcdoc frame height (0.50.0)
|
|
1640
1640
|
|
|
1641
1641
|
Additive; Plannotator passes nothing, so its output is unchanged.
|
|
1642
1642
|
|
|
1643
1643
|
- **`fenceTheme` on `configurePlannotatorUI`** (row in the seam catalog above; `FenceThemeResolver` type exported from `configure` and `utils/syntaxTheme`). Hosts that mutated `SHIKI_THEME_MAP` to pick their own code colors should move to it.
|
|
1644
1644
|
- **`HtmlViewer` frame height.** The bridge measured `document.body.scrollHeight`, which leaves out a first child's top margin (and a last child's bottom margin) that collapses through a margin-less body, so a page like `body{margin:0}` + a card with `margin-top` was cut short by its margins. It now measures body's box in document coordinates plus the bottom margins that can collapse through it (`measureContentHeight` in `bridge-script.ts`). It deliberately does not use `documentElement.scrollHeight`: that never drops below the frame's own viewport (and an `html{height:100%}` root is the frame's height), so the frame could grow but never shrink. Content sized by the frame itself (`html,body{height:100%}`, `min-height:100vh`, a `100vh` section) plus a margin around it always measures taller than the frame, so a feedback guard (`nextResizeHeight`) stops growing when the first measure after a grow the parent applied still overflows by as much as before: such a page settles one or two grows above its old height (e.g. 600 → 640) instead of growing forever, and a later content change still resizes the frame. Absolutely positioned content whose containing block is the root (not body) is still not measured, as before. No `BRIDGE_PROTOCOL_VERSION` bump: the `resize` message shape is unchanged, only the value is more accurate, so a cached older asset keeps the old measure and nothing misreads.
|
|
1645
1645
|
|
|
1646
|
-
## Ask this session (
|
|
1646
|
+
## Ask this session (shipped in 0.50.0; bridge-only change in 0.51.0, BREAKING for 0.50.0 consumers)
|
|
1647
1647
|
|
|
1648
|
-
|
|
1648
|
+
Ask AI can be answered by the agent session that opened Plannotator ("Ask this session"), when the server registers a `session-bridge` provider. A host whose backend never advertises one sees the same provider list, default selection, requests and DOM as before, and has nothing to pass.
|
|
1649
1649
|
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
- **`
|
|
1653
|
-
- **`components/ai/SessionAskNotice
|
|
1654
|
-
-
|
|
1650
|
+
As shipped in 0.50.0 the bridge sat beside the SDK providers: an explicit saved pick won over it, and a gone or blocked session offered "Ask a separate AI instead". **ui 0.51.0 makes the bridge the ONLY Ask AI choice** (Plannotator's servers now register nothing else for Ask AI while a bridge is present):
|
|
1651
|
+
|
|
1652
|
+
- **`utils/aiProvider`:** `resolveAIProviderSelection` selects a bridge in the list in every status (ready, busy, blocked, gone), ahead of any saved pick; the saved cookies are not rewritten, and with no bridge in the list the order is unchanged. New export `findSessionBridge(providers)`. Kept from 0.50.0: `AIProviderOption.label` / `sessionBridge`, `SESSION_BRIDGE_PROVIDER_NAME`, `SESSION_ASK_ERROR_CODES`, `isSessionBridgeProvider`.
|
|
1653
|
+
- **`components/ai/SessionAskNotice`:** `SessionAskActions` keeps the busy actions ("Ask when it finishes" / "Interrupt and ask now", rendered only with `onAction`); for a gone or blocked session it renders a plain note (`[data-session-ask-unreachable]`, with or without `onAction`) instead of a fallback button.
|
|
1654
|
+
- **Pickers:** with a bridge in the list, `AIProviderBar` renders only the bridge label (`[data-ai-provider-session-bridge]`, no `<select>`), and `AISettingsTab` shows the bridge read-only and writes nothing.
|
|
1655
|
+
- **`hooks/useAIProviderActivation`:** additive. New optional `providers?: ReadonlyArray<{ id }>` option, the Ask AI providers the server currently lists: an id not in it is never activated (at page load a saved id such as `codex-sdk` can sit in the selection for one render before the resolver moves it to the bridge, and activating it would start model discovery Ask AI does not offer). Omitted keeps the old behavior.
|
|
1656
|
+
- **`hooks/useModelCatalogs`:** additive. The launchers' catalog loader also reads `catalogProviders` from `/api/ai/capabilities?activate=<id>`, which a bridged Plannotator server uses to report the Claude / Codex catalogs without listing those providers for Ask AI. A backend that never sends the field behaves as before.
|
|
1657
|
+
|
|
1658
|
+
**Removed (BREAKING for consumers of 0.50.0):**
|
|
1659
|
+
|
|
1660
|
+
| Removed | Use instead |
|
|
1661
|
+
| --- | --- |
|
|
1662
|
+
| `findUsableSessionBridge` (`utils/aiProvider`) | `findSessionBridge`; the bridge is selected whatever its status |
|
|
1663
|
+
| `resolveSessionBridgeFallback` (`utils/aiProvider`) | nothing: there is no other Ask AI provider while a bridge is present |
|
|
1664
|
+
| `'fallback'` member of `SessionAskAction` (`components/ai/SessionAskNotice`) | nothing: it is now `'wait' \| 'interrupt'` |
|
|
1665
|
+
| `fallbackLabel` prop of `SessionAskActions` | nothing: gone/blocked render the note |
|
|
1666
|
+
| `sessionAskFallbackLabel` prop of `DocumentAIChatPanel` | nothing |
|
|
1667
|
+
|
|
1668
|
+
Unchanged from 0.50.0: `hooks/useAIChat` (`AskAIParams.busyPolicy`, `retry(questionId, AIRetryOptions)`, `AIResponse.errorCode` / `status`; `AIRetryOptions.providerId` still exists for hosts that offer another provider), `hooks/useAIProviderConfig`'s `applyConfigChange(config, { persist: false })`, and `components/ProviderIcons`' `getProviderMeta(name, label?)`.
|
|
1669
|
+
|
|
1670
|
+
Also in 0.51.0 (#1703, additive): an answer the session stopped because another message took its turn over arrives as the error code `session_taken_over` (`SESSION_ASK_ERROR_CODES.takenOver`). `useAIChat` no longer treats it as an error: the streamed text stays, `AIResponse.notice` carries the server's note, `error` stays unset, and `DocumentAIChatPanel` renders the note under the answer through the new `SessionAskNote` (`components/ai/SessionAskNotice`, `[data-session-ask-note="taken-over"]`). A backend that never sends the code sees no change.
|
|
1671
|
+
|
|
1672
|
+
## Questions, restore, drafts and the rest (ui 0.51.0, core 0.25.11)
|
|
1673
|
+
|
|
1674
|
+
Everything host-facing that changed between ui 0.50.0 / core 0.25.10 and this pair, apart from the three sections above (Ask this session, composer trim, diagram Ask AI). Plannotator's own app needs nothing; a host that passes nothing new gets the fixes below and the noted behavior changes.
|
|
1675
|
+
|
|
1676
|
+
**Question cards (#1683, #1699, #1702).**
|
|
1677
|
+
|
|
1678
|
+
- **Pinpoint inside a card targets what was clicked (#1683).** The card (`fieldset.question-block`) is now one block target whose prompt, context and each choice's text are child targets, marked `data-question-part="prompt" | "context" | "choice"`. Before, every pinpoint hover or click in a card resolved to the prompt. Clicking the radio/checkbox still answers.
|
|
1679
|
+
- **Plain-bullet choices keep their wrapped lines (#1699, core).** A `:::question` / `:::question-multi` with no task-list items reads each plain bullet the way CommonMark reads a list item (indented lines, lazy lines, an indented paragraph after a blank line), and those lines no longer leak into `context`. A bullet written `- **Name:** prose` (bold name set off by punctuation, `**` only) takes `Name` as its label and the prose as its description; a label longer than `MAX_QUESTION_CHOICE_LABEL_CHARS` (200) is cut at its first sentence, the rest leading the description; two bullets never end up with the same label. A `Recommended:` line continues onto the next line only when that line wraps the same sentence. **Task-list choices (`- [ ]`) parse exactly as before**, and `questionKey` does not change.
|
|
1680
|
+
- **Behavior change for hosts that store answers themselves:** the labels of PLAIN-BULLET choices can differ from what core 0.25.10 produced (the wrapped text joins the label, or a bold lead becomes the label). An answer stores the labels it picked, so core 0.25.11 adds **`QuestionChoice.aliases?: string[]`** (the older names of a plain-bullet choice: its full text, its first line, that line's earlier label) and **`canonicalQuestionAnswer(question, answer)`** (`@plannotator/core/question-block`), which maps a stored label that names exactly one choice by an alias to its current label and returns the same object when nothing maps; an ambiguous label stays as stored. `QuestionBlock`, the Questions panel rows (`utils/questionAnswers`), WebMCP `read_document` and `formatQuestionAnswersSection` all read answers through it, so a host that renders `QuestionBlock` with its stored answer sees the right pick without changes. **A host that reads stored answers on its own (turning an answer into a decision, its own export) should run them through `canonicalQuestionAnswer` too.** `QuestionExportItem` gains an optional `choices` (label + aliases) so the export prints current labels.
|
|
1681
|
+
- **Context renders with the document's block renderers (#1699).** A card's context goes through `parseMarkdownToBlocks` + `BlockRenderer` (new `components/blocks/QuestionContext`), so tables, lists, fences, quotes, headings and images look as they do in the document. Those blocks carry no `data-block-id`. Its styles are a `<style href="plannotator-question-context" precedence="default">` that React 19 hoists into `<head>` once, so a host needs no Tailwind change. `useActiveSection` observes only headings that have a block id, so a heading inside a card never stalls the table of contents.
|
|
1682
|
+
|
|
1683
|
+
**Restore after an edit (#1717).**
|
|
1684
|
+
|
|
1685
|
+
- **`AnnotationRestoreReport.moved?: RestoredAnchor[]`** (`hooks/useAnnotationHighlighter`, additive): when a restore re-anchors comments by their text after the document changed, each comment whose stored `blockId` no longer holds its text is listed with `{ id, blockId, startOffset?, positionsStale }`, where `blockId` is the block the highlight landed in or `''` when the text is gone, and `positionsStale` says the stored `startMeta`/`endMeta` should be dropped. An unchanged document reports nothing here. **A host that derives line numbers from `blockId` (an export, a gutter) should write these back**; Plannotator does so in `packages/editor/restoredAnchors.ts`. A restore that paints nothing is now reported unanchored even when there were no stored positions to try.
|
|
1686
|
+
- **`utils/annotationOwnsHighlight`** (new): `annotationOwnsHighlight(annotation)` is false for diff-view comments, general comments, checkbox toggles (`CHECKBOX_ANNOTATION_PREFIX`) and question answers, which the text highlighter never draws. The highlighter skips them itself; a host that re-applies a stored list through `ViewerHandle.applySharedAnnotations` should filter with it, as `useLinkedDoc` now does, or those rows come back unanchored.
|
|
1687
|
+
|
|
1688
|
+
**Drafts (#1710).** `DraftTransport.save` may now resolve `{ staleGeneration }` (`DraftSaveRefused`, `hooks/useAnnotationDraft`) when the store refused the body as stale; the hook raises its counter above that generation and saves once more. Resolving nothing (the old `Promise<void>`) keeps the old behavior, so a host transport needs no change. Also documented in the seam catalog above. The hook's return value gains `flushPendingSave()`, which sends a pending debounced save now. Plannotator's DEFAULT transport now reads a `409 { draftGeneration }` as that refusal (never when the body says `decided: true`).
|
|
1689
|
+
|
|
1690
|
+
**The agent closes a review (#1709).** `ExternalAnnotationEvent` (`@plannotator/core/external-annotation`) gains a member that is not an annotation change: `{ type: "session-closed"; by: "agent"; unsentAnnotations: number }`. `useExternalAnnotations` takes an optional `onSessionClosed({ unsentAnnotations })` and calls it when the stream delivers that event (the polling fallback never does). A host transport that never emits it is unaffected. **A host with an exhaustive `switch` over `ExternalAnnotationEvent['type']` (a `never` check) must add the case.** `utils/agentClosed` (new) holds the copy Plannotator shows (`AGENT_CLOSED_TITLE`, `agentClosedSubtitle(count, surface)`).
|
|
1691
|
+
|
|
1692
|
+
**HTML pinpoints and exports (#1694, #1700).**
|
|
1693
|
+
|
|
1694
|
+
- A text-less pinpoint's quote (`originalText`) now names the element, not just its kind: `[element: Image "Team photo" (team.jpg)]` instead of `[element: Image]` (hover label, accessible name, and for media the scrubbed file name). Restore never reads the quote, so older pins keep restoring.
|
|
1695
|
+
- `HtmlElementContext.sourceName?` (ui `types` and core `html-anchor`, additive, validated by `parseHtmlElementContext`): the file a media element shows, resolved by the bridge the same way the quote names it. The export heading reads it, falling back to the `src` attribute for older contexts. Core exports the shed order as `ELEMENT_CONTEXT_SHED_ORDER`; `sourceName` is shed last.
|
|
1696
|
+
- Ask AI from an HTML pinpoint composer sends the element's identity: `CommentAskAIContext.detail?` / `AIQuestion.scope.detail?` (additive), built by the new `elementIdentityForAskAI(targets)` (`utils/parser`), which `buildDefaultPrompt` appends under "Selected element:". It is not shown in the chat.
|
|
1697
|
+
- Export order: comments made in the plan/version diff view (`blockId` `diff-block-N`) now print AFTER the document's other comments, in diff order (they printed first). A list with no diff comments sorts exactly as before.
|
|
1698
|
+
|
|
1699
|
+
**Linked documents and several-file reviews (#1696, #1718).**
|
|
1700
|
+
|
|
1701
|
+
- `useLinkedDoc` gains `getFeedbackDocuments()` → `FeedbackDocuments { root, documents }`: the root once and every other document once. `getDocAnnotations()` also carries the active document's live state (for counts), so an export that used it beside the host's own live annotations printed the open document twice. Export from `getFeedbackDocuments()`.
|
|
1702
|
+
- `exportLinkedDocAnnotations(docAnnotations, heading?)` takes an optional heading (`LINKED_DOC_EXPORT_HEADING` default, `FOLDER_DOC_EXPORT_HEADING`, `BUNDLE_DOC_EXPORT_HEADING`) and renders every document through the same entry renderer as `exportAnnotations`: document order, `[In diff content]`, quick labels with their tip and Label Summary, threaded replies. Plain comment, deletion and global output is unchanged.
|
|
1703
|
+
- `groupAnnotationsByDocument` / `buildAnnotationDocumentGroups` (`utils/annotationScope`) take an optional fixed `order` of paths. `DocBadges`' `linkedDocInfo.onBack` is optional (absent: no Close pill). `PlanHeaderMenu` item ids gain `'bundle-previous' | 'bundle-next'`. Core: `AnnotateAgentTerminalMode` gains `"annotate-bundle"` (and `supportsAnnotateAgentTerminalMode` accepts it; the type already includes `string`, so no `never` switch over it can break); `AnnotateContext.bundlePosition?: { index, total }`.
|
|
1704
|
+
|
|
1705
|
+
**Agent tool switch and offer (#1725, ui only).** Additive; a host whose server never sends the fields sees no row and no offer.
|
|
1706
|
+
|
|
1707
|
+
- **`Settings`** takes optional `agentToolSetting?: AgentToolSetting` and `onAgentToolChange?: (enabled: boolean) => Promise<void>`. Only when BOTH are passed does General render the row `[data-agent-tool-setting="<host>"]` ("Let the agent open reviews (plannotator tool)"). A rejected `onAgentToolChange` shows its message in `[data-agent-tool-setting-error]`; the switch is disabled when `setting.env` is set (`PLANNOTATOR_AGENT_TOOL` decides).
|
|
1708
|
+
- **`utils/agentToolSetting`** (new): `AgentToolHost` (`'claude-code' | 'pi' | 'opencode'`), `AgentToolSetting` (`host`, `enabled`, `configured`, `env?`), `parseAgentToolSetting(serverConfig)`, `withSavedAgentTool(setting, value)`, `saveAgentToolSetting(value, fetchImpl?)` (POST `/api/config` `{ agentTool }`, rejects with a readable message unless the server confirms), and the copy helpers `agentToolHostName`, `agentToolAppliesWhen`, `agentToolCostNote`. `parseAgentToolSetting` returns `undefined` unless the server config carries `agentToolHost` and a boolean `agentToolEnabled`, so a Workspaces-style backend gets nothing to render.
|
|
1709
|
+
- **`hooks/useAgentToolSetting`** (new): `{ setting, adopt(serverConfig), save(enabled) }`, the shared state the Settings row and the offer read: `adopt` takes the fields from a `/api/plan` or `/api/diff` `serverConfig`, `save` calls `saveAgentToolSetting` and then `withSavedAgentTool`.
|
|
1710
|
+
- **`utils/agentToolAnnouncement`** (new, cookie gate for the one-time offer: `needsAgentToolAnnouncement`, `markAgentToolAnnouncementSeen`, `agentToolAnnouncementPendingThisLoad`, `agentToolOfferApplies`, `agentToolOfferHostOf`, `agentToolAnnouncementEligible`) and **`components/AgentToolAnnouncementDialog`** (new): the one-time offer to turn the tool on, shown on Pi and OpenCode 2. Nothing in the library mounts it; Plannotator's apps do.
|
|
1711
|
+
|
|
1712
|
+
**Internal exports, deliberately not supported.** `XMark` (`components/TerminalToolsAnnouncementDialog`, exported in #1690 so the announcement dialogs share one close icon) and `hooks/useLatchedTrue` (#1725, the apps' "an announcement was shown on this load" latch) are exported only so Plannotator's own components and apps can share them. They are not seams, carry no compatibility promise, and may change or move in any release; a host should not import them.
|
|
1713
|
+
|
|
1714
|
+
**Smaller changes.**
|
|
1715
|
+
|
|
1716
|
+
- **`DecisionControl` / `DecisionNoteDialog` (#1711):** the keyboard hint under the decision note composer is gone; keys unchanged.
|
|
1717
|
+
- **Pi thinking levels (#1704):** core `model-catalog` adds `PI_THINKING_LEVELS`, `PI_SESSION_SCOPED_THINKING_VERSION`, `piThinkingLevelsSupported`, `piSupportedThinkingLevels`, `piCatalogFromRpc`, `PiRpcModel`, and an `off` entry in `EFFORT_LABELS`. `AgentsTab`'s `PI_THINKING` is now derived from them (same values and labels as before).
|
|
1718
|
+
- **"Ask this session" announcement (#1690):** new `components/AskSessionAnnouncementDialog`, `utils/askSessionAnnouncement` (cookie `plannotator-announce-ask-session-seen`) and `hooks/useFirstRunAnnouncementWindow`. Plannotator's apps mount it; nothing in the library mounts it for a host.
|
|
1719
|
+
- **gruvbox palette (#1721):** sets `--diffs-addition-color-override` (dark `#b8bb26`, light `#79740e`), so added diff lines draw in gruvbox green instead of the text colour. This changed the guides.show viewer stylesheet (see "Publishing & versioning").
|
|
1655
1720
|
|
|
1656
1721
|
## Publishing & versioning
|
|
1657
1722
|
|
|
1723
|
+
- **core 0.25.11 / ui 0.51.0: both change. Order: guides.show deploy, then `core` 0.25.11, then `ui` 0.51.0.** ui imports `canonicalQuestionAnswer` and `PI_THINKING_LEVELS`, which no published core before 0.25.11 has, and pins core `0.25.11` exactly. core 0.25.11 pins a new guides.show viewer stylesheet (`viewer.DuqkfIUz.css`, from the gruvbox fix #1721; the viewer JS `viewer.BYGvfCcj.js` is unchanged), which guides.show serves only after a deploy, so run the deploy by hand first (next bullet). **ui 0.51.0 is BREAKING for 0.50.0 consumers of the "Ask this session" exports**: it removes `findUsableSessionBridge`, `resolveSessionBridgeFallback`, the `'fallback'` `SessionAskAction` member, `SessionAskActions`' `fallbackLabel` and `DocumentAIChatPanel`'s `sessionAskFallbackLabel`, and makes a listed bridge the only Ask AI selection. Release notes must say so. Everything else is additive or a fix (including #1725's agent tool switch and offer); see "Ask this session (shipped in 0.50.0; …)", "Comment composer trim (0.51.0; …)", "Ask AI from a diagram comment (0.51.0; …)" and "Questions, restore, drafts and the rest (ui 0.51.0, core 0.25.11)".
|
|
1658
1724
|
- **guides.show before a core publish that moves the viewer pin.** guides.show deploys on Plannotator release tags only. When a core publish carries a new `guide-viewer-manifest` hash (any change to the shared CSS or the guide chain) and no release tag has shipped it yet, run the deploy by hand first (`gh workflow run guides-show-deploy.yml --ref main`), then check that `curl -I https://guides.show/v1/<css>` and `<js>` from the manifest answer 200. Otherwise every host's guide pages load without that asset (core 0.25.9 hit this; fixed by a manual deploy). The deploy is add-only.
|
|
1659
1725
|
- **core 0.25.9 / ui 0.49.0 (question host seams): both change. Publish `core` first**: ui imports the new `@plannotator/core/markdown-structure` subpath and the new `findQuestionBlocks` / decision fields, so a ui on a published core 0.25.8 fails to compile in a consumer. See "Question host seams (ui 0.49.0, core 0.25.9)".
|
|
1660
1726
|
- **core 0.25.8 / ui 0.48.0 (questions in documents): both change. Publish `core` 0.25.8 first, then `ui` 0.48.0**, which pins core `0.25.8` exactly and imports the new `@plannotator/core/question-block` subpath. Core is a patch bump because its change is additive and pre-1.0 caret ranges would not accept a minor. See "Questions in documents (0.48.0, core 0.25.8)".
|
|
@@ -1700,7 +1766,7 @@ unaffected by the prop. Purely additive: no export, share or archive change.
|
|
|
1700
1766
|
|
|
1701
1767
|
---
|
|
1702
1768
|
|
|
1703
|
-
## Diff file tree (
|
|
1769
|
+
## Diff file tree (0.50.0; no core change)
|
|
1704
1770
|
|
|
1705
1771
|
Asked for by a host that shows a read-only per-file diff list (one Pierre
|
|
1706
1772
|
`FileDiff` per file) and wants Plannotator's file tree beside it. The tree used
|
|
@@ -1745,6 +1811,224 @@ this branch with the same static patch (merged chains, A/D/R/M marks, nested
|
|
|
1745
1811
|
folders), at rest, after two `j` presses and after collapsing a folder: the
|
|
1746
1812
|
sidebar screenshots and its `outerHTML` were byte-identical.
|
|
1747
1813
|
|
|
1814
|
+
## Comment composer trim (0.51.0; not breaking)
|
|
1815
|
+
|
|
1816
|
+
The visible submit hint added noise and is gone from `components/CommentPopover`.
|
|
1817
|
+
The composer's one-click thumbs-up was removed in the same change and then
|
|
1818
|
+
brought back before any release, so hosts see no API change for it.
|
|
1819
|
+
|
|
1820
|
+
- **Submit hint text removed** from both composer footers (popover and
|
|
1821
|
+
dialog): the `⌘↵` / `Ctrl+Enter` label no longer renders. The keyboard
|
|
1822
|
+
behavior is unchanged: `Mod+Enter` still saves.
|
|
1823
|
+
- **`onQuickLookGood` stays** on `CommentPopover` (published in 0.32.0), with
|
|
1824
|
+
the same contract: optional, absent renders nothing, the parent owns
|
|
1825
|
+
creation and closing, disabled once anything is typed or attached. Only its
|
|
1826
|
+
look changed: it is now an emoji-only 👍 button beside Save (no "Looks
|
|
1827
|
+
good" text), named "Looks good" through `aria-label` and its tooltip, marked
|
|
1828
|
+
`data-quick-look-good`. It takes no key; `Mod+Enter` still saves. Like
|
|
1829
|
+
Save, a click clears the `draftKey` draft and returns focus to the opener.
|
|
1830
|
+
Its classes are all ones the pinned guides.show viewer CSS already has (the
|
|
1831
|
+
disabled grey-out is an inline filter), so it does not change that bundle.
|
|
1832
|
+
Why it is
|
|
1833
|
+
needed: a pinpoint click on an HTML / live-app element opens this composer
|
|
1834
|
+
directly and never shows the selection toolbar, so without it an element
|
|
1835
|
+
cannot get a one-click thumbs-up.
|
|
1836
|
+
- **`handleCommentLooksGood` stays** on the `useHtmlAnnotation` return value
|
|
1837
|
+
(`components/html-viewer`), and `HtmlViewer` still passes it, so hosts that
|
|
1838
|
+
render `HtmlViewer` keep the button exactly as in 0.32.0 to 0.50.0. It now
|
|
1839
|
+
shares one commit path with `handleCommentSubmit` (`commitComposerDraft`),
|
|
1840
|
+
so the 👍 carries the same anchor, element context and shift-click extra
|
|
1841
|
+
targets as a typed comment.
|
|
1842
|
+
|
|
1843
|
+
`THUMBS_UP_LABEL` (`utils/quickLabels`) stays exported; the toolbar path,
|
|
1844
|
+
the composer path and `HtmlViewer`'s id filter use it. The trust-boundary
|
|
1845
|
+
clamp is untouched.
|
|
1846
|
+
|
|
1847
|
+
---
|
|
1848
|
+
|
|
1849
|
+
## Ask AI from a diagram comment (0.51.0; additive, no core change)
|
|
1850
|
+
|
|
1851
|
+
The diagram composer can offer the same "Ask AI" the markdown and HTML
|
|
1852
|
+
composers offer. All new props are optional; a host that passes none of them
|
|
1853
|
+
renders the composer it had (Cancel + Comment, no Ask AI).
|
|
1854
|
+
|
|
1855
|
+
- **`DiagramViewer` / `DiagramPopout` `onAskAI?: DiagramAskAI`** —
|
|
1856
|
+
`(question, anchor, additionalTargets) => boolean | void | Promise<boolean | void>`.
|
|
1857
|
+
`anchor` is the `DiagramAnchor` a comment on that part would carry
|
|
1858
|
+
(`sourceLine` already in document lines). Resolve `false` (or throw) to keep
|
|
1859
|
+
the draft open; anything else closes the composer. The button is disabled
|
|
1860
|
+
until text is typed and has no key binding: Enter stays Comment.
|
|
1861
|
+
- **`MermaidBlock` / `GraphvizBlock` (`DiagramBlockProps`) `onAskAI?: CommentAskAIHandler`**
|
|
1862
|
+
and **`askAISourcePath?: string`** — the same handler `Viewer` /
|
|
1863
|
+
`CommentPopover` take. The block builds the `CommentAskAIContext` with
|
|
1864
|
+
`utils/diagramAskAI`'s `diagramAskAIContext`: `kind: 'selection'`, label
|
|
1865
|
+
`"Mermaid diagram node D"`, `text` = the part's label, and `detail` = the
|
|
1866
|
+
export's location line (`diagramAnchorLocationLine`), the engine and family,
|
|
1867
|
+
and the diagram source (bounded to 40 lines / 4000 chars, grown outward
|
|
1868
|
+
from the part's line so the part is always in it; a single line over the
|
|
1869
|
+
budget is cut with `…`) in document lines. `detail` is the #1694 field that
|
|
1870
|
+
`buildDefaultPrompt` puts on the user message before the question. Ignored
|
|
1871
|
+
when `readOnly`. A question asked in the popout closes the popout, since it
|
|
1872
|
+
covers the panel the answer streams into.
|
|
1873
|
+
- **`Viewer`** forwards its existing `onAskAI` to its diagram fences (and the
|
|
1874
|
+
`sourcePath` it already sends from the markdown composer), so a host that
|
|
1875
|
+
passes `onAskAI` to `Viewer` gets Ask AI on diagram comments too. A host
|
|
1876
|
+
that wants Ask AI on text but not on diagrams has no switch for that yet.
|
|
1877
|
+
|
|
1878
|
+
Pinned by `components/DiagramBlock.askAI.test.tsx` and
|
|
1879
|
+
`utils/diagramAskAI.test.ts`.
|
|
1880
|
+
|
|
1881
|
+
---
|
|
1882
|
+
|
|
1883
|
+
## Ask AI names a text selection's source lines (unreleased; additive, no core change)
|
|
1884
|
+
|
|
1885
|
+
An Ask AI question asked from a markdown text selection now says which
|
|
1886
|
+
source lines the selection is on, so a phrase that occurs more than once in
|
|
1887
|
+
the document is no longer ambiguous (#1731). Nothing to pass; a host that
|
|
1888
|
+
ignores the new fields keeps working.
|
|
1889
|
+
|
|
1890
|
+
- **`CommentAskAIContext.lineStart?` / `lineEnd?`** and
|
|
1891
|
+
**`AIQuestion.scope.lineStart?` / `lineEnd?`** (1-based, additive). `Viewer`
|
|
1892
|
+
fills them on the context its text-selection composer and its code-block
|
|
1893
|
+
composer hand to `onAskAI`: the span of the enclosing block, which for a
|
|
1894
|
+
selection within one block is the same span the exported annotation from
|
|
1895
|
+
that selection prints as `(line 41)` / `(lines 41–44)`. A selection over
|
|
1896
|
+
several blocks gives a range from the first block's start line to the last
|
|
1897
|
+
block's end line, while the export names only the first block. The global
|
|
1898
|
+
composer, HTML / live-app
|
|
1899
|
+
pinpoints and diagram comments carry none (diagrams already send their line
|
|
1900
|
+
in `detail`).
|
|
1901
|
+
- **`buildDefaultPrompt`** appends them to the `Source:` line:
|
|
1902
|
+
`Source: /docs/plan.md, line 41` or `Source: /docs/plan.md, lines 41–44`
|
|
1903
|
+
(`Source: line 41` with no `sourcePath`). A scope without them, or with a
|
|
1904
|
+
value that is not a positive integer, prints exactly what it printed before.
|
|
1905
|
+
A host that maps `CommentAskAIContext` onto `AIQuestion.scope` field by
|
|
1906
|
+
field must copy the two fields to get the line into the question.
|
|
1907
|
+
- **New pure helper `selectionSourceLines(blocks, blockIds)`** (`utils/parser`)
|
|
1908
|
+
returns `{ lineStart, lineEnd }` or `null`.
|
|
1909
|
+
- **`CommentPopoverState.blockIds?`** (`hooks/useAnnotationHighlighter`,
|
|
1910
|
+
additive): the `data-block-id`s the pending selection covers, which is what
|
|
1911
|
+
`Viewer` maps to lines.
|
|
1912
|
+
|
|
1913
|
+
Lines are document lines of the markdown the `Viewer` was given (frontmatter
|
|
1914
|
+
counted). Plannotator drops them for a converted HTML / URL source, whose
|
|
1915
|
+
converted markdown lines do not exist in the original file (its mapping is
|
|
1916
|
+
`packages/editor/askScope.ts`, pinned by `askScope.test.ts`). Pinned by
|
|
1917
|
+
`components/Viewer.askAISelectionLine.test.tsx` (DOM-gated),
|
|
1918
|
+
`utils/parser.selectionLines.test.ts` (including parity with the export
|
|
1919
|
+
heading for single-block selections) and `utils/aiPrompt.test.ts`.
|
|
1920
|
+
|
|
1921
|
+
---
|
|
1922
|
+
|
|
1923
|
+
## `CompletionOverlay` `done` state (unreleased; additive)
|
|
1924
|
+
|
|
1925
|
+
`submitted` accepts a new value, `'done'`: the session finished with nothing
|
|
1926
|
+
sent (Plannotator uses it for an annotate Done with nothing to send). It
|
|
1927
|
+
renders a neutral check icon; the host still supplies the title and subtitle.
|
|
1928
|
+
`ComponentProps<typeof CompletionOverlay>['submitted']` therefore now includes
|
|
1929
|
+
`'done'`, so a host that switches exhaustively over that type gets one more
|
|
1930
|
+
case to handle.
|
|
1931
|
+
|
|
1932
|
+
Neither `'done'` nor `'exited'` (Close) renders the footer's "Your response
|
|
1933
|
+
has been sent." line any more, since neither sends anything. That line only
|
|
1934
|
+
appears in the auto-close `closed` phase (an immediate auto-close whose close
|
|
1935
|
+
request went to a host window such as Glimpse or the VS Code panel's parent),
|
|
1936
|
+
so this is a visible change for `'exited'` only there. Every other value
|
|
1937
|
+
renders exactly as before. The overlay root now carries
|
|
1938
|
+
`data-completion-state={submitted}`.
|
|
1939
|
+
|
|
1940
|
+
## Quick Labels: reorder and editable emoji (unreleased; additive, no core change)
|
|
1941
|
+
|
|
1942
|
+
Settings → Labels (#1736) lets a person move a label up or down (per-row
|
|
1943
|
+
buttons, `aria-label="Move <text> up|down"`, a polite live region announces
|
|
1944
|
+
the new position and key) and change its emoji (a one-emoji field; anything
|
|
1945
|
+
that is not exactly one emoji is shown invalid, never saved, and reverts on
|
|
1946
|
+
blur). The tab now lives in `components/settings/QuickLabelsTab` and
|
|
1947
|
+
`Settings` renders it; nothing about `Settings`' props changed.
|
|
1948
|
+
|
|
1949
|
+
**The persisted shape is unchanged.** Labels are still saved as
|
|
1950
|
+
`QuickLabel[]` under `plannotator-quick-labels` through the storage backend,
|
|
1951
|
+
with the same fields; a reorder is just a different array order and an emoji
|
|
1952
|
+
edit a different `emoji` value. Rows get a stable identity for the editing
|
|
1953
|
+
session only (it is never written, so an older reader sees nothing new and the
|
|
1954
|
+
cookie does not grow). `QuickLabel.id` keeps its old meaning (derived from the
|
|
1955
|
+
text when the text is edited; `custom-<ts>` for new labels) and is still not
|
|
1956
|
+
unique: the list renderer `QuickLabelDropdown` now keys rows by position, so
|
|
1957
|
+
two labels with the same text no longer collide.
|
|
1958
|
+
|
|
1959
|
+
What a host should know:
|
|
1960
|
+
|
|
1961
|
+
- **Position is the key binding.** Alt/⌥1…9, 0 apply the label at positions
|
|
1962
|
+
1…10 (`quickLabelShortcutDigit` / `quickLabelIndexForDigit`); moving a label
|
|
1963
|
+
in Settings is what remaps its key. Lists are read once when a toolbar or
|
|
1964
|
+
picker mounts, so a change applies to the next selection.
|
|
1965
|
+
- **An annotation keeps the emoji it was created with.** The label is copied
|
|
1966
|
+
into the annotation as `${emoji} ${text}`; editing the emoji (like editing
|
|
1967
|
+
the text) affects only annotations created afterwards.
|
|
1968
|
+
- New pure exports in `utils/quickLabels`: `quickLabelShortcutDigit`,
|
|
1969
|
+
`quickLabelIndexForDigit`, `moveQuickLabel`, `parseQuickLabelEmoji` (one
|
|
1970
|
+
emoji grapheme, including ZWJ sequences, flags, keycaps and skin tones, or
|
|
1971
|
+
null) and `emojiFromFieldInput`. Nothing was removed or renamed.
|
|
1972
|
+
|
|
1973
|
+
## Question decision toggle and status tag (ui 0.52.0, unreleased; additive, no core change)
|
|
1974
|
+
|
|
1975
|
+
What Workspaces asked for: the reviewer can switch a `Decision: when answered`
|
|
1976
|
+
question's recording off and on from the card itself, and the host can draw
|
|
1977
|
+
its own status tag. Three optional props on `Viewer`, forwarded through
|
|
1978
|
+
`BlockRenderer` to `QuestionBlock` the way `renderQuestionFooter` is.
|
|
1979
|
+
Plannotator passes none of them, so its cards render exactly as before.
|
|
1980
|
+
|
|
1981
|
+
| `Viewer` | `BlockRenderer` | `QuestionBlock` |
|
|
1982
|
+
| --- | --- | --- |
|
|
1983
|
+
| `questionDecisionRecording?: (question: IndexedQuestion) => boolean \| undefined` | `questionDecisionRecording?: boolean` | `decisionRecording?: boolean` |
|
|
1984
|
+
| `onToggleQuestionDecisionRecording?: (key, next) => void` | same | `onToggleDecisionRecording?: (key, next) => void` |
|
|
1985
|
+
| `questionStatusTag?: 'card' \| 'none'` | same | `statusTag?: 'card' \| 'none'` |
|
|
1986
|
+
|
|
1987
|
+
- **Recording state** (`decisionRecording`, default `true`; on `Viewer` a
|
|
1988
|
+
function of the question, called per question card, so it can read your
|
|
1989
|
+
store by `question.question.key`). It applies only to a question carrying
|
|
1990
|
+
`Decision: when answered` (`decisionOnAnswer`) whose decision is not
|
|
1991
|
+
already recorded. Off draws the same "Records a decision" tag dimmed (in
|
|
1992
|
+
the theme's `--muted-foreground`, not by opacity, so it stays as legible as
|
|
1993
|
+
any secondary text) with a dotted outline and no fill (never different
|
|
1994
|
+
words), and hides the "Answering this
|
|
1995
|
+
records a decision" row (`[data-question-decision-row]`). A recorded
|
|
1996
|
+
decision (`Decision: [statement](url)`) and a question with no decision line
|
|
1997
|
+
are never affected.
|
|
1998
|
+
- **The toggle** (`onToggleDecisionRecording`): the tag becomes
|
|
1999
|
+
`<button type="button" aria-pressed>` with `[data-question-decision-toggle]`,
|
|
2000
|
+
keyboard operable, a focus ring (a ring, not an outline: the dotted outline
|
|
2001
|
+
draws the off state). A click calls the handler with the question's key and
|
|
2002
|
+
the NEXT state; the card does not keep the state itself, so pass it back
|
|
2003
|
+
through `decisionRecording` / `questionDecisionRecording`.
|
|
2004
|
+
- **Read-only cards never offer the toggle.** A card is read-only when it has
|
|
2005
|
+
no answer handler (`Viewer`: `readOnly`, or neither `onAnswerQuestion` nor
|
|
2006
|
+
`onSaveQuestionAnswer`); it draws the tag in its current state as a plain
|
|
2007
|
+
tag. `Viewer` also drops `onToggleQuestionDecisionRecording` under
|
|
2008
|
+
`readOnly`, like the answer handlers.
|
|
2009
|
+
- **`decisionRecording: false` without a handler** is honored: the static tag
|
|
2010
|
+
is drawn off and the row is hidden. Use it to show a state the reviewer may
|
|
2011
|
+
not change.
|
|
2012
|
+
- **Attributes.** `data-question-decision` keeps its values (`on-answer`,
|
|
2013
|
+
`recorded`) whatever the toggle says, so a selector keyed on the question's
|
|
2014
|
+
kind does not move. A separate `data-question-decision-recording="on" | "off"`
|
|
2015
|
+
appears on the card only for a `decisionOnAnswer` question when the host
|
|
2016
|
+
passed `decisionRecording` or the handler; a card with neither carries no
|
|
2017
|
+
new attribute.
|
|
2018
|
+
- **`statusTag: 'none'`** hides the card's own Open / Answered / Settled /
|
|
2019
|
+
Skipped tag; the decision tags ("Decision", "Records a decision") stay, and
|
|
2020
|
+
`data-question-status` still carries the status for your own tag.
|
|
2021
|
+
- **No stylesheet change.** The toggle reuses utility classes the package
|
|
2022
|
+
already ships, and the off state is an inline style, so `styles.css` and
|
|
2023
|
+
the guides.show viewer manifest are unchanged (no guides.show deploy needed
|
|
2024
|
+
for this).
|
|
2025
|
+
|
|
2026
|
+
Pinned by `components/blocks/QuestionBlock.decisionToggle.test.tsx`
|
|
2027
|
+
(DOM-gated): the toggle's button, `aria-pressed` and handler arguments, the
|
|
2028
|
+
row hidden when off, recorded and plain questions untouched, read-only cards
|
|
2029
|
+
static, `statusTag: 'none'`, the `Viewer` threading, and a card with none of
|
|
2030
|
+
the props rendering the same markup.
|
|
2031
|
+
|
|
1748
2032
|
---
|
|
1749
2033
|
|
|
1750
2034
|
## The law (guardrails for anyone editing `@plannotator/ui`)
|
package/README.md
CHANGED
|
@@ -384,6 +384,14 @@ See HANDOFF.md § "Questions in documents (0.48.0, core 0.25.8)".
|
|
|
384
384
|
|
|
385
385
|
See HANDOFF.md § "Question host seams (ui 0.49.0, core 0.25.9)".
|
|
386
386
|
|
|
387
|
+
**Decision recording toggle and status tag (ui 0.52.0, unreleased).** Also optional on `Viewer`, also unused by Plannotator:
|
|
388
|
+
|
|
389
|
+
- `questionDecisionRecording(question) => boolean | undefined`: false draws a `Decision: when answered` question's "Records a decision" tag dimmed with a dotted outline and hides its "Answering this records a decision" row. A recorded decision is never affected.
|
|
390
|
+
- `onToggleQuestionDecisionRecording(key, next)`: makes that tag an `aria-pressed` toggle button; store `next` and return it from `questionDecisionRecording`. Not offered under `readOnly` or in a card without an answer handler.
|
|
391
|
+
- `questionStatusTag: 'none'`: hides the card's own Open / Answered / Settled / Skipped tag so you can draw your own; the decision tags stay.
|
|
392
|
+
|
|
393
|
+
See HANDOFF.md § "Question decision toggle and status tag (ui 0.52.0, unreleased; …)".
|
|
394
|
+
|
|
387
395
|
### Diff file tree (`components/DiffFileTree`; next ui release)
|
|
388
396
|
|
|
389
397
|
A read-only file tree for a list of changed files, to sit beside a host's own per-file diff list. It is Plannotator's code-review tree, not a lookalike: the builder (`utils/diffFileTree`), the folder open/closed hook (`hooks/useDiffFileTreeExpansion`) and the row atoms moved here from `packages/review-editor`, and the review now renders from them.
|
|
@@ -2,6 +2,7 @@ import type React from 'react';
|
|
|
2
2
|
import { getProviderMeta } from './ProviderIcons';
|
|
3
3
|
import { ModelSourceHint, modelSourceToolForProvider } from './ModelSourceHint';
|
|
4
4
|
import {
|
|
5
|
+
findSessionBridge,
|
|
5
6
|
getAIProviderSettings,
|
|
6
7
|
resolveAIProviderSelection,
|
|
7
8
|
saveAIProviderSelection,
|
|
@@ -65,6 +66,37 @@ export const AISettingsTab: React.FC<AISettingsTabProps> = ({
|
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
// "Ask this session": the session that opened Plannotator answers Ask AI and
|
|
70
|
+
// nothing else is offered. Nothing here writes a preference, so a saved
|
|
71
|
+
// provider still applies to sessions that have no attached session.
|
|
72
|
+
const sessionBridge = findSessionBridge(providers);
|
|
73
|
+
if (sessionBridge) {
|
|
74
|
+
const meta = getProviderMeta(sessionBridge.name, sessionBridge.label);
|
|
75
|
+
const Icon = meta.icon;
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
<div>
|
|
79
|
+
<div className="text-sm font-medium">AI Provider</div>
|
|
80
|
+
<div className="text-xs text-muted-foreground">
|
|
81
|
+
Ask AI is answered by the agent session that opened Plannotator.
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<div
|
|
85
|
+
className="flex items-center gap-3 p-3 rounded-lg border border-primary bg-primary/5"
|
|
86
|
+
data-ai-settings-session-bridge
|
|
87
|
+
>
|
|
88
|
+
<div className="w-6 h-6 rounded-md bg-muted flex items-center justify-center text-muted-foreground">
|
|
89
|
+
<Icon className="w-4 h-4" />
|
|
90
|
+
</div>
|
|
91
|
+
<div className="text-sm font-medium">{meta.label}</div>
|
|
92
|
+
</div>
|
|
93
|
+
<div className="text-[10px] text-muted-foreground/70">
|
|
94
|
+
Your provider choice applies when Plannotator is opened without an attached session.
|
|
95
|
+
</div>
|
|
96
|
+
</>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
68
100
|
return (
|
|
69
101
|
<>
|
|
70
102
|
<div>
|