@devaccel-labs/app-comments-toolbar 1.0.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +152 -18
  2. package/dist/react.js +516 -61
  3. package/dist/server.js +342 -14
  4. package/dist/types/capture/api.d.ts +30 -0
  5. package/dist/types/capture/editor.d.ts +10 -0
  6. package/dist/types/capture/ignore.d.ts +19 -0
  7. package/dist/types/capture/index.d.ts +1 -0
  8. package/dist/types/capture/picker.d.ts +9 -0
  9. package/dist/types/capture/picture.d.ts +29 -0
  10. package/dist/types/capture/surface.d.ts +39 -0
  11. package/dist/types/core/index.d.ts +2 -2
  12. package/dist/types/core/resolve.d.ts +2 -1
  13. package/dist/types/core/types.d.ts +11 -0
  14. package/dist/types/debug-context.d.ts +7 -0
  15. package/dist/types/dictation.d.ts +9 -0
  16. package/dist/types/embed/controller.d.ts +61 -0
  17. package/dist/types/embed/index.d.ts +1 -0
  18. package/dist/types/embed/options.d.ts +35 -0
  19. package/dist/types/help/index.d.ts +1 -0
  20. package/dist/types/help/panel-index.d.ts +1 -0
  21. package/dist/types/help/panel-styles.d.ts +1 -0
  22. package/dist/types/help/panel.d.ts +4 -0
  23. package/dist/types/help/pill-styles.d.ts +11 -0
  24. package/dist/types/help/pill.d.ts +44 -0
  25. package/dist/types/help/react.d.ts +12 -0
  26. package/dist/types/help/requests.d.ts +2 -0
  27. package/dist/types/help/types.d.ts +119 -0
  28. package/dist/types/help/wire.d.ts +61 -0
  29. package/dist/types/native-wire.d.ts +63 -0
  30. package/dist/types/native.d.ts +43 -0
  31. package/dist/types/react.d.ts +8 -1
  32. package/dist/types/replay.d.ts +6 -0
  33. package/dist/types/runtime/api.d.ts +250 -0
  34. package/dist/types/runtime/attachment-model.d.ts +16 -0
  35. package/dist/types/runtime/attachments.d.ts +43 -7
  36. package/dist/types/runtime/boot.d.ts +39 -0
  37. package/dist/types/runtime/browser-label.d.ts +5 -0
  38. package/dist/types/runtime/build-id.d.ts +7 -0
  39. package/dist/types/runtime/capture-ui.d.ts +45 -21
  40. package/dist/types/runtime/clarity-model.d.ts +260 -0
  41. package/dist/types/runtime/clarity-ui.d.ts +62 -0
  42. package/dist/types/runtime/client.d.ts +6 -197
  43. package/dist/types/runtime/composer-size.d.ts +30 -0
  44. package/dist/types/runtime/dashboard.d.ts +17 -2
  45. package/dist/types/runtime/debug-context-core.d.ts +88 -0
  46. package/dist/types/runtime/debug-context-host.d.ts +39 -0
  47. package/dist/types/runtime/debug-context-model.d.ts +352 -0
  48. package/dist/types/runtime/debug-context-redact.d.ts +48 -0
  49. package/dist/types/runtime/debug-context.d.ts +36 -0
  50. package/dist/types/runtime/details-model.d.ts +7 -0
  51. package/dist/types/runtime/details.d.ts +7 -5
  52. package/dist/types/runtime/dictation-engine.d.ts +98 -0
  53. package/dist/types/runtime/dictation-model.d.ts +28 -0
  54. package/dist/types/runtime/dictation-ui.d.ts +56 -0
  55. package/dist/types/runtime/dictation.d.ts +66 -0
  56. package/dist/types/runtime/draft-dock.d.ts +32 -0
  57. package/dist/types/runtime/draft-model.d.ts +104 -0
  58. package/dist/types/runtime/draft-store.d.ts +15 -0
  59. package/dist/types/runtime/edits.d.ts +1 -1
  60. package/dist/types/runtime/font.d.ts +16 -0
  61. package/dist/types/runtime/format.d.ts +30 -1
  62. package/dist/types/runtime/host-watch.d.ts +20 -0
  63. package/dist/types/runtime/icons.d.ts +16 -2
  64. package/dist/types/runtime/index.d.ts +3 -1
  65. package/dist/types/runtime/ink.d.ts +8 -0
  66. package/dist/types/runtime/kind-model.d.ts +14 -0
  67. package/dist/types/runtime/live-model.d.ts +25 -0
  68. package/dist/types/runtime/loader.d.ts +5 -11
  69. package/dist/types/runtime/markup-editor.d.ts +54 -0
  70. package/dist/types/runtime/markup-model.d.ts +126 -0
  71. package/dist/types/runtime/markup.d.ts +69 -0
  72. package/dist/types/runtime/mention-parse.d.ts +18 -0
  73. package/dist/types/runtime/mentions.d.ts +4 -4
  74. package/dist/types/runtime/page-background.d.ts +9 -0
  75. package/dist/types/runtime/page-image.d.ts +123 -0
  76. package/dist/types/runtime/placement.d.ts +6 -3
  77. package/dist/types/runtime/record.d.ts +18 -2
  78. package/dist/types/runtime/related.d.ts +1 -1
  79. package/dist/types/runtime/replay-model.d.ts +80 -0
  80. package/dist/types/runtime/replay.d.ts +5 -38
  81. package/dist/types/runtime/runtime.d.ts +6 -0
  82. package/dist/types/runtime/screen.d.ts +47 -0
  83. package/dist/types/runtime/screenshot.d.ts +60 -6
  84. package/dist/types/runtime/session-source.d.ts +45 -0
  85. package/dist/types/runtime/session.d.ts +20 -18
  86. package/dist/types/runtime/shield.d.ts +9 -0
  87. package/dist/types/runtime/shot.d.ts +45 -0
  88. package/dist/types/runtime/sketch.d.ts +26 -0
  89. package/dist/types/runtime/styles.d.ts +1 -1
  90. package/dist/types/runtime/sync.d.ts +1 -0
  91. package/dist/types/runtime/thread-model.d.ts +18 -0
  92. package/dist/types/runtime/ticket-form-model.d.ts +57 -0
  93. package/dist/types/runtime/ticket-form.d.ts +9 -0
  94. package/dist/types/runtime/toolbar.d.ts +37 -1
  95. package/dist/types/runtime/ui-scale.d.ts +17 -0
  96. package/dist/types/runtime/update.d.ts +37 -0
  97. package/dist/types/runtime/use-debug-context.d.ts +27 -0
  98. package/dist/types/server/index.d.ts +22 -0
  99. package/dist/types/server/support.d.ts +20 -0
  100. package/dist/types/server.d.ts +2 -0
  101. package/dist/types/vite/plugin.d.ts +15 -0
  102. package/dist/vite.js +121 -41
  103. package/package.json +26 -13
  104. package/src/capture/api.ts +128 -0
  105. package/src/capture/editor.tsx +178 -0
  106. package/src/capture/ignore.ts +38 -0
  107. package/src/capture/index.ts +27 -0
  108. package/src/capture/picker.tsx +171 -0
  109. package/src/capture/picture.ts +90 -0
  110. package/src/capture/surface.tsx +185 -0
  111. package/src/compiler/annotate.ts +202 -0
  112. package/src/compiler/babel.d.ts +11 -0
  113. package/src/compiler/enabled.ts +55 -0
  114. package/src/compiler/index.ts +2 -0
  115. package/src/core/index.ts +8 -0
  116. package/src/core/resolve.ts +307 -0
  117. package/src/core/types.ts +58 -0
  118. package/src/debug-context.ts +47 -0
  119. package/src/dictation.ts +17 -0
  120. package/src/embed/controller.ts +215 -0
  121. package/src/embed/index.ts +68 -0
  122. package/src/embed/options.ts +100 -0
  123. package/src/help/index.ts +38 -0
  124. package/src/help/panel-index.ts +17 -0
  125. package/src/help/panel-styles.ts +123 -0
  126. package/src/help/panel.ts +840 -0
  127. package/src/help/pill-styles.ts +75 -0
  128. package/src/help/pill.ts +338 -0
  129. package/src/help/react.tsx +143 -0
  130. package/src/help/requests.ts +111 -0
  131. package/src/help/types.ts +124 -0
  132. package/src/help/wire.ts +55 -0
  133. package/src/native-wire.ts +124 -0
  134. package/src/native.ts +282 -0
  135. package/src/react.ts +27 -0
  136. package/src/replay.ts +13 -0
  137. package/src/runtime/api.ts +531 -0
  138. package/src/runtime/attachment-model.ts +42 -0
  139. package/src/runtime/attachments.tsx +1260 -0
  140. package/src/runtime/boot.ts +95 -0
  141. package/src/runtime/browser-label.ts +31 -0
  142. package/src/runtime/build-id.ts +10 -0
  143. package/src/runtime/capture-ui.tsx +306 -0
  144. package/src/runtime/capture.ts +508 -0
  145. package/src/runtime/clarity-model.ts +634 -0
  146. package/src/runtime/clarity-ui.tsx +454 -0
  147. package/src/runtime/client.ts +151 -0
  148. package/src/runtime/composer-size.tsx +146 -0
  149. package/src/runtime/dashboard.tsx +1130 -0
  150. package/src/runtime/debug-context-core.ts +681 -0
  151. package/src/runtime/debug-context-host.ts +56 -0
  152. package/src/runtime/debug-context-model.ts +1319 -0
  153. package/src/runtime/debug-context-redact.ts +259 -0
  154. package/src/runtime/debug-context.ts +613 -0
  155. package/src/runtime/details-model.ts +30 -0
  156. package/src/runtime/details.tsx +395 -0
  157. package/src/runtime/dictation-engine.ts +616 -0
  158. package/src/runtime/dictation-model.ts +79 -0
  159. package/src/runtime/dictation-ui.tsx +363 -0
  160. package/src/runtime/dictation.ts +271 -0
  161. package/src/runtime/dock.ts +108 -0
  162. package/src/runtime/draft-dock.tsx +124 -0
  163. package/src/runtime/draft-model.ts +251 -0
  164. package/src/runtime/draft-store.ts +149 -0
  165. package/src/runtime/edits.tsx +165 -0
  166. package/src/runtime/font.ts +42 -0
  167. package/src/runtime/format.ts +129 -0
  168. package/src/runtime/freshness.ts +23 -0
  169. package/src/runtime/handoff.ts +76 -0
  170. package/src/runtime/host-watch.ts +64 -0
  171. package/src/runtime/icons.tsx +295 -0
  172. package/src/runtime/idle.ts +20 -0
  173. package/src/runtime/index.ts +11 -0
  174. package/src/runtime/ink.ts +6 -0
  175. package/src/runtime/kind-model.ts +20 -0
  176. package/src/runtime/live-model.ts +32 -0
  177. package/src/runtime/loader.tsx +87 -0
  178. package/src/runtime/markup-editor.tsx +1333 -0
  179. package/src/runtime/markup-model.ts +485 -0
  180. package/src/runtime/markup.ts +382 -0
  181. package/src/runtime/members.ts +58 -0
  182. package/src/runtime/mention-parse.ts +56 -0
  183. package/src/runtime/mentions.tsx +205 -0
  184. package/src/runtime/page-background.ts +51 -0
  185. package/src/runtime/page-image.ts +1592 -0
  186. package/src/runtime/placement.ts +336 -0
  187. package/src/runtime/record.ts +402 -0
  188. package/src/runtime/redact.ts +30 -0
  189. package/src/runtime/related.ts +34 -0
  190. package/src/runtime/render-page.ts +2 -0
  191. package/src/runtime/replay-model.ts +232 -0
  192. package/src/runtime/replay.ts +173 -0
  193. package/src/runtime/runtime-version.ts +7 -0
  194. package/src/runtime/runtime.tsx +51 -0
  195. package/src/runtime/screen.ts +182 -0
  196. package/src/runtime/screenshot.ts +260 -0
  197. package/src/runtime/session-source.ts +112 -0
  198. package/src/runtime/session.ts +108 -0
  199. package/src/runtime/shield.ts +34 -0
  200. package/src/runtime/shot.tsx +422 -0
  201. package/src/runtime/sketch.ts +139 -0
  202. package/src/runtime/styles.ts +1541 -0
  203. package/src/runtime/sync.ts +300 -0
  204. package/src/runtime/thread-model.ts +71 -0
  205. package/src/runtime/ticket-form-model.ts +128 -0
  206. package/src/runtime/ticket-form.tsx +342 -0
  207. package/src/runtime/toolbar.tsx +4427 -0
  208. package/src/runtime/ui-scale.ts +75 -0
  209. package/src/runtime/update.ts +98 -0
  210. package/src/runtime/use-debug-context.ts +81 -0
  211. package/src/server/index.ts +133 -0
  212. package/src/server/support.ts +499 -0
  213. package/src/server.ts +4 -0
  214. package/src/vite/plugin.ts +102 -0
  215. package/src/vite.ts +1 -0
  216. package/dist/chunks/chunk-CSKXLF33.js +0 -153
  217. package/dist/chunks/chunk-HUM5FQII.js +0 -160
  218. package/dist/chunks/render-page-76MLIT6M.js +0 -1421
  219. package/dist/chunks/runtime-JX75TKER.js +0 -9267
  220. package/dist/chunks/screenshot-66ARTBGR.js +0 -12
package/README.md CHANGED
@@ -1,20 +1,154 @@
1
1
  # @devaccel-labs/app-comments-toolbar
2
2
 
3
- The in-app comment toolbar that host apps (Officers Assist, JebelAI) load at runtime from the App comments
4
- worker as `/v1/toolbar/1.js`. Ported from the comment-service repo (`packages/core` and `packages/react`) on
5
- 2026-10-12; this is now the source of record for the runtime.
6
-
7
- - `src/core`: anchor model and resolution (`resolveAnchor`), DOM-free.
8
- - `src/runtime`: the React runtime (`runtime.tsx` is the bundle entry), element capture and placement, sync,
9
- attachments, screenshots, styles. `loader.tsx` is the host-side `<CommentToolbar>`.
10
- - `src/compiler`, `src/vite`, `src/server`: the Vite plugin that stamps components with `data-cs-cmp` /
11
- `data-cs-file`, and the same-origin session route. Entry points `src/react.ts`, `src/vite.ts`, `src/server.ts`.
12
- - Worker bundle: `bun scripts/app-comments/build-toolbar.mjs` writes `workers/app-comments/toolbar-dist/v1/toolbar/`
13
- (checked in; see `docs/policies/generated-files-policy.md`). `bun scripts/dev/dev-app-comments.mjs` builds it too.
14
- - npm package: `bun run build` here writes `dist/` (vite, react with the runtime bundled as fallback, server, and
15
- declarations); publish with `npm publish` from this directory. Host apps install it and use
16
- `@devaccel-labs/app-comments-toolbar/vite`, `/react` and `/server`; the `COMMENT_SERVICE_*` env names are unchanged.
17
- - Tests: `tests/unit/app-comments-toolbar-*.spec.ts`.
18
-
19
- The bundle has no version negotiation with host apps: `/v1` responses and the runtime's storage keys must stay
20
- compatible with whatever package version the hosts have installed.
3
+ The in-app review toolbar of Comment Tool. A reviewer uses it inside a host app to comment on an element, take a
4
+ page snapshot and draw on it, record the screen, dictate, keep drafts and read the threads of the page.
5
+
6
+ One source tree produces five things:
7
+
8
+ - **The runtime**: the browser bundle that does all of the above. Host apps never bundle it. They load it from the
9
+ API worker as `/v1/toolbar/1.js`.
10
+ - **The script-tag loader**: `/v1/toolbar/embed.js`, also served by the API worker. One `<script>` tag in a host's
11
+ HTML loads the runtime with it, and the host installs nothing.
12
+ - **The capture script**: `/v1/toolbar/capture.js`, also served by the API worker. A host page that has its own
13
+ place for a screenshot (a support form) adds it when a person asks to capture, and calls
14
+ `window.CommentToolCapture.screenshot()` or `.pick()`. No session, nothing sent
15
+ (`docs/handoff/lane-capture-api.md`).
16
+ - **The help pill**: `/v1/toolbar/help.js`, and the panel it opens, `/v1/toolbar/help-panel.js`, also served by
17
+ the API worker. A host shows it to every signed-in person with `window.CommentToolHelp.mount({ submit, list })`;
18
+ what a person writes goes to the host's own hooks. No session (`docs/handoff/lane-help-pill.md`).
19
+ - **The npm package**: the same loader as a React component, the session route as a function, a Vite plugin, the
20
+ pill as a React component and its server route as a function.
21
+
22
+ ## Source
23
+
24
+ - `src/core`: the anchor model and how an anchor finds its element again (`resolveAnchor`). No DOM.
25
+ - `src/runtime`: the toolbar. `runtime.tsx` is the bundle's entry and exports `mount`. `boot.ts` is how a host page
26
+ brings the toolbar up (idle wait, session route, import, mount); `loader.tsx`, the host-side `<CommentToolbar>`,
27
+ and the script-tag loader both run it. `update.ts` and `build-id.ts` are how an open toolbar moves to a new build.
28
+ - `src/embed`: the script-tag loader. `index.ts` is its entry: it reads its own tag and installs
29
+ `window.CommentTool`. `options.ts` checks the tag's `data-` attributes, `controller.ts` is `refresh`, `unmount`
30
+ and `configure`, and the rule about which service the toolbar may come from.
31
+ - `src/capture`: the capture script. `index.ts` is its entry and installs `window.CommentToolCapture`; `api.ts` is
32
+ `screenshot` and `pick`; `editor.tsx` and `picker.tsx` put the toolbar's own drawing editor and element outline
33
+ in a root of the toolbar's kind (`surface.tsx`); `ignore.ts` is what a picture leaves out. It imports from
34
+ `src/runtime` and changes nothing there.
35
+ - `src/help`: the help pill. `index.ts` is the entry of `help.js` and installs `window.CommentToolHelp`; `pill.ts`
36
+ is the pill and what it loads when; `panel.ts` (entry `panel-index.ts`, served as `help-panel.js`) is the panel,
37
+ in plain DOM; `requests.ts` is `supportRequestsAt`; `react.tsx` is `<HelpPill>`; `wire.ts` is the request as it
38
+ travels to the host's route. `help.js` imports nothing outside this folder.
39
+ - `src/compiler`, `src/vite`: the Vite plugin that stamps components with `data-cs-cmp` and `data-cs-file`.
40
+ - `src/server`: the same-origin session route (`index.ts`) and the help pill's route (`support.ts`).
41
+ - `src/native-wire.ts`, `src/native.ts`, `src/dictation.ts`, `src/replay.ts`: DOM-free code shared with native
42
+ clients and with the API worker. These four ship as TypeScript source and are not built into `dist`.
43
+ - `tests`: the unit specs.
44
+
45
+ ## How the runtime ships
46
+
47
+ `bun run build:toolbar`, from the repository root, runs `scripts/build-toolbar.mjs`. It writes seven things to
48
+ `apps/api/toolbar-dist/v1/toolbar/`: the bundle `1.js`, the `chunks/` it loads on demand, `build.json`, the
49
+ loader `embed.js`, the capture script `capture.js`, and the help pill's `help.js` and `help-panel.js`. That
50
+ directory is build output and is not checked in.
51
+ `--outdir <dir>` writes somewhere else.
52
+
53
+ `embed.js` is one classic script of about 6 KB with no dependencies; the build fails if an import ever pulls one
54
+ in. It carries no build id. The worker serves every file here with `cache-control: no-cache`, so a page asks for
55
+ the loader again on each load and gets the new one after a deploy. `src/embed` is not part of the runtime's build
56
+ id, so a change to the loader alone does not make open toolbars remount.
57
+
58
+ `capture.js` is one classic script too, of about 368 KB (103 KB gzipped): it carries React and the drawing editor,
59
+ so a host loads it on demand and never on every page. The build fails if it ever bundles the toolbar itself or its
60
+ session, storage or service code. `src/capture` is not part of the runtime's build id either.
61
+
62
+ `help.js` is one classic script of about 10 KB (4 KB gzipped): the pill and nothing else, because every signed-in
63
+ person of a host loads it on every page. The build fails if it bundles anything outside `src/help`. It fetches
64
+ `help-panel.js` (about 25 KB, 8 KB gzipped, plain DOM with no React) and `capture.js` from beside itself the first
65
+ time the pill is hovered, focused or opened. `src/help` is not part of the runtime's build id, and neither the
66
+ loader nor the runtime names these files.
67
+
68
+ The API worker serves that directory as static files under `/v1/toolbar/*`.
69
+
70
+ Every build has a build id: sixteen hex characters hashed from the esbuild version and from every file in
71
+ `src/runtime` and `src/core`. The build writes the id into the bundle and into `build.json`. The same source gives
72
+ the same id on every machine. A change to either directory gives a new one.
73
+
74
+ An open toolbar moves to a new build by itself. It reads `/v1/toolbar/build.json` when it mounts, when its live
75
+ socket connects or reconnects, when its tab becomes visible, and once a minute. The service can also announce a
76
+ build over the live socket. When the id it reads is not its own, the toolbar imports the new bundle and remounts in
77
+ place. It waits until that cannot lose a draft, a reply, a recording or an edit. A reviewer does not reload the
78
+ page and a host app does not release anything.
79
+
80
+ The `1` in `1.js` is `runtimeVersion` (`src/runtime/runtime-version.ts`). It is the contract between the loader in
81
+ the npm package and the bundle: the loader asks for `/v1/toolbar/<runtimeVersion>.js` and calls its `mount`. Raise
82
+ it only when `mount` or its props change incompatibly, and keep serving the old file, because installed host
83
+ packages still ask for it.
84
+
85
+ ## The npm package
86
+
87
+ A host app installs the package for three entry points:
88
+
89
+ - `@devaccel-labs/app-comments-toolbar/vite`: `commentService()`, a Vite plugin. It stamps each JSX component with
90
+ its name and file so a comment can find its component again. It runs in the dev server, and in a build that has
91
+ `COMMENT_SERVICE_URL` configured or `COMMENT_SERVICE_ENABLED=1`.
92
+ - `@devaccel-labs/app-comments-toolbar/server`: `handleSessionRequest(request)`, the route the host serves on its
93
+ own origin (by default `/api/comment-service/session`). It reads `COMMENT_SERVICE_URL`, `COMMENT_SERVICE_PROJECT`,
94
+ `COMMENT_SERVICE_ENVIRONMENT`, `COMMENT_SERVICE_SECRET` and the optional `COMMENT_SERVICE_LINKED`, and exchanges
95
+ the secret for a short-lived host token. The secret stays on the host's server.
96
+ - `@devaccel-labs/app-comments-toolbar/react`: `<CommentToolbar>`. It renders nothing. Once the page is idle it
97
+ asks the session route whether comments are on, then imports the runtime from the API worker and mounts it.
98
+ Its `debugContext` prop turns on the debug context file each new comment carries; `reportToolbarError` and
99
+ `queryCacheSummary` feed it (`docs/integration/debug-context.md`). The Vite plugin stamps the build's commit
100
+ and version for it.
101
+
102
+ `./debug-context` (source only, like `./replay`) reads a context file back safely (`sanitizeDebugContext`) and
103
+ renders the agent brief (`debugContextBrief`), for the service, the console and destinations.
104
+
105
+ Two of those entry points also carry the help pill (`docs/handoff/lane-help-pill.md`):
106
+
107
+ - `/react`: `<HelpPill submit={…} list={…} serviceUrl={…} />`, which adds `help.js` once the page is idle and
108
+ mounts the pill it defines, and `supportRequestsAt(url)`, the two hooks for a host whose route is the helper
109
+ below.
110
+ - `/server`: `handleSupportRequest(request, { serviceUrl, connectionToken, project, reporter, account })`, for a
111
+ host with no tracker of its own. The host calls it after its own sign-in check. `POST` files the request in
112
+ Comment Tool with the integration API's `fileReport`; `GET` answers the person's own requests from `reportsBy`.
113
+ A request the team merged into one it already had is answered as `consolidated`, with that one's status, and
114
+ the pill tells the person so.
115
+
116
+ A host does not need the package for the first two of these: `embed.js` is the loader, and the integration guide
117
+ gives the session route as code to copy (`docs/integration/session-route.md`). `tests/no-package-session.spec.ts`
118
+ keeps that code answering exactly what `handleSessionRequest` answers. Only the Vite plugin has no other form.
119
+
120
+ The package contains no runtime, so it changes only when `runtimeVersion` or one of these three pieces changes.
121
+ `/v1` responses and the runtime's storage keys have to stay compatible with every package version a host has
122
+ installed.
123
+
124
+ The session route binds a host token to an origin it works out itself. For a browser that is the origin the host is
125
+ served on (`x-forwarded-host` and `x-forwarded-proto`, then `Host`, then the request URL). The `Origin` header a
126
+ caller sends is not used. A native app sends no `Origin` and declares `<scheme>://app` in
127
+ `x-comment-service-origin`; only a value of that shape is read from that header.
128
+
129
+ `bun run build` in this directory writes `dist/`: `react.js`, `vite.js`, `server.js`, a `.d.ts` file for each, and
130
+ `dist/types/`. The published package is `dist`, `src` and this file. It is published by hand with `npm publish`
131
+ from this directory.
132
+
133
+ ## Commands
134
+
135
+ From the repository root:
136
+
137
+ | Command | What it does |
138
+ | ------------------------------------------ | ------------------------------------------------------------------------------------ |
139
+ | `bun run --cwd packages/toolbar typecheck` | Type-checks `src` under `tsconfig.json`, then the specs under `tests/tsconfig.json`. |
140
+ | `bun run test --project toolbar` | Runs the unit specs in `tests/` with Vitest. |
141
+ | `bun run build:toolbar` | Builds the runtime into `apps/api/toolbar-dist/v1/toolbar/`. |
142
+ | `bun run --cwd packages/toolbar build` | Builds the npm package into `packages/toolbar/dist/`. |
143
+
144
+ `tsconfig.json` keeps three compiler checks off that `tsconfig.base.json` turns on. The runtime was written
145
+ without them, and turning them on is separate work.
146
+
147
+ A spec runs in Node unless its first line asks for jsdom. Three specs also import the API worker's half of a shared
148
+ format from `apps/api/src/v1`: `sketch.spec.ts`, `dictation.spec.ts` and `native-wire.spec.ts`. `dist.spec.ts`
149
+ runs a real runtime build into a temporary directory. `no-package-session.spec.ts` imports the guide's copy-paste
150
+ session route from `docs/integration/examples` and runs its Python version in `python3`, which must be on the
151
+ PATH.
152
+
153
+ The help pill's specs are `help-*.spec.ts(x)`. `fake-comment-tool.ts` is a stand-in for the integration API's
154
+ `fileReport` and `reportsBy`; it imports no test runner, because the browser suite's host server uses it too.