@screenreader-speech-capture/bridge 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +1292 -791
- package/dist/ui/adapter-node.js +1 -1
- package/dist/ui/client/ui/_app/immutable/assets/{4.DyY1vjRV.css → 4.DEk4yqpA.css} +1 -1
- package/dist/ui/client/ui/_app/immutable/assets/4.DEk4yqpA.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/4.DEk4yqpA.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BEImj5AP.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BEImj5AP.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BEImj5AP.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BLbj0ykL.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BLbj0ykL.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BLbj0ykL.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B__KpOuX.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B__KpOuX.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B__KpOuX.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BkoDSEOx.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BkoDSEOx.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BkoDSEOx.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BlC5mir6.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BlC5mir6.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BlC5mir6.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BquQTeuV.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BquQTeuV.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BquQTeuV.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BtnuBvK5.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BtnuBvK5.js.br +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BtnuBvK5.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/{BrPqgVT6.js → BuwZGWCm.js} +21 -21
- package/dist/ui/client/ui/_app/immutable/chunks/BuwZGWCm.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BuwZGWCm.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Bxh3K0TK.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Bxh3K0TK.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Bxh3K0TK.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/C06IiL6m.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/C06IiL6m.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/C06IiL6m.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CAZ56n62.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CAZ56n62.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CAZ56n62.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CTnnxqUD.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CTnnxqUD.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CTnnxqUD.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DRNNJMYk.js +5 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DRNNJMYk.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DRNNJMYk.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/JsC3ASJq.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/JsC3ASJq.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/JsC3ASJq.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/{C7D7xLuA.js → OAsMjdHF.js} +13 -13
- package/dist/ui/client/ui/_app/immutable/chunks/OAsMjdHF.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/OAsMjdHF.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/R_4U_-zb.js +33 -0
- package/dist/ui/client/ui/_app/immutable/chunks/R_4U_-zb.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/R_4U_-zb.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/UKukklIc.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/UKukklIc.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/UKukklIc.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/{KD5R77Wj.js → VxDST09k.js} +1 -1
- package/dist/ui/client/ui/_app/immutable/chunks/VxDST09k.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/VxDST09k.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/{D9JU-e3z.js → vPs9G1oN.js} +36 -36
- package/dist/ui/client/ui/_app/immutable/chunks/vPs9G1oN.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/vPs9G1oN.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/{Cc902J0D.js → w5i9ZoX_.js} +2 -2
- package/dist/ui/client/ui/_app/immutable/chunks/w5i9ZoX_.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/w5i9ZoX_.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.CHExvln1.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.CHExvln1.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.CHExvln1.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.4hiWLKwq.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.4hiWLKwq.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.4hiWLKwq.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.DENUQERM.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.DENUQERM.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.DENUQERM.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.BBl7b45u.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.BBl7b45u.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.BBl7b45u.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.4VpydhMh.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.4VpydhMh.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.4VpydhMh.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.D9AmPYb5.js +5 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.D9AmPYb5.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.D9AmPYb5.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.DxNIrNp_.js +180 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.DxNIrNp_.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.DxNIrNp_.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/5.Cm6I95kb.js +6 -0
- package/dist/ui/client/ui/_app/immutable/nodes/5.Cm6I95kb.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/5.Cm6I95kb.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/6.D9jpgBJB.js +6 -0
- package/dist/ui/client/ui/_app/immutable/nodes/6.D9jpgBJB.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/6.D9jpgBJB.js.gz +0 -0
- package/dist/ui/client/ui/_app/version.json +1 -1
- package/dist/ui/client/ui/_app/version.json.br +0 -0
- package/dist/ui/client/ui/_app/version.json.gz +0 -0
- package/dist/ui/server/.vite/manifest.json +80 -59
- package/dist/ui/server/_app/immutable/assets/{_page.DyY1vjRV.css → _page.DEk4yqpA.css} +1 -1
- package/dist/ui/server/chunks/{composition.js → app-context.js} +50 -958
- package/dist/ui/server/chunks/app-context.js.map +1 -0
- package/dist/ui/server/chunks/config2.js +106 -0
- package/dist/ui/server/chunks/config2.js.map +1 -0
- package/dist/ui/server/chunks/dialog.js +1 -1
- package/dist/ui/server/chunks/instance.js +3 -3
- package/dist/ui/server/chunks/internal.js +1 -1
- package/dist/ui/server/chunks/outlined-button.js +116 -0
- package/dist/ui/server/chunks/outlined-button.js.map +1 -0
- package/dist/ui/server/chunks/outlined-text-field.js +1 -1
- package/dist/ui/server/chunks/redispatch-event.js +1 -1
- package/dist/ui/server/chunks/rolldown-runtime.js +12 -0
- package/dist/ui/server/chunks/rules.js +178 -0
- package/dist/ui/server/chunks/rules.js.map +1 -0
- package/dist/ui/server/chunks/sessions.remote.js +1 -11
- package/dist/ui/server/chunks/sessions.remote.js.map +1 -1
- package/dist/ui/server/chunks/setup.js +86 -0
- package/dist/ui/server/chunks/setup.js.map +1 -0
- package/dist/ui/server/chunks/{icon-button.js → speech.js} +42 -3
- package/dist/ui/server/chunks/speech.js.map +1 -0
- package/dist/ui/server/chunks/src.js +20 -155
- package/dist/ui/server/chunks/src.js.map +1 -1
- package/dist/ui/server/chunks/static-html.js +1 -1
- package/dist/ui/server/chunks/text-button.js +1 -1
- package/dist/ui/server/chunks/vocabulary.js +19 -0
- package/dist/ui/server/chunks/vocabulary.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/config/_server.ts.js +3 -2
- package/dist/ui/server/entries/endpoints/api/config/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/input/keys/_server.ts.js +14 -5
- package/dist/ui/server/entries/endpoints/api/input/keys/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/markers/_server.ts.js +3 -2
- package/dist/ui/server/entries/endpoints/api/markers/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js +2 -1
- package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/speech/_server.ts.js +10 -13
- package/dist/ui/server/entries/endpoints/api/speech/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js +2 -1
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/hooks.server.js +29 -25
- package/dist/ui/server/entries/hooks.server.js.map +1 -1
- package/dist/ui/server/entries/pages/_layout.svelte.js +749 -4
- package/dist/ui/server/entries/pages/_layout.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/_page.svelte.js +34 -26
- package/dist/ui/server/entries/pages/_page.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/settings/_page.svelte.js +143 -15
- package/dist/ui/server/entries/pages/settings/_page.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/setup/_page.svelte.js +3 -3
- package/dist/ui/server/entries/pages/setup/_page.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/setup/instructions/_page.svelte.js +16 -10
- package/dist/ui/server/entries/pages/setup/instructions/_page.svelte.js.map +1 -1
- package/dist/ui/server/manifest-full.js +1 -1
- package/dist/ui/server/manifest.js +1 -1
- package/dist/ui/server/nodes/0.js +1 -1
- package/dist/ui/server/nodes/1.js +1 -1
- package/dist/ui/server/nodes/2.js +1 -1
- package/dist/ui/server/nodes/3.js +1 -1
- package/dist/ui/server/nodes/4.js +2 -2
- package/dist/ui/server/nodes/5.js +1 -1
- package/dist/ui/server/nodes/6.js +1 -1
- package/dist/ui/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/ui/client/ui/_app/immutable/assets/4.DyY1vjRV.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/4.DyY1vjRV.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js +0 -3
- package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/0FroJ-XN.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js.br +0 -2
- package/dist/ui/client/ui/_app/immutable/chunks/B_ZElYu_.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BfHif6xP.js +0 -2
- package/dist/ui/client/ui/_app/immutable/chunks/BfHif6xP.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BfHif6xP.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BrPqgVT6.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BrPqgVT6.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/C7D7xLuA.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/C7D7xLuA.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CVpgcnu3.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Cc902J0D.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Cc902J0D.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js.br +0 -4
- package/dist/ui/client/ui/_app/immutable/chunks/D-2Nx62w.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D9JU-e3z.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/D9JU-e3z.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js.br +0 -2
- package/dist/ui/client/ui/_app/immutable/chunks/DHsTyp2W.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js +0 -3
- package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dvxhfd7j.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js.br +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/DzInmTUe.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/KD5R77Wj.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/KD5R77Wj.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/PzCUpBms.js +0 -3
- package/dist/ui/client/ui/_app/immutable/chunks/PzCUpBms.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/PzCUpBms.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Roub4aju.js +0 -33
- package/dist/ui/client/ui/_app/immutable/chunks/Roub4aju.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Roub4aju.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/ux9AxWa3.js +0 -4
- package/dist/ui/client/ui/_app/immutable/chunks/ux9AxWa3.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/ux9AxWa3.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.DM2PRoLw.js +0 -2
- package/dist/ui/client/ui/_app/immutable/entry/app.DM2PRoLw.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.DM2PRoLw.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js +0 -2
- package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.DqIv9xYX.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.fKLM0nQo.js +0 -1
- package/dist/ui/client/ui/_app/immutable/nodes/0.fKLM0nQo.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.fKLM0nQo.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js +0 -1
- package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.C81neQJL.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js +0 -1
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmlyeAx_.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.CywuMQ0y.js +0 -5
- package/dist/ui/client/ui/_app/immutable/nodes/3.CywuMQ0y.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.CywuMQ0y.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.BYvsTY13.js +0 -160
- package/dist/ui/client/ui/_app/immutable/nodes/4.BYvsTY13.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.BYvsTY13.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/5.xWNFTFjr.js +0 -6
- package/dist/ui/client/ui/_app/immutable/nodes/5.xWNFTFjr.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/5.xWNFTFjr.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/6.Dnf8S10l.js +0 -6
- package/dist/ui/client/ui/_app/immutable/nodes/6.Dnf8S10l.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/6.Dnf8S10l.js.gz +0 -0
- package/dist/ui/server/chunks/composition.js.map +0 -1
- package/dist/ui/server/chunks/filled-button.js +0 -116
- package/dist/ui/server/chunks/filled-button.js.map +0 -1
- package/dist/ui/server/chunks/icon-button.js.map +0 -1
- package/dist/ui/server/chunks/icon.js +0 -49
- package/dist/ui/server/chunks/icon.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as t, E as e, O as n, T as e$1, _ as i, a as mixinFormAssociated, j as __decorate, k as i$1, r as mixinFormSubmitter, s as mixinElementInternals, u as mixinDelegatesAria, v as A, x as T } from "./app-context.js";
|
|
2
2
|
// ../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/node/decorators/query-assigned-elements.js
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// ../shared/src/rules/vocabulary.ts
|
|
2
|
+
/** `log.level`, from the least to the most detail. */
|
|
3
|
+
var LOG_LEVELS = [
|
|
4
|
+
"error",
|
|
5
|
+
"warn",
|
|
6
|
+
"info",
|
|
7
|
+
"debug"
|
|
8
|
+
];
|
|
9
|
+
/** The buttons of a native click. */
|
|
10
|
+
var MOUSE_BUTTONS = [
|
|
11
|
+
"left",
|
|
12
|
+
"right",
|
|
13
|
+
"middle"
|
|
14
|
+
];
|
|
15
|
+
/** Whose browser a focus or a key press means. */
|
|
16
|
+
var FOCUS_TARGETS = ["mcp", "playwright"];
|
|
17
|
+
export { LOG_LEVELS as n, MOUSE_BUTTONS as r, FOCUS_TARGETS as t };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocabulary.js","names":[],"sources":["../../../../shared/src/rules/vocabulary.ts"],"sourcesContent":["// The values a setting or a request field can take, where code needs them as a list.\n\n/** `log.level`, from the least to the most detail. */\nexport const LOG_LEVELS = ['error', 'warn', 'info', 'debug'] as const;\nexport type LogLevel = (typeof LOG_LEVELS)[number];\n\n/** The buttons of a native click. */\nexport const MOUSE_BUTTONS = ['left', 'right', 'middle'] as const;\n\n/** Whose browser a focus or a key press means. */\nexport const FOCUS_TARGETS = ['mcp', 'playwright'] as const;\n"],"mappings":";;AAGA,IAAa,aAAa;CAAC;CAAS;CAAQ;CAAQ;AAAO;;AAI3D,IAAa,gBAAgB;CAAC;CAAQ;CAAS;AAAQ;;AAGvD,IAAa,gBAAgB,CAAC,OAAO,YAAY"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as json, t as error } from "../../../../chunks/exports.js";
|
|
2
|
-
import {
|
|
2
|
+
import { m as ConfigPatchSchema, n as checkDto } from "../../../../chunks/src.js";
|
|
3
3
|
import { t as readConfigState } from "../../../../chunks/config-state.js";
|
|
4
4
|
// src/routes/api/config/+server.ts
|
|
5
5
|
/** The settings page's re-read in the browser (`readConfigState`). */
|
|
@@ -12,7 +12,8 @@ var PUT = async ({ request, locals }) => {
|
|
|
12
12
|
message: `Invalid setting at ${checked.field}: ${checked.message}`,
|
|
13
13
|
field: checked.field
|
|
14
14
|
});
|
|
15
|
-
|
|
15
|
+
const saved = await locals.bridge.updateConfig(checked.value);
|
|
16
|
+
return json(saved);
|
|
16
17
|
};
|
|
17
18
|
export { GET, PUT };
|
|
18
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/config/+server.ts"],"sourcesContent":["import { error, json } from '@sveltejs/kit';\nimport { checkDto, ConfigPatchSchema } from '@screenreader-speech-capture/shared';\nimport { readConfigState } from '#lib/server/config-state.js';\nimport type { RequestHandler } from './$types';\n\n/** The settings page's re-read in the browser (`readConfigState`). */\nexport const GET: RequestHandler = async ({ locals: { bridge } }) =>\n json(await readConfigState(bridge));\n\n/** Saves a partial config for the next start and answers with the saved config. */\nexport const PUT: RequestHandler = async ({ request, locals }) => {\n const body: unknown = await request.json().catch(() => undefined);\n const checked = checkDto(ConfigPatchSchema, body);\n if (!checked.ok) {\n error(400, {\n message: `Invalid setting at ${checked.field}: ${checked.message}`,\n field: checked.field,\n });\n }\n
|
|
1
|
+
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/config/+server.ts"],"sourcesContent":["import { error, json } from '@sveltejs/kit';\nimport { checkDto, ConfigPatchSchema } from '@screenreader-speech-capture/shared';\nimport type { RouteAnswers } from '#lib/core/routes.js';\nimport { readConfigState } from '#lib/server/config-state.js';\nimport type { RequestHandler } from './$types';\n\n/** The settings page's re-read in the browser (`readConfigState`). */\nexport const GET: RequestHandler = async ({ locals: { bridge } }) =>\n json((await readConfigState(bridge)) satisfies RouteAnswers['GET /api/config']);\n\n/** Saves a partial config for the next start and answers with the saved config. */\nexport const PUT: RequestHandler = async ({ request, locals }) => {\n const body: unknown = await request.json().catch(() => undefined);\n const checked = checkDto(ConfigPatchSchema, body);\n if (!checked.ok) {\n error(400, {\n message: `Invalid setting at ${checked.field}: ${checked.message}`,\n field: checked.field,\n });\n }\n const saved = await locals.bridge.updateConfig(checked.value);\n return json(saved satisfies RouteAnswers['PUT /api/config']);\n};\n"],"mappings":";;;;;AAOA,IAAa,MAAsB,OAAO,EAAE,QAAQ,EAAE,eACpD,KAAM,MAAM,gBAAgB,MAAM,CAA4C;;AAGhF,IAAa,MAAsB,OAAO,EAAE,SAAS,aAAa;CAChE,MAAM,OAAgB,MAAM,QAAQ,KAAK,CAAC,CAAC,YAAY,KAAA,CAAS;CAChE,MAAM,UAAU,SAAS,mBAAmB,IAAI;CAChD,IAAI,CAAC,QAAQ,IACX,MAAM,KAAK;EACT,SAAS,sBAAsB,QAAQ,MAAM,IAAI,QAAQ;EACzD,OAAO,QAAQ;CACjB,CAAC;CAEH,MAAM,QAAQ,MAAM,OAAO,OAAO,aAAa,QAAQ,KAAK;CAC5D,OAAO,KAAK,KAA+C;AAC7D"}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import { t as error } from "../../../../../chunks/exports.js";
|
|
2
|
-
import {
|
|
1
|
+
import { r as json, t as error } from "../../../../../chunks/exports.js";
|
|
2
|
+
import { l as KeysRequestSchema, n as checkDto } from "../../../../../chunks/src.js";
|
|
3
3
|
// src/routes/api/input/keys/+server.ts
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Presses keys (`{ keys, capture? }`) on the bridge's machine. With `capture` it answers with the
|
|
6
|
+
* speech they caused; a browser that gives up ends the bridge's capture too. Nothing else of the
|
|
7
|
+
* request goes on.
|
|
8
|
+
*/
|
|
5
9
|
var POST = async ({ request, locals }) => {
|
|
6
10
|
const body = await request.json().catch(() => void 0);
|
|
7
11
|
const checked = checkDto(KeysRequestSchema, body);
|
|
8
12
|
if (!checked.ok) error(400, `Invalid keys at ${checked.field}: ${checked.message}`);
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
const { keys, capture } = checked.value;
|
|
14
|
+
if (capture === void 0) {
|
|
15
|
+
await locals.bridge.pressKeys(keys);
|
|
16
|
+
return new Response(null, { status: 204 });
|
|
17
|
+
}
|
|
18
|
+
const answer = await locals.bridge.captureKeys(keys, capture, request.signal);
|
|
19
|
+
return json(answer);
|
|
11
20
|
};
|
|
12
21
|
export { POST };
|
|
13
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../../src/routes/api/input/keys/+server.ts"],"sourcesContent":["import { error } from '@sveltejs/kit';\nimport { checkDto, KeysRequestSchema } from '@screenreader-speech-capture/shared';\nimport type { RequestHandler } from './$types';\n\n
|
|
1
|
+
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../../src/routes/api/input/keys/+server.ts"],"sourcesContent":["import { error, json } from '@sveltejs/kit';\nimport { checkDto, KeysRequestSchema } from '@screenreader-speech-capture/shared';\nimport type { RouteAnswers } from '#lib/core/routes.js';\nimport type { RequestHandler } from './$types';\n\n/**\n * Presses keys (`{ keys, capture? }`) on the bridge's machine. With `capture` it answers with the\n * speech they caused; a browser that gives up ends the bridge's capture too. Nothing else of the\n * request goes on.\n */\nexport const POST: RequestHandler = async ({ request, locals }) => {\n const body: unknown = await request.json().catch(() => undefined);\n const checked = checkDto(KeysRequestSchema, body);\n if (!checked.ok) error(400, `Invalid keys at ${checked.field}: ${checked.message}`);\n const { keys, capture } = checked.value;\n if (capture === undefined) {\n await locals.bridge.pressKeys(keys);\n return new Response(null, { status: 204 });\n }\n const answer = await locals.bridge.captureKeys(keys, capture, request.signal);\n return json(answer satisfies RouteAnswers['POST /api/input/keys']);\n};\n"],"mappings":";;;;;;;;AAUA,IAAa,OAAuB,OAAO,EAAE,SAAS,aAAa;CACjE,MAAM,OAAgB,MAAM,QAAQ,KAAK,CAAC,CAAC,YAAY,KAAA,CAAS;CAChE,MAAM,UAAU,SAAS,mBAAmB,IAAI;CAChD,IAAI,CAAC,QAAQ,IAAI,MAAM,KAAK,mBAAmB,QAAQ,MAAM,IAAI,QAAQ,SAAS;CAClF,MAAM,EAAE,MAAM,YAAY,QAAQ;CAClC,IAAI,YAAY,KAAA,GAAW;EACzB,MAAM,OAAO,OAAO,UAAU,IAAI;EAClC,OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;CAC3C;CACA,MAAM,SAAS,MAAM,OAAO,OAAO,YAAY,MAAM,SAAS,QAAQ,MAAM;CAC5E,OAAO,KAAK,MAAqD;AACnE"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { r as json, t as error } from "../../../../chunks/exports.js";
|
|
2
|
-
import {
|
|
2
|
+
import { n as checkDto, u as MarkerRequestSchema } from "../../../../chunks/src.js";
|
|
3
3
|
// src/routes/api/markers/+server.ts
|
|
4
4
|
/** Inserts a marker (`{ label }`) into the timeline. */
|
|
5
5
|
var POST = async ({ request, locals }) => {
|
|
6
6
|
const body = await request.json().catch(() => void 0);
|
|
7
7
|
const checked = checkDto(MarkerRequestSchema, body);
|
|
8
8
|
if (!checked.ok) error(400, `Invalid marker at ${checked.field}: ${checked.message}`);
|
|
9
|
-
|
|
9
|
+
const marker = await locals.bridge.addMarker(checked.value.label);
|
|
10
|
+
return json(marker, { status: 201 });
|
|
10
11
|
};
|
|
11
12
|
export { POST };
|
|
12
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/markers/+server.ts"],"sourcesContent":["import { error, json } from '@sveltejs/kit';\nimport { checkDto, MarkerRequestSchema } from '@screenreader-speech-capture/shared';\nimport type { RequestHandler } from './$types';\n\n/** Inserts a marker (`{ label }`) into the timeline. */\nexport const POST: RequestHandler = async ({ request, locals }) => {\n const body: unknown = await request.json().catch(() => undefined);\n const checked = checkDto(MarkerRequestSchema, body);\n if (!checked.ok) error(400, `Invalid marker at ${checked.field}: ${checked.message}`);\n
|
|
1
|
+
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/markers/+server.ts"],"sourcesContent":["import { error, json } from '@sveltejs/kit';\nimport { checkDto, MarkerRequestSchema } from '@screenreader-speech-capture/shared';\nimport type { RouteAnswers } from '#lib/core/routes.js';\nimport type { RequestHandler } from './$types';\n\n/** Inserts a marker (`{ label }`) into the timeline. */\nexport const POST: RequestHandler = async ({ request, locals }) => {\n const body: unknown = await request.json().catch(() => undefined);\n const checked = checkDto(MarkerRequestSchema, body);\n if (!checked.ok) error(400, `Invalid marker at ${checked.field}: ${checked.message}`);\n const marker = await locals.bridge.addMarker(checked.value.label);\n return json(marker satisfies RouteAnswers['POST /api/markers'], { status: 201 });\n};\n"],"mappings":";;;;AAMA,IAAa,OAAuB,OAAO,EAAE,SAAS,aAAa;CACjE,MAAM,OAAgB,MAAM,QAAQ,KAAK,CAAC,CAAC,YAAY,KAAA,CAAS;CAChE,MAAM,UAAU,SAAS,qBAAqB,IAAI;CAClD,IAAI,CAAC,QAAQ,IAAI,MAAM,KAAK,qBAAqB,QAAQ,MAAM,IAAI,QAAQ,SAAS;CACpF,MAAM,SAAS,MAAM,OAAO,OAAO,UAAU,QAAQ,MAAM,KAAK;CAChE,OAAO,KAAK,QAAoD,EAAE,QAAQ,IAAI,CAAC;AACjF"}
|
|
@@ -6,7 +6,8 @@ var POST = async ({ request, locals }) => {
|
|
|
6
6
|
const body = await request.json().catch(() => void 0);
|
|
7
7
|
const checked = checkDto(StartSessionRequestSchema, body);
|
|
8
8
|
if (!checked.ok) error(400, `Invalid session at ${checked.field}: ${checked.message}`);
|
|
9
|
-
|
|
9
|
+
const started = await locals.bridge.startSession(checked.value);
|
|
10
|
+
return json(started, { status: 201 });
|
|
10
11
|
};
|
|
11
12
|
export { POST };
|
|
12
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/sessions/+server.ts"],"sourcesContent":["import { error, json } from '@sveltejs/kit';\nimport { checkDto, StartSessionRequestSchema } from '@screenreader-speech-capture/shared';\nimport type { RequestHandler } from './$types';\n\n/** Starts a session (`{ name, run? }`); the bridge ends the previous one. */\nexport const POST: RequestHandler = async ({ request, locals }) => {\n const body: unknown = await request.json().catch(() => undefined);\n const checked = checkDto(StartSessionRequestSchema, body);\n if (!checked.ok) error(400, `Invalid session at ${checked.field}: ${checked.message}`);\n
|
|
1
|
+
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/sessions/+server.ts"],"sourcesContent":["import { error, json } from '@sveltejs/kit';\nimport { checkDto, StartSessionRequestSchema } from '@screenreader-speech-capture/shared';\nimport type { RouteAnswers } from '#lib/core/routes.js';\nimport type { RequestHandler } from './$types';\n\n/** Starts a session (`{ name, run? }`); the bridge ends the previous one. */\nexport const POST: RequestHandler = async ({ request, locals }) => {\n const body: unknown = await request.json().catch(() => undefined);\n const checked = checkDto(StartSessionRequestSchema, body);\n if (!checked.ok) error(400, `Invalid session at ${checked.field}: ${checked.message}`);\n const started = await locals.bridge.startSession(checked.value);\n return json(started satisfies RouteAnswers['POST /api/sessions'], { status: 201 });\n};\n"],"mappings":";;;;AAMA,IAAa,OAAuB,OAAO,EAAE,SAAS,aAAa;CACjE,MAAM,OAAgB,MAAM,QAAQ,KAAK,CAAC,CAAC,YAAY,KAAA,CAAS;CAChE,MAAM,UAAU,SAAS,2BAA2B,IAAI;CACxD,IAAI,CAAC,QAAQ,IAAI,MAAM,KAAK,sBAAsB,QAAQ,MAAM,IAAI,QAAQ,SAAS;CACrF,MAAM,UAAU,MAAM,OAAO,OAAO,aAAa,QAAQ,KAAK;CAC9D,OAAO,KAAK,SAAsD,EAAE,QAAQ,IAAI,CAAC;AACnF"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { r as json
|
|
2
|
-
import { g as API_LIMITS } from "../../../../chunks/src.js";
|
|
1
|
+
import { r as json } from "../../../../chunks/exports.js";
|
|
3
2
|
import { t as scopeParam } from "../../../../chunks/scope.js";
|
|
4
3
|
// src/routes/api/speech/+server.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return parsed;
|
|
10
|
-
}
|
|
11
|
-
/** One page of a scope's speech (`?session=<id|none>&since=<seq>&limit=<n>`), oldest first. */
|
|
4
|
+
/**
|
|
5
|
+
* One page of a scope's speech (`?session=<id|none>&since=<seq>&limit=<n>`), oldest first. `since`
|
|
6
|
+
* and `limit` go on as they are: the bridge checks them, and its `400` comes back.
|
|
7
|
+
*/
|
|
12
8
|
var GET = async ({ url, locals }) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
const answer = await locals.bridge.speech(scopeParam(url), {
|
|
10
|
+
since: url.searchParams.get("since"),
|
|
11
|
+
limit: url.searchParams.get("limit")
|
|
12
|
+
});
|
|
13
|
+
return json(answer);
|
|
17
14
|
};
|
|
18
15
|
/** Clears the speech of the current session or of `none` (`?session=<id|none>`); it keeps running. */
|
|
19
16
|
var DELETE = async ({ url, locals }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/speech/+server.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/speech/+server.ts"],"sourcesContent":["import { json } from '@sveltejs/kit';\nimport type { RouteAnswers } from '#lib/core/routes.js';\nimport { scopeParam } from '#lib/server/scope.js';\nimport type { RequestHandler } from './$types';\n\n/**\n * One page of a scope's speech (`?session=<id|none>&since=<seq>&limit=<n>`), oldest first. `since`\n * and `limit` go on as they are: the bridge checks them, and its `400` comes back.\n */\nexport const GET: RequestHandler = async ({ url, locals }) => {\n const answer = await locals.bridge.speech(scopeParam(url), {\n since: url.searchParams.get('since'),\n limit: url.searchParams.get('limit'),\n });\n return json(answer satisfies RouteAnswers['GET /api/speech']);\n};\n\n/** Clears the speech of the current session or of `none` (`?session=<id|none>`); it keeps running. */\nexport const DELETE: RequestHandler = async ({ url, locals }) => {\n await locals.bridge.clearSpeech(scopeParam(url, true));\n return new Response(null, { status: 204 });\n};\n"],"mappings":";;;;;;;AASA,IAAa,MAAsB,OAAO,EAAE,KAAK,aAAa;CAC5D,MAAM,SAAS,MAAM,OAAO,OAAO,OAAO,WAAW,GAAG,GAAG;EACzD,OAAO,IAAI,aAAa,IAAI,OAAO;EACnC,OAAO,IAAI,aAAa,IAAI,OAAO;CACrC,CAAC;CACD,OAAO,KAAK,MAAgD;AAC9D;;AAGA,IAAa,SAAyB,OAAO,EAAE,KAAK,aAAa;CAC/D,MAAM,OAAO,OAAO,YAAY,WAAW,KAAK,IAAI,CAAC;CACrD,OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;AAC3C"}
|
|
@@ -2,7 +2,8 @@ import { r as json } from "../../../../chunks/exports.js";
|
|
|
2
2
|
// src/routes/api/status/+server.ts
|
|
3
3
|
/** The header's status read: the browser asks the BFF, the BFF asks the bridge. */
|
|
4
4
|
var GET = async ({ locals }) => {
|
|
5
|
-
|
|
5
|
+
const status = await locals.bridge.status();
|
|
6
|
+
return json(status);
|
|
6
7
|
};
|
|
7
8
|
export { GET };
|
|
8
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/status/+server.ts"],"sourcesContent":["import { json } from '@sveltejs/kit';\nimport type { RequestHandler } from './$types';\n\n/** The header's status read: the browser asks the BFF, the BFF asks the bridge. */\nexport const GET: RequestHandler = async ({ locals }) => {\n
|
|
1
|
+
{"version":3,"file":"_server.ts.js","names":[],"sources":["../../../../../../src/routes/api/status/+server.ts"],"sourcesContent":["import { json } from '@sveltejs/kit';\nimport type { RouteAnswers } from '#lib/core/routes.js';\nimport type { RequestHandler } from './$types';\n\n/** The header's status read: the browser asks the BFF, the BFF asks the bridge. */\nexport const GET: RequestHandler = async ({ locals }) => {\n const status = await locals.bridge.status();\n return json(status satisfies RouteAnswers['GET /api/status']);\n};\n"],"mappings":";;;AAKA,IAAa,MAAsB,OAAO,EAAE,aAAa;CACvD,MAAM,SAAS,MAAM,OAAO,OAAO,OAAO;CAC1C,OAAO,KAAK,MAAgD;AAC9D"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { a as SessionListSchema, c as InputCaptureSchema, d as SpeechEntrySchema, f as SpeechListSchema, h as ConfigSchema, i as CLIENT_HEADER, n as checkDto, p as ConfigOverridesSchema, r as StatusSchema, s as StartSessionResponseSchema, t as AnyErrorBodySchema } from "../chunks/src.js";
|
|
1
2
|
import { t as dynamic_private_env } from "../chunks/config.js";
|
|
2
3
|
import { t as error } from "../chunks/exports.js";
|
|
3
|
-
import { a as SessionListSchema, d as SpeechListSchema, f as ConfigOverridesSchema, i as CLIENT_HEADER, m as ConfigSchema, n as checkDto, r as StatusSchema, s as StartSessionResponseSchema, t as AnyErrorBodySchema, u as SpeechEntrySchema } from "../chunks/src.js";
|
|
4
4
|
// ../shared/src/api-version.ts
|
|
5
5
|
/** Path prefix of every API route. */
|
|
6
6
|
var API_PREFIX = "/api/v1";
|
|
7
|
+
// ../shared/src/ui-host.ts
|
|
8
|
+
/**
|
|
9
|
+
* The header that tells the UI its page is opened from the bridge's own machine, where the screen
|
|
10
|
+
* reader would read the live log and feed it back (docs/usage/web-ui.md#accessibility-of-the-ui-itself).
|
|
11
|
+
* The bridge sets (`1`) or removes it on every request, so a client can't send it.
|
|
12
|
+
*/
|
|
13
|
+
var LOCAL_HEADER = "x-sr-bridge-local";
|
|
14
|
+
/**
|
|
15
|
+
* Where the UI's server code finds the bridge log: a `Symbol.for` key on `globalThis`. Its lines
|
|
16
|
+
* get the `[web-ui]` prefix, go to the log file and never block on the console.
|
|
17
|
+
*/
|
|
18
|
+
var UI_LOGGER_KEY = Symbol.for("screenreader-speech-capture.ui-logger");
|
|
7
19
|
// .svelte-kit/generated/build/env/private/server.js
|
|
8
20
|
var SR_BRIDGE_API_URL = dynamic_private_env.SR_BRIDGE_API_URL;
|
|
9
21
|
// src/lib/server/bridge-api.ts
|
|
@@ -16,7 +28,7 @@ var UI_CLIENT = "web-ui";
|
|
|
16
28
|
function createBridgeApi(baseUrl, fetchFn) {
|
|
17
29
|
const root = baseUrl.replace(/\/+$/, "") + API_PREFIX;
|
|
18
30
|
const origin = new URL(root).origin;
|
|
19
|
-
async function call(method, path, body) {
|
|
31
|
+
async function call(method, path, body, signal) {
|
|
20
32
|
let response;
|
|
21
33
|
try {
|
|
22
34
|
response = await fetchFn(`${root}${path}`, {
|
|
@@ -27,7 +39,8 @@ function createBridgeApi(baseUrl, fetchFn) {
|
|
|
27
39
|
[CLIENT_HEADER]: UI_CLIENT,
|
|
28
40
|
...body === void 0 ? {} : { "content-type": "application/json" }
|
|
29
41
|
},
|
|
30
|
-
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
42
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
43
|
+
...signal === void 0 ? {} : { signal }
|
|
31
44
|
});
|
|
32
45
|
} catch (cause) {
|
|
33
46
|
error(502, `The bridge is not reachable: ${describe(cause)}`);
|
|
@@ -46,8 +59,8 @@ function createBridgeApi(baseUrl, fetchFn) {
|
|
|
46
59
|
}
|
|
47
60
|
return answer;
|
|
48
61
|
}
|
|
49
|
-
async function read(method, path, schema, body) {
|
|
50
|
-
const checked = checkDto(schema, await call(method, path, body));
|
|
62
|
+
async function read(method, path, schema, body, signal) {
|
|
63
|
+
const checked = checkDto(schema, await call(method, path, body, signal));
|
|
51
64
|
if (!checked.ok) error(502, `Unexpected answer from the bridge at ${checked.field}: ${checked.message}`);
|
|
52
65
|
return checked.value;
|
|
53
66
|
}
|
|
@@ -70,12 +83,15 @@ function createBridgeApi(baseUrl, fetchFn) {
|
|
|
70
83
|
pressKeys: async (keys) => {
|
|
71
84
|
await call("POST", "/input/keys", { keys });
|
|
72
85
|
},
|
|
86
|
+
captureKeys: (keys, capture, signal) => read("POST", "/input/keys", InputCaptureSchema, {
|
|
87
|
+
keys,
|
|
88
|
+
capture
|
|
89
|
+
}, signal),
|
|
73
90
|
addMarker: (label) => read("POST", "/markers", SpeechEntrySchema, { label }),
|
|
74
|
-
speech: (session, since, limit) => {
|
|
75
|
-
const query = new URLSearchParams(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
91
|
+
speech: (session, { since, limit }) => {
|
|
92
|
+
const query = new URLSearchParams();
|
|
93
|
+
if (since !== null) query.set("since", since);
|
|
94
|
+
if (limit !== null) query.set("limit", limit);
|
|
79
95
|
if (session !== null) query.set("session", String(session));
|
|
80
96
|
return read("GET", `/speech?${query}`, SpeechListSchema);
|
|
81
97
|
},
|
|
@@ -112,12 +128,6 @@ function bridgeApiFromEnv(fetchFn) {
|
|
|
112
128
|
return createBridgeApi(SR_BRIDGE_API_URL, fetchFn);
|
|
113
129
|
}
|
|
114
130
|
// src/lib/server/log.ts
|
|
115
|
-
/**
|
|
116
|
-
* Where the bridge puts its `[web-ui]` logger before it loads the UI (`UI_LOGGER_KEY` in
|
|
117
|
-
* `packages/bridge/src/adapters/in/http/ui-mount.ts`; the bridge and the UI don't import each
|
|
118
|
-
* other).
|
|
119
|
-
*/
|
|
120
|
-
var BRIDGE_LOGGER_KEY = Symbol.for("screenreader-speech-capture.ui-logger");
|
|
121
131
|
function isServerLog(value) {
|
|
122
132
|
return typeof value === "object" && value !== null && typeof value.error === "function" && typeof value.warn === "function";
|
|
123
133
|
}
|
|
@@ -127,20 +137,14 @@ var consoleLog = {
|
|
|
127
137
|
warn: (message) => console.warn(`[web-ui] ${message}`)
|
|
128
138
|
};
|
|
129
139
|
/**
|
|
130
|
-
* The bridge log
|
|
131
|
-
* whether this module loads before or after the bridge sets it.
|
|
140
|
+
* The bridge log the bridge puts on `globalThis` before it loads the UI, the console otherwise.
|
|
141
|
+
* Read per call, so it doesn't matter whether this module loads before or after the bridge sets it.
|
|
132
142
|
*/
|
|
133
143
|
function serverLog() {
|
|
134
|
-
const bridge = globalThis[
|
|
144
|
+
const bridge = globalThis[UI_LOGGER_KEY];
|
|
135
145
|
return isServerLog(bridge) ? bridge : consoleLog;
|
|
136
146
|
}
|
|
137
147
|
// src/hooks.server.ts
|
|
138
|
-
/**
|
|
139
|
-
* Set by the bridge (`LOCAL_HEADER` in `packages/bridge/src/adapters/in/http/ui-mount.ts`) on a request that
|
|
140
|
-
* comes from the bridge's own machine, and removed from every other one. The UI can't import it:
|
|
141
|
-
* the bridge and the UI don't depend on each other.
|
|
142
|
-
*/
|
|
143
|
-
var LOCAL_HEADER = "x-sr-bridge-local";
|
|
144
148
|
var handle = ({ event, resolve }) => {
|
|
145
149
|
event.locals.local = event.request.headers.get(LOCAL_HEADER) === "1";
|
|
146
150
|
event.locals.bridge = bridgeApiFromEnv(event.fetch);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.server.js","names":["env"],"sources":["../../../../shared/src/api-version.ts","../../../.svelte-kit/generated/build/env/private/server.js","../../../src/lib/server/bridge-api.ts","../../../src/lib/server/bridge-from-env.ts","../../../src/lib/server/log.ts","../../../src/hooks.server.ts"],"sourcesContent":["/**\n * `<major>.<minor>` of the HTTP API. Minor versions only add things, with the exceptions in\n * docs/usage/http-api.md#versioning. Within a major version the enums of the answers never grow\n * (`openapi/freeze.test.ts`).\n */\nexport const API_VERSION = '1.33';\n\n/** Path prefix of every API route. */\nexport const API_PREFIX = '/api/v1';\n\n/**\n * Response header with {@link API_VERSION} on every answer under {@link API_PREFIX} (since 1.22),\n * so a client checks the version on each answer instead of asking `GET /status` first.\n */\nexport const API_VERSION_HEADER = 'X-SR-Speech-Api-Version';\n","import { dynamic_private_env as env } from '../config.js';\n\nexport const SR_BRIDGE_API_URL = env.SR_BRIDGE_API_URL;\n","import { error } from '@sveltejs/kit';\nimport {\n AnyErrorBodySchema,\n API_PREFIX,\n CLIENT_HEADER,\n checkDto,\n ConfigOverridesSchema,\n ConfigSchema,\n SessionListSchema,\n SpeechEntrySchema,\n SpeechListSchema,\n StartSessionResponseSchema,\n StatusSchema,\n type ConfigDto,\n type ConfigOverridesDto,\n type ConfigPatchDto,\n type DtoOf,\n type DtoSchema,\n type KeysRequestDto,\n type SessionListDto,\n type SpeechEntryDto,\n type SpeechListDto,\n type StartSessionRequestDto,\n type StartSessionResponseDto,\n type StatusDto,\n} from '@screenreader-speech-capture/shared';\nimport type { SessionScope } from '#lib/core/sessions.js';\n\ntype Fetch = typeof fetch;\n\n/** The bridge's HTTP API as the BFF uses it: the only place the UI server talks to the bridge. */\nexport interface BridgeApi {\n status(): Promise<StatusDto>;\n sessions(): Promise<SessionListDto>;\n startSession(request: StartSessionRequestDto): Promise<StartSessionResponseDto>;\n /** Ends the current session; does nothing if none is current. */\n endSession(): Promise<void>;\n /** Deletes an ended session and its speech (the bridge refuses the current one). */\n deleteSession(id: number): Promise<void>;\n /** Clears the speech of the current session or of `none` (`session`: an id or `none`); it keeps running. */\n clearSpeech(session: SessionScope): Promise<void>;\n /** The configuration in use (`active`) or the one the next start will use (`saved`). */\n config(view: 'active' | 'saved'): Promise<ConfigDto>;\n /** The settings a flag or environment variable sets: the config file can't change them. */\n configOverrides(): Promise<ConfigOverridesDto>;\n /**\n * Saves a partial config for the next start and answers with the saved config. Rejects with the\n * bridge's status and message, plus `field` (`tcp.port`) when the bridge names one.\n */\n updateConfig(patch: ConfigPatchDto): Promise<ConfigDto>;\n /** Presses keys in the foreground window of the bridge's machine. */\n pressKeys(keys: KeysRequestDto['keys']): Promise<void>;\n /** Inserts a marker; the bridge files it under the current session (or outside any). */\n addMarker(label: string): Promise<SpeechEntryDto>;\n /** One page of a scope's entries with `seq > since`, oldest first (`session`: an id or `none`). */\n speech(session: SessionScope | null, since: number, limit: number): Promise<SpeechListDto>;\n /**\n * Opens the bridge's SSE stream (`session`: an id or `none`). The body is passed on as it is,\n * so `Last-Event-ID` replays and every event name reach the browser untouched.\n */\n openSpeechStream(\n session: SessionScope | null,\n lastEventId: string | null,\n signal: AbortSignal,\n ): Promise<Response>;\n}\n\n/** Named in the bridge's logs when this UI ends or replaces another client's session. */\nconst UI_CLIENT = 'web-ui';\n\n/**\n * `baseUrl` is the bridge's origin (no path). `fetchFn` is SvelteKit's `event.fetch` in\n * routes and a fake in tests.\n */\nexport function createBridgeApi(baseUrl: string, fetchFn: Fetch): BridgeApi {\n const root = baseUrl.replace(/\\/+$/, '') + API_PREFIX;\n // SvelteKit's `event.fetch` adds `Origin: <the UI's own origin>` to every call to another origin\n // (`pnpm dev:ui`: http://localhost:5173). The bridge refuses a POST from any origin but its own\n // (docs/usage/security.md#host-and-origin), so name the bridge itself: this is a server-side\n // call, not a page of another site.\n const origin = new URL(root).origin;\n\n async function call(\n method: 'GET' | 'POST' | 'PUT' | 'DELETE',\n path: string,\n body?: unknown,\n ): Promise<unknown> {\n let response: Response;\n try {\n response = await fetchFn(`${root}${path}`, {\n method,\n headers: {\n accept: 'application/json',\n origin,\n [CLIENT_HEADER]: UI_CLIENT,\n ...(body === undefined ? {} : { 'content-type': 'application/json' }),\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n } catch (cause) {\n error(502, `The bridge is not reachable: ${describe(cause)}`);\n }\n const answer: unknown = await response.json().catch(() => undefined);\n if (!response.ok) {\n const apiError = checkDto(AnyErrorBodySchema, answer);\n if (!apiError.ok) error(response.status, `The bridge answered ${response.status}`);\n const { message, details } = apiError.value.error;\n const field = details?.field;\n if (typeof field === 'string') error(response.status, { message, field });\n error(response.status, message);\n }\n return answer;\n }\n\n async function read<S extends DtoSchema>(\n method: 'GET' | 'POST' | 'PUT',\n path: string,\n schema: S,\n body?: unknown,\n ): Promise<DtoOf<S>> {\n const checked = checkDto(schema, await call(method, path, body));\n if (!checked.ok) {\n error(502, `Unexpected answer from the bridge at ${checked.field}: ${checked.message}`);\n }\n return checked.value;\n }\n\n return {\n status: () => read('GET', '/status', StatusSchema),\n sessions: () => read('GET', '/sessions', SessionListSchema),\n startSession: (request) => read('POST', '/sessions', StartSessionResponseSchema, request),\n endSession: async () => {\n await call('POST', '/sessions/end');\n },\n deleteSession: async (id) => {\n await call('DELETE', `/sessions?session=${id}`);\n },\n clearSpeech: async (session) => {\n await call('DELETE', `/speech?session=${session}`);\n },\n config: (view) => read('GET', `/config?view=${view}`, ConfigSchema),\n configOverrides: () => read('GET', '/config/overrides', ConfigOverridesSchema),\n updateConfig: (patch) => read('PUT', '/config', ConfigSchema, patch),\n pressKeys: async (keys) => {\n await call('POST', '/input/keys', { keys });\n },\n addMarker: (label) => read('POST', '/markers', SpeechEntrySchema, { label }),\n speech: (session, since, limit) => {\n const query = new URLSearchParams({ since: String(since), limit: String(limit) });\n if (session !== null) query.set('session', String(session));\n return read('GET', `/speech?${query}`, SpeechListSchema);\n },\n openSpeechStream: async (session, lastEventId, signal) => {\n const query = session === null ? '' : `?session=${session}`;\n let response: Response;\n try {\n response = await fetchFn(`${root}/speech/stream${query}`, {\n headers: {\n accept: 'text/event-stream',\n origin,\n [CLIENT_HEADER]: UI_CLIENT,\n ...(lastEventId === null ? {} : { 'last-event-id': lastEventId }),\n },\n signal,\n });\n } catch (cause) {\n error(502, `The bridge is not reachable: ${describe(cause)}`);\n }\n if (!response.ok || response.body === null) {\n // Unread, the body would hold the bridge connection until it is garbage collected, and\n // `EventSource` retries every few seconds while the bridge refuses.\n await response.body?.cancel().catch(() => undefined);\n error(\n response.status === 200 ? 502 : response.status,\n 'The speech stream is not available',\n );\n }\n return response;\n },\n };\n}\n\nfunction describe(cause: unknown): string {\n return cause instanceof Error ? cause.message : String(cause);\n}\n","import { SR_BRIDGE_API_URL } from '$app/env/private';\nimport { createBridgeApi, type BridgeApi } from './bridge-api.js';\n\n/** The bridge API of this deployment, at `SR_BRIDGE_API_URL` (`src/env.ts`). */\nexport function bridgeApiFromEnv(fetchFn: typeof fetch): BridgeApi {\n return createBridgeApi(SR_BRIDGE_API_URL, fetchFn);\n}\n","/** What the BFF logs through: the bridge's `Logger` port, as far as the UI uses it. */\nexport interface ServerLog {\n error(message: string): void;\n warn(message: string): void;\n}\n\n/**\n * Where the bridge puts its `[web-ui]` logger before it loads the UI (`UI_LOGGER_KEY` in\n * `packages/bridge/src/adapters/in/http/ui-mount.ts`; the bridge and the UI don't import each\n * other).\n */\nconst BRIDGE_LOGGER_KEY = Symbol.for('screenreader-speech-capture.ui-logger');\n\nfunction isServerLog(value: unknown): value is ServerLog {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as ServerLog).error === 'function' &&\n typeof (value as ServerLog).warn === 'function'\n );\n}\n\n/** `pnpm dev:ui` has no bridge in its process: the Vite dev server's console stands in. */\nconst consoleLog: ServerLog = {\n error: (message) => console.error(`[web-ui] ${message}`),\n warn: (message) => console.warn(`[web-ui] ${message}`),\n};\n\n/**\n * The bridge log inside the bridge, the console otherwise. Read per call, so it doesn't matter\n * whether this module loads before or after the bridge sets it.\n */\nexport function serverLog(): ServerLog {\n const bridge = (globalThis as Record<symbol, unknown>)[BRIDGE_LOGGER_KEY];\n return isServerLog(bridge) ? bridge : consoleLog;\n}\n","import type { Handle, HandleServerError } from '@sveltejs/kit/hooks';\nimport { bridgeApiFromEnv } from '#lib/server/bridge-from-env.js';\nimport { serverLog } from '#lib/server/log.js';\n\n/**\n * Set by the bridge (`LOCAL_HEADER` in `packages/bridge/src/adapters/in/http/ui-mount.ts`) on a request that\n * comes from the bridge's own machine, and removed from every other one. The UI can't import it:\n * the bridge and the UI don't depend on each other.\n */\nconst LOCAL_HEADER = 'x-sr-bridge-local';\n\nexport const handle: Handle = ({ event, resolve }) => {\n event.locals.local = event.request.headers.get(LOCAL_HEADER) === '1';\n // Built once per request and with its `fetch`, so routes and loads share one way to the bridge.\n event.locals.bridge = bridgeApiFromEnv(event.fetch);\n return resolve(event);\n};\n\n/**\n * An unexpected error (`kind: 'unknown'`: not one thrown with `error()`, not SvelteKit's own such\n * as a 404) is one line in the bridge log; the browser keeps SvelteKit's generic answer. The line\n * names the path but never the query, which can hold speech text that must stay off the console\n * (docs/usage/operations.md#speech-text-stays-off-the-console).\n */\nexport const handleError: HandleServerError = ({ kind, error, event }) => {\n if (kind !== 'unknown') return;\n const reason = error instanceof Error ? `${error.name}: ${error.message}` : String(error);\n serverLog().error(`${event.request.method} ${event.url.pathname}: ${reason}`);\n};\n"],"mappings":";;;;;AAQA,IAAa,aAAa;;ACN1B,IAAa,oBAAoBA,oBAAI;;;ACkErC,IAAM,YAAY;;;;;AAMlB,SAAgB,gBAAgB,SAAiB,SAA2B;CAC1E,MAAM,OAAO,QAAQ,QAAQ,QAAQ,EAAE,IAAI;CAK3C,MAAM,SAAS,IAAI,IAAI,IAAI,CAAC,CAAC;CAE7B,eAAe,KACb,QACA,MACA,MACkB;EAClB,IAAI;EACJ,IAAI;GACF,WAAW,MAAM,QAAQ,GAAG,OAAO,QAAQ;IACzC;IACA,SAAS;KACP,QAAQ;KACR;MACC,gBAAgB;KACjB,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,mBAAmB;IACrE;IACA,MAAM,SAAS,KAAA,IAAY,KAAA,IAAY,KAAK,UAAU,IAAI;GAC5D,CAAC;EACH,SAAS,OAAO;GACd,MAAM,K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,KAAK,YAAY,SAAS;AACvD;;;;;AAMA,SAAgB,YAAuB;CACrC,MAAM,SAAU,WAAuC;CACvD,OAAO,YAAY,MAAM,IAAI,SAAS;AACxC;;;;;;;AC1BA,IAAM,eAAe;AAErB,IAAa,UAAkB,EAAE,OAAO,cAAc;CACpD,MAAM,OAAO,QAAQ,MAAM,QAAQ,QAAQ,IAAI,YAAY,MAAM;CAEjE,MAAM,OAAO,SAAS,iBAAiB,MAAM,KAAK;CAClD,OAAO,QAAQ,KAAK;AACtB;;;;;;;AAQA,IAAa,eAAkC,EAAE,MAAM,OAAO,YAAY;CACxE,IAAI,SAAS,WAAW;CACxB,MAAM,SAAS,iBAAiB,QAAQ,GAAG,MAAM,KAAK,IAAI,MAAM,YAAY,OAAO,KAAK;CACxF,UAAU,CAAC,CAAC,MAAM,GAAG,MAAM,QAAQ,OAAO,GAAG,MAAM,IAAI,SAAS,IAAI,QAAQ;AAC9E"}
|
|
1
|
+
{"version":3,"file":"hooks.server.js","names":["env"],"sources":["../../../../shared/src/api-version.ts","../../../../shared/src/ui-host.ts","../../../.svelte-kit/generated/build/env/private/server.js","../../../src/lib/server/bridge-api.ts","../../../src/lib/server/bridge-from-env.ts","../../../src/lib/server/log.ts","../../../src/hooks.server.ts"],"sourcesContent":["/**\n * `<major>.<minor>` of the HTTP API. Minor versions only add things, with the exceptions in\n * docs/usage/http-api.md#versioning. Within a major version the enums of the answers never grow\n * (`openapi/freeze.test.ts`).\n */\nexport const API_VERSION = '1.33';\n\n/** Path prefix of every API route. */\nexport const API_PREFIX = '/api/v1';\n\n/**\n * Response header with {@link API_VERSION} on every answer under {@link API_PREFIX} (since 1.22),\n * so a client checks the version on each answer instead of asking `GET /status` first.\n */\nexport const API_VERSION_HEADER = 'X-SR-Speech-Api-Version';\n","// What the bridge hands the web UI it hosts (docs/implementation/architecture.md#the-web-ui-a-sveltekit-bff).\n// The bridge and the UI don't import each other; both import these names, so a rename can't turn\n// one side off unnoticed.\n\n/** The environment variable the UI's BFF reads the bridge's address from. */\nexport const BRIDGE_API_URL_ENV = 'SR_BRIDGE_API_URL';\n\n/**\n * The header that tells the UI its page is opened from the bridge's own machine, where the screen\n * reader would read the live log and feed it back (docs/usage/web-ui.md#accessibility-of-the-ui-itself).\n * The bridge sets (`1`) or removes it on every request, so a client can't send it.\n */\nexport const LOCAL_HEADER = 'x-sr-bridge-local';\n\n/**\n * Where the UI's server code finds the bridge log: a `Symbol.for` key on `globalThis`. Its lines\n * get the `[web-ui]` prefix, go to the log file and never block on the console.\n */\nexport const UI_LOGGER_KEY = Symbol.for('screenreader-speech-capture.ui-logger');\n\n/** What the UI's server code logs through: the bridge's `Logger`, as far as the UI uses it. */\nexport interface UiServerLog {\n error(message: string): void;\n warn(message: string): void;\n}\n","import { dynamic_private_env as env } from '../config.js';\n\nexport const SR_BRIDGE_API_URL = env.SR_BRIDGE_API_URL;\n","import { error } from '@sveltejs/kit';\nimport {\n AnyErrorBodySchema,\n API_PREFIX,\n CLIENT_HEADER,\n checkDto,\n InputCaptureSchema,\n type CaptureOptionsDto,\n type InputCaptureDto,\n ConfigOverridesSchema,\n ConfigSchema,\n SessionListSchema,\n SpeechEntrySchema,\n SpeechListSchema,\n StartSessionResponseSchema,\n StatusSchema,\n type ConfigDto,\n type ConfigOverridesDto,\n type ConfigPatchDto,\n type DtoOf,\n type DtoSchema,\n type KeysRequestDto,\n type SessionListDto,\n type SpeechEntryDto,\n type SpeechListDto,\n type StartSessionRequestDto,\n type StartSessionResponseDto,\n type StatusDto,\n} from '@screenreader-speech-capture/shared';\nimport type { SessionScope } from '#lib/core/sessions.js';\n\ntype Fetch = typeof fetch;\n\n/** Which page of speech to read, as the browser asked; the bridge checks it. */\nexport interface SpeechPageQuery {\n since: string | null;\n limit: string | null;\n}\n\n/** The bridge's HTTP API as the BFF uses it: the only place the UI server talks to the bridge. */\nexport interface BridgeApi {\n status(): Promise<StatusDto>;\n sessions(): Promise<SessionListDto>;\n startSession(request: StartSessionRequestDto): Promise<StartSessionResponseDto>;\n /** Ends the current session; does nothing if none is current. */\n endSession(): Promise<void>;\n /** Deletes an ended session and its speech (the bridge refuses the current one). */\n deleteSession(id: number): Promise<void>;\n /** Clears the speech of the current session or of `none` (`session`: an id or `none`); it keeps running. */\n clearSpeech(session: SessionScope): Promise<void>;\n /** The configuration in use (`active`) or the one the next start will use (`saved`). */\n config(view: 'active' | 'saved'): Promise<ConfigDto>;\n /** The settings a flag or environment variable sets: the config file can't change them. */\n configOverrides(): Promise<ConfigOverridesDto>;\n /**\n * Saves a partial config for the next start and answers with the saved config. Rejects with the\n * bridge's status and message, plus `field` (`tcp.port`) when the bridge names one.\n */\n updateConfig(patch: ConfigPatchDto): Promise<ConfigDto>;\n /** Presses keys in the foreground window of the bridge's machine. */\n pressKeys(keys: KeysRequestDto['keys']): Promise<void>;\n /** Presses keys and answers with the speech they caused; `signal` ends the capture. */\n captureKeys(\n keys: KeysRequestDto['keys'],\n capture: CaptureOptionsDto,\n signal: AbortSignal,\n ): Promise<InputCaptureDto>;\n /** Inserts a marker; the bridge files it under the current session (or outside any). */\n addMarker(label: string): Promise<SpeechEntryDto>;\n /** One page of a scope's entries with `seq > since`, oldest first (`session`: an id or `none`). */\n speech(session: SessionScope | null, page: SpeechPageQuery): Promise<SpeechListDto>;\n /**\n * Opens the bridge's SSE stream (`session`: an id or `none`). The body is passed on as it is,\n * so `Last-Event-ID` replays and every event name reach the browser untouched.\n */\n openSpeechStream(\n session: SessionScope | null,\n lastEventId: string | null,\n signal: AbortSignal,\n ): Promise<Response>;\n}\n\n/** Named in the bridge's logs when this UI ends or replaces another client's session. */\nconst UI_CLIENT = 'web-ui';\n\n/**\n * `baseUrl` is the bridge's origin (no path). `fetchFn` is SvelteKit's `event.fetch` in\n * routes and a fake in tests.\n */\nexport function createBridgeApi(baseUrl: string, fetchFn: Fetch): BridgeApi {\n const root = baseUrl.replace(/\\/+$/, '') + API_PREFIX;\n // SvelteKit's `event.fetch` adds `Origin: <the UI's own origin>` to every call to another origin\n // (`pnpm dev:ui`: http://localhost:5173). The bridge refuses a POST from any origin but its own\n // (docs/usage/security.md#host-and-origin), so name the bridge itself: this is a server-side\n // call, not a page of another site.\n const origin = new URL(root).origin;\n\n async function call(\n method: 'GET' | 'POST' | 'PUT' | 'DELETE',\n path: string,\n body?: unknown,\n signal?: AbortSignal,\n ): Promise<unknown> {\n let response: Response;\n try {\n response = await fetchFn(`${root}${path}`, {\n method,\n headers: {\n accept: 'application/json',\n origin,\n [CLIENT_HEADER]: UI_CLIENT,\n ...(body === undefined ? {} : { 'content-type': 'application/json' }),\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n ...(signal === undefined ? {} : { signal }),\n });\n } catch (cause) {\n error(502, `The bridge is not reachable: ${describe(cause)}`);\n }\n const answer: unknown = await response.json().catch(() => undefined);\n if (!response.ok) {\n const apiError = checkDto(AnyErrorBodySchema, answer);\n if (!apiError.ok) error(response.status, `The bridge answered ${response.status}`);\n const { message, details } = apiError.value.error;\n const field = details?.field;\n if (typeof field === 'string') error(response.status, { message, field });\n error(response.status, message);\n }\n return answer;\n }\n\n async function read<S extends DtoSchema>(\n method: 'GET' | 'POST' | 'PUT',\n path: string,\n schema: S,\n body?: unknown,\n signal?: AbortSignal,\n ): Promise<DtoOf<S>> {\n const checked = checkDto(schema, await call(method, path, body, signal));\n if (!checked.ok) {\n error(502, `Unexpected answer from the bridge at ${checked.field}: ${checked.message}`);\n }\n return checked.value;\n }\n\n return {\n status: () => read('GET', '/status', StatusSchema),\n sessions: () => read('GET', '/sessions', SessionListSchema),\n startSession: (request) => read('POST', '/sessions', StartSessionResponseSchema, request),\n endSession: async () => {\n await call('POST', '/sessions/end');\n },\n deleteSession: async (id) => {\n await call('DELETE', `/sessions?session=${id}`);\n },\n clearSpeech: async (session) => {\n await call('DELETE', `/speech?session=${session}`);\n },\n config: (view) => read('GET', `/config?view=${view}`, ConfigSchema),\n configOverrides: () => read('GET', '/config/overrides', ConfigOverridesSchema),\n updateConfig: (patch) => read('PUT', '/config', ConfigSchema, patch),\n pressKeys: async (keys) => {\n await call('POST', '/input/keys', { keys });\n },\n captureKeys: (keys, capture, signal) =>\n read('POST', '/input/keys', InputCaptureSchema, { keys, capture }, signal),\n addMarker: (label) => read('POST', '/markers', SpeechEntrySchema, { label }),\n speech: (session, { since, limit }) => {\n const query = new URLSearchParams();\n if (since !== null) query.set('since', since);\n if (limit !== null) query.set('limit', limit);\n if (session !== null) query.set('session', String(session));\n return read('GET', `/speech?${query}`, SpeechListSchema);\n },\n openSpeechStream: async (session, lastEventId, signal) => {\n const query = session === null ? '' : `?session=${session}`;\n let response: Response;\n try {\n response = await fetchFn(`${root}/speech/stream${query}`, {\n headers: {\n accept: 'text/event-stream',\n origin,\n [CLIENT_HEADER]: UI_CLIENT,\n ...(lastEventId === null ? {} : { 'last-event-id': lastEventId }),\n },\n signal,\n });\n } catch (cause) {\n error(502, `The bridge is not reachable: ${describe(cause)}`);\n }\n if (!response.ok || response.body === null) {\n // Unread, the body would hold the bridge connection until it is garbage collected, and\n // `EventSource` retries every few seconds while the bridge refuses.\n await response.body?.cancel().catch(() => undefined);\n error(\n response.status === 200 ? 502 : response.status,\n 'The speech stream is not available',\n );\n }\n return response;\n },\n };\n}\n\nfunction describe(cause: unknown): string {\n return cause instanceof Error ? cause.message : String(cause);\n}\n","import { SR_BRIDGE_API_URL } from '$app/env/private';\nimport { createBridgeApi, type BridgeApi } from './bridge-api.js';\n\n/** The bridge API of this deployment, at `SR_BRIDGE_API_URL` (`src/env.ts`). */\nexport function bridgeApiFromEnv(fetchFn: typeof fetch): BridgeApi {\n return createBridgeApi(SR_BRIDGE_API_URL, fetchFn);\n}\n","import { UI_LOGGER_KEY, type UiServerLog } from '@screenreader-speech-capture/shared';\n\nfunction isServerLog(value: unknown): value is UiServerLog {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as UiServerLog).error === 'function' &&\n typeof (value as UiServerLog).warn === 'function'\n );\n}\n\n/** `pnpm dev:ui` has no bridge in its process: the Vite dev server's console stands in. */\nconst consoleLog: UiServerLog = {\n error: (message) => console.error(`[web-ui] ${message}`),\n warn: (message) => console.warn(`[web-ui] ${message}`),\n};\n\n/**\n * The bridge log the bridge puts on `globalThis` before it loads the UI, the console otherwise.\n * Read per call, so it doesn't matter whether this module loads before or after the bridge sets it.\n */\nexport function serverLog(): UiServerLog {\n const bridge = (globalThis as Record<symbol, unknown>)[UI_LOGGER_KEY];\n return isServerLog(bridge) ? bridge : consoleLog;\n}\n","import { LOCAL_HEADER } from '@screenreader-speech-capture/shared';\nimport type { Handle, HandleServerError } from '@sveltejs/kit/hooks';\nimport { bridgeApiFromEnv } from '#lib/server/bridge-from-env.js';\nimport { serverLog } from '#lib/server/log.js';\n\nexport const handle: Handle = ({ event, resolve }) => {\n // Set by the bridge on a request from its own machine, and removed from every other one.\n event.locals.local = event.request.headers.get(LOCAL_HEADER) === '1';\n // Built once per request and with its `fetch`, so routes and loads share one way to the bridge.\n event.locals.bridge = bridgeApiFromEnv(event.fetch);\n return resolve(event);\n};\n\n/**\n * An unexpected error (`kind: 'unknown'`: not one thrown with `error()`, not SvelteKit's own such\n * as a 404) is one line in the bridge log; the browser keeps SvelteKit's generic answer. The line\n * names the path but never the query, which can hold speech text that must stay off the console\n * (docs/usage/operations.md#speech-text-stays-off-the-console).\n */\nexport const handleError: HandleServerError = ({ kind, error, event }) => {\n if (kind !== 'unknown') return;\n const reason = error instanceof Error ? `${error.name}: ${error.message}` : String(error);\n serverLog().error(`${event.request.method} ${event.url.pathname}: ${reason}`);\n};\n"],"mappings":";;;;;AAQA,IAAa,aAAa;;;;;;;ACI1B,IAAa,eAAe;;;;;AAM5B,IAAa,gBAAgB,OAAO,IAAI,uCAAuC;;AChB/E,IAAa,oBAAoBA,oBAAI;;;ACiFrC,IAAM,YAAY;;;;;AAMlB,SAAgB,gBAAgB,SAAiB,SAA2B;CAC1E,MAAM,OAAO,QAAQ,QAAQ,QAAQ,EAAE,IAAI;CAK3C,MAAM,SA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