dsh-builtin-browser 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +89 -0
- package/browser-extension/constants.mjs +20 -0
- package/browser-extension/controller.mjs +293 -0
- package/browser-extension/locales.mjs +15 -0
- package/browser-extension/manifest.json +12 -0
- package/browser-extension/options.html +14 -0
- package/browser-extension/options.mjs +9 -0
- package/browser-extension/permission-guard.mjs +13 -0
- package/browser-extension/worker.mjs +74 -0
- package/package.json +20 -2
- package/scripts/build-client.mjs +305 -0
- package/scripts/build.mjs +69 -0
- package/scripts/bundle-host.mjs +28 -0
- package/scripts/fix-exports.mjs +40 -0
- package/scripts/install-electron.mjs +101 -0
- package/scripts/pack.mjs +99 -0
- package/scripts/publish-manifest.mjs +56 -0
- package/scripts/verify-exports.mjs +58 -0
- package/scripts/verify-preview-sdk.mjs +93 -0
- package/skills/dsh-builtin-browser/SKILL.md +98 -0
- package/skills/dsh-builtin-browser/references/batch.md +68 -0
- package/skills/dsh-builtin-browser/references/deliver.md +31 -0
- package/skills/dsh-builtin-browser/references/locate.md +11 -0
- package/skills/dsh-builtin-browser/references/recover.md +11 -0
- package/skills/dsh-builtin-browser/references/verify.md +13 -0
- package/skills/dsh-debug-host/SKILL.md +56 -0
- package/skills/dsh-debug-self/SKILL.md +50 -0
- package/src/bridge-compatibility.ts +39 -0
- package/src/browser/anti-bot.ts +251 -0
- package/src/browser/deep-dom.ts +40 -0
- package/src/browser/handles.ts +89 -0
- package/src/browser/runtime.ts +578 -0
- package/src/browser/takeover-target.ts +45 -0
- package/src/browser/types.ts +870 -0
- package/src/browser-electron/authenticated-route.ts +109 -0
- package/src/browser-electron/automatic-maintenance.ts +736 -0
- package/src/browser-electron/bridge-auto.ts +159 -0
- package/src/browser-electron/bridge-connection.ts +386 -0
- package/src/browser-electron/bridge-endpoint.ts +129 -0
- package/src/browser-electron/bridge-install.ts +290 -0
- package/src/browser-electron/bridge-maintenance.ts +189 -0
- package/src/browser-electron/bridge-status.ts +386 -0
- package/src/browser-electron/desktop-bridge-host.ts +253 -0
- package/src/browser-electron/desktop-identity.ts +353 -0
- package/src/browser-electron/desktop-shell.ts +100 -0
- package/src/browser-electron/document-readiness.ts +45 -0
- package/src/browser-electron/electron-provision.ts +347 -0
- package/src/browser-electron/entry.ts +1378 -0
- package/src/browser-electron/ephemeral-profile.ts +189 -0
- package/src/browser-electron/extension-browser.ts +230 -0
- package/src/browser-electron/extension-setup.ts +67 -0
- package/src/browser-electron/file-write.ts +31 -0
- package/src/browser-electron/foreground-watch.ts +142 -0
- package/src/browser-electron/guest-cookie-jar.ts +177 -0
- package/src/browser-electron/guest-cookie-store.ts +59 -0
- package/src/browser-electron/guest-css-runtime.ts +76 -0
- package/src/browser-electron/guest-css.ts +68 -0
- package/src/browser-electron/guest-route.ts +716 -0
- package/src/browser-electron/guest-runtime.ts +408 -0
- package/src/browser-electron/guest-storage-runtime.ts +54 -0
- package/src/browser-electron/guest-storage.ts +120 -0
- package/src/browser-electron/history-store.ts +224 -0
- package/src/browser-electron/host-main.ts +1385 -0
- package/src/browser-electron/host-patch-maintenance.ts +121 -0
- package/src/browser-electron/http-body.ts +65 -0
- package/src/browser-electron/json-reply.ts +47 -0
- package/src/browser-electron/maintenance-broker.ts +166 -0
- package/src/browser-electron/maintenance-lifecycle.ts +91 -0
- package/src/browser-electron/maintenance-route.ts +68 -0
- package/src/browser-electron/missing-system-browser.ts +114 -0
- package/src/browser-electron/open-slot.ts +49 -0
- package/src/browser-electron/paths.ts +25 -0
- package/src/browser-electron/preferred-browser.ts +130 -0
- package/src/browser-electron/preview-route.ts +215 -0
- package/src/browser-electron/process-ownership.ts +174 -0
- package/src/browser-electron/process.ts +23 -0
- package/src/browser-electron/profile-checkpoint.ts +187 -0
- package/src/browser-electron/profile-command.ts +47 -0
- package/src/browser-electron/profile-extension.ts +129 -0
- package/src/browser-electron/profile-lease.ts +211 -0
- package/src/browser-electron/profile-residue.ts +49 -0
- package/src/browser-electron/provider-core.ts +1107 -0
- package/src/browser-electron/provider-interaction.ts +1034 -0
- package/src/browser-electron/provider-media.ts +589 -0
- package/src/browser-electron/provider-navigation.ts +323 -0
- package/src/browser-electron/provider-observation.ts +664 -0
- package/src/browser-electron/provider-tabs.ts +372 -0
- package/src/browser-electron/provider.ts +666 -0
- package/src/browser-electron/reference-route.ts +598 -0
- package/src/browser-electron/remote-host.ts +1538 -0
- package/src/browser-electron/rpc-input.ts +13 -0
- package/src/browser-electron/rpc-ops.ts +41 -0
- package/src/browser-electron/runtime-diagnostics.ts +38 -0
- package/src/browser-electron/runtime-route.ts +105 -0
- package/src/browser-electron/runtime-status.ts +309 -0
- package/src/browser-electron/settings-route.ts +64 -0
- package/src/browser-electron/settings-store.ts +593 -0
- package/src/browser-electron/shortcuts-route.ts +112 -0
- package/src/browser-electron/sidebar-only-host.ts +300 -0
- package/src/browser-electron/startpage-shortcuts.ts +213 -0
- package/src/browser-electron/system-browser.ts +1850 -0
- package/src/browser-electron/tauri-host.ts +194 -0
- package/src/browser-electron/timing.ts +16 -0
- package/src/browser-electron/virtual-cursor.ts +162 -0
- package/src/browser-electron/windows-system.ts +24 -0
- package/src/browser-reference/delivery.ts +384 -0
- package/src/browser-reference/entry.ts +631 -0
- package/src/browser-reference/export.ts +339 -0
- package/src/browser-reference/import.ts +303 -0
- package/src/browser-reference/page-script.ts +1537 -0
- package/src/browser-reference/service.ts +1346 -0
- package/src/browser-reference/store.ts +172 -0
- package/src/browser-reference/text-quote.ts +219 -0
- package/src/browser-reference/types.ts +195 -0
- package/src/browser-reference/visible.ts +367 -0
- package/src/browser-reference/web-sources.ts +106 -0
- package/src/client/apply-guard.ts +22 -0
- package/src/client/browser/BrowserController.ts +693 -0
- package/src/client/browser/BrowserFrame.ts +78 -0
- package/src/client/browser/BrowserNavigation.ts +169 -0
- package/src/client/browser/BrowserPage.ts +23 -0
- package/src/client/browser/BrowserPersistence.ts +44 -0
- package/src/client/browser/IframeImpl.ts +182 -0
- package/src/client/browser/child-tabs.ts +14 -0
- package/src/client/browser/frame-history.ts +125 -0
- package/src/client/browser/frame-state.ts +27 -0
- package/src/client/browser/iframe-reference.ts +67 -0
- package/src/client/browser/initialization.ts +262 -0
- package/src/client/browser/omnibox.ts +243 -0
- package/src/client/browser/store.ts +38 -0
- package/src/client/browser/takeover-channel.ts +72 -0
- package/src/client/browser/url.ts +46 -0
- package/src/client/browser/web-reference-source.ts +56 -0
- package/src/client/css-modules.d.ts +4 -0
- package/src/client/definition.tsx +36 -0
- package/src/client/electron/ElectronWebViewImpl.ts +371 -0
- package/src/client/electron/ElectronWebviewPresentation.ts +140 -0
- package/src/client/electron/NativeChildPresentation.ts +53 -0
- package/src/client/electron/NativeViewPage.ts +265 -0
- package/src/client/electron/pages.ts +23 -0
- package/src/client/electron/reference-overlay.ts +53 -0
- package/src/client/electron/workspace.ts +33 -0
- package/src/client/index.ts +333 -0
- package/src/client/locales.ts +860 -0
- package/src/client/pages.ts +28 -0
- package/src/client/reference/client/BrowserRefLink.tsx +142 -0
- package/src/client/reference/client/draft-reference.ts +167 -0
- package/src/client/reference/client/index.ts +7 -0
- package/src/client/reference/client/ordered-submission.ts +108 -0
- package/src/client/reference/client/pending-delivery.ts +216 -0
- package/src/client/reference/client/plugin.ts +208 -0
- package/src/client/reference/client/production/ReferenceCapsules.tsx +345 -0
- package/src/client/reference/client/production/ReferenceDock.module.css +193 -0
- package/src/client/reference/client/production/ReferenceDock.tsx +6 -0
- package/src/client/reference/client/production/ReferenceFeedback.tsx +15 -0
- package/src/client/reference/client/production/ReferenceMath.tsx +44 -0
- package/src/client/reference/client/production/ReferenceText.tsx +36 -0
- package/src/client/reference/client/production/assembly.ts +447 -0
- package/src/client/reference/client/production/asset-store.ts +144 -0
- package/src/client/reference/client/production/availability.ts +72 -0
- package/src/client/reference/client/production/bytes.ts +36 -0
- package/src/client/reference/client/production/composer-attachments.ts +44 -0
- package/src/client/reference/client/production/delivery-client.ts +211 -0
- package/src/client/reference/client/production/draft-adapter.ts +512 -0
- package/src/client/reference/client/production/http-transport.ts +212 -0
- package/src/client/reference/client/production/production-submission.ts +70 -0
- package/src/client/reference/client/production/protocol.ts +234 -0
- package/src/client/reference/client/production/reference-card.ts +240 -0
- package/src/client/reference/client/production/reference-labels.ts +29 -0
- package/src/client/reference/client/production/reply-link-bridge.ts +222 -0
- package/src/client/reference/client/production/reveal.ts +215 -0
- package/src/client/reference/client/production/runtime.ts +1056 -0
- package/src/client/reference/client/production/snapshot-adapter.ts +154 -0
- package/src/client/reference/client/production/source-marker.ts +99 -0
- package/src/client/reference/client/production/source-opener.ts +55 -0
- package/src/client/reference/client/production/styles.ts +104 -0
- package/src/client/reference/client/production/user-text-rule.ts +67 -0
- package/src/client/reference/client/reveal.ts +109 -0
- package/src/client/reference/client/scheme.ts +114 -0
- package/src/client/reference/client/session-schedule.ts +36 -0
- package/src/client/reference/client/types.ts +168 -0
- package/src/client/reference/css-modules.d.ts +4 -0
- package/src/client/reference/index.ts +11 -0
- package/src/client/reference-capture-owner.ts +162 -0
- package/src/client/reference-intents.ts +36 -0
- package/src/client/settings/index.ts +42 -0
- package/src/client/settings/mount-guard.ts +31 -0
- package/src/client/settings/panel.ts +2768 -0
- package/src/client/shortcut-open.ts +30 -0
- package/src/client/startpage/binding.ts +99 -0
- package/src/client/startpage/controller.ts +300 -0
- package/src/client/startpage/model.ts +279 -0
- package/src/client/view/Browser.module.css +751 -0
- package/src/client/view/BrowserBody.tsx +315 -0
- package/src/client/view/BrowserPresentation.ts +9 -0
- package/src/client/view/BrowserTitle.tsx +17 -0
- package/src/client/view/IframePresentation.ts +365 -0
- package/src/client/view/StartPage.tsx +598 -0
- package/src/client/view/TakeoverBanner.tsx +21 -0
- package/src/compat/host-features.ts +92 -0
- package/src/index.ts +110 -0
- package/src/reference-owner.ts +5 -0
- package/src/reference-page.ts +9 -0
- package/src/reference-source.ts +3 -0
- package/src/reference-text.ts +219 -0
- package/src/startpage-settings.ts +103 -0
- package/src/startpage.ts +71 -0
- package/src/takeover-protocol.ts +28 -0
- package/src/tool-browser/block-recovery.ts +85 -0
- package/src/tool-browser/code-tool.ts +555 -0
- package/src/tool-browser/code-worker.ts +725 -0
- package/src/tool-browser/element-fields.ts +167 -0
- package/src/tool-browser/errors.ts +40 -0
- package/src/tool-browser/index.ts +265 -0
- package/src/tool-browser/page-probe.ts +675 -0
- package/src/tool-browser/panel-page.ts +126 -0
- package/src/tool-browser/probe-client.ts +183 -0
- package/src/tool-browser/screenshot-annotations.ts +131 -0
- package/src/tool-browser/screenshot-image.ts +49 -0
- package/src/tool-browser/state.ts +375 -0
- package/src/tool-browser/takeover.ts +199 -0
- package/src/tool-browser/tools-debug.ts +806 -0
- package/src/tool-browser/tools-interaction.ts +956 -0
- package/src/tool-browser/tools-navigation.ts +786 -0
- package/src/tool-browser/tools-observation.ts +474 -0
- package/src/tool-browser/tools-reference.ts +294 -0
- package/src/types/electron-shim.d.ts +144 -0
- package/src/types.ts +85 -0
- package/src/web-guest.ts +35 -0
- package/tools/accept-desktop.mjs +148 -0
- package/dist/client.d.cts +0 -516
- package/dist/client.d.mts +0 -516
- package/dist/index.cjs +0 -92
- package/dist/index.d.mts +0 -2960
- package/dist/index.mjs +0 -24
- package/dsh-builtin-browser-1.0.3-publish.tgz +0 -0
- package/dsh-builtin-browser-1.0.3.tgz +0 -0
- package/dsh-host-patch/sources/main/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/manifest.json +0 -218
- package/dsh-host-patch/sources/rc3/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/series.json +0 -260
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Injected HTTP client for the built-in browser reference endpoints.
|
|
3
|
+
*
|
|
4
|
+
* No `fetch` global and no host transport is imported: a `RequestLike` function
|
|
5
|
+
* is injected. The concrete `createReferenceHttpClient` builds the exact paths,
|
|
6
|
+
* query strings and JSON bodies the plugin router expects, so a unit test can
|
|
7
|
+
* assert on the real URL/params rather than on "fetch was called".
|
|
8
|
+
*
|
|
9
|
+
* Reads rely on the host cookie (the plugin's `requireRead`); writes add the
|
|
10
|
+
* same-origin + loopback boundaries server-side, so the client only needs to
|
|
11
|
+
* send credentials and a JSON content type.
|
|
12
|
+
*
|
|
13
|
+
* The plugin routes are EXACT paths registered on DSH's OWN webServer, so the
|
|
14
|
+
* client uses SAME-ORIGIN RELATIVE paths (`/dsh-builtin-browser/reference/...`)
|
|
15
|
+
* and NEVER hardcodes a port. `baseUrl` defaults to '' on purpose: a 3080 (or
|
|
16
|
+
* any other) fallback would disguise "plugin version too old" as a routing
|
|
17
|
+
* problem. A missing route (404) is surfaced as `plugin-too-old`, never retried
|
|
18
|
+
* against another origin.
|
|
19
|
+
*
|
|
20
|
+
* @module dsh-browser-reference/production/http-transport
|
|
21
|
+
*/
|
|
22
|
+
import {
|
|
23
|
+
ROUTES,
|
|
24
|
+
ReferenceHttpError,
|
|
25
|
+
type AckRequest,
|
|
26
|
+
type AckResponse,
|
|
27
|
+
type AssetResponse,
|
|
28
|
+
type DeliveriesResponse,
|
|
29
|
+
type ExportFormat,
|
|
30
|
+
type RemoveResponse,
|
|
31
|
+
type RevealResultWire,
|
|
32
|
+
} from './protocol.ts'
|
|
33
|
+
import { isDeliveriesResponse } from './availability.ts'
|
|
34
|
+
|
|
35
|
+
/** Minimal response face; `json` and `bytes` cover every route we consume. */
|
|
36
|
+
export interface RawResponse {
|
|
37
|
+
readonly status: number
|
|
38
|
+
readonly ok: boolean
|
|
39
|
+
json(): Promise<unknown>
|
|
40
|
+
bytes(): Promise<Uint8Array>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface RequestInitLike {
|
|
44
|
+
readonly method?: string
|
|
45
|
+
readonly headers?: Readonly<Record<string, string>>
|
|
46
|
+
readonly body?: string | Uint8Array
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Injected request function (a thin `fetch` adapter in the host assembly). */
|
|
50
|
+
export type RequestLike = (url: string, init?: RequestInitLike) => Promise<RawResponse>
|
|
51
|
+
|
|
52
|
+
export interface ReferenceHttpClient {
|
|
53
|
+
deliveries(sessionId: string, since: number): Promise<DeliveriesResponse>
|
|
54
|
+
assetBase64(key: string): Promise<AssetResponse>
|
|
55
|
+
assetBytes(key: string): Promise<Uint8Array>
|
|
56
|
+
ack(request: AckRequest): Promise<AckResponse>
|
|
57
|
+
/** Persist an accepted message's consumption independently of browser storage. */
|
|
58
|
+
consume?(sessionId: string, intentId: string): Promise<void>
|
|
59
|
+
remove(intentId: string): Promise<RemoveResponse>
|
|
60
|
+
reveal(referenceId: string, partId?: string, navigate?: boolean, sourcePageId?: string): Promise<RevealResultWire>
|
|
61
|
+
exportBundle(format: ExportFormat, sessionId: string): Promise<Uint8Array>
|
|
62
|
+
importBundle(zip: Uint8Array): Promise<unknown>
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface HttpClientOptions {
|
|
66
|
+
/** Origin of the plugin HTTP surface, e.g. `http://127.0.0.1:<port>`. No trailing slash. */
|
|
67
|
+
readonly baseUrl?: string
|
|
68
|
+
readonly request: RequestLike
|
|
69
|
+
/** Abort signal forwarded per request for cancellable polling. */
|
|
70
|
+
readonly signal?: () => AbortSignal | undefined
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function query(params: Readonly<Record<string, string | number | undefined>>): string {
|
|
74
|
+
const parts: string[] = []
|
|
75
|
+
for (const [key, value] of Object.entries(params)) {
|
|
76
|
+
if (value === undefined) continue
|
|
77
|
+
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)
|
|
78
|
+
}
|
|
79
|
+
return parts.length === 0 ? '' : `?${parts.join('&')}`
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function jsonHeaders(): Readonly<Record<string, string>> {
|
|
83
|
+
return { 'content-type': 'application/json' }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Build the typed client over one injected request function. */
|
|
87
|
+
export function createReferenceHttpClient(options: HttpClientOptions): ReferenceHttpClient {
|
|
88
|
+
const base = (options.baseUrl ?? '').replace(/\/+$/u, '')
|
|
89
|
+
const request = options.request
|
|
90
|
+
|
|
91
|
+
const readJson = async (url: string): Promise<unknown> => {
|
|
92
|
+
const response = await request(url)
|
|
93
|
+
if (!response.ok) {
|
|
94
|
+
let body: unknown
|
|
95
|
+
try { body = await response.json() } catch { /* error bodies are best-effort */ }
|
|
96
|
+
throw new ReferenceHttpError(`GET ${url} failed with ${response.status}`, response.status, body)
|
|
97
|
+
}
|
|
98
|
+
return response.json()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const writeJson = async (url: string, payload: unknown): Promise<unknown> => {
|
|
102
|
+
const response = await request(url, {
|
|
103
|
+
method: 'POST',
|
|
104
|
+
headers: jsonHeaders(),
|
|
105
|
+
body: JSON.stringify(payload),
|
|
106
|
+
})
|
|
107
|
+
if (!response.ok) {
|
|
108
|
+
let body: unknown
|
|
109
|
+
try { body = await response.json() } catch { /* error bodies are best-effort */ }
|
|
110
|
+
throw new ReferenceHttpError(`POST ${url} failed with ${response.status}`, response.status, body)
|
|
111
|
+
}
|
|
112
|
+
return response.json()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
async deliveries(sessionId, since) {
|
|
117
|
+
const url = `${base}${ROUTES.deliveries}${query({ sessionId, since: since > 0 ? since : undefined, includeConsumed: 1 })}`
|
|
118
|
+
const body: unknown = await readJson(url)
|
|
119
|
+
// A 200 with an unexpected shape is a real failure (old/incompatible
|
|
120
|
+
// plugin), not an empty delivery list. Status 0 is the shape-mismatch
|
|
121
|
+
// sentinel consumed by availabilityOf().
|
|
122
|
+
if (!isDeliveriesResponse(body)) {
|
|
123
|
+
throw new ReferenceHttpError('invalid /reference/deliveries payload shape', 0, body)
|
|
124
|
+
}
|
|
125
|
+
return body
|
|
126
|
+
},
|
|
127
|
+
async assetBase64(key) {
|
|
128
|
+
const url = `${base}${ROUTES.asset}${query({ key, encoding: 'base64' })}`
|
|
129
|
+
return await readJson(url) as AssetResponse
|
|
130
|
+
},
|
|
131
|
+
async assetBytes(key) {
|
|
132
|
+
const url = `${base}${ROUTES.asset}${query({ key })}`
|
|
133
|
+
const response = await request(url)
|
|
134
|
+
if (!response.ok) throw new ReferenceHttpError(`asset ${key} failed with ${response.status}`, response.status)
|
|
135
|
+
return response.bytes()
|
|
136
|
+
},
|
|
137
|
+
async ack(ack) {
|
|
138
|
+
const body: Record<string, unknown> = {
|
|
139
|
+
intentId: ack.intentId,
|
|
140
|
+
draftRev: ack.draftRev,
|
|
141
|
+
assetKeys: [...ack.assetKeys],
|
|
142
|
+
}
|
|
143
|
+
if (ack.phase !== undefined) body.phase = ack.phase
|
|
144
|
+
return await writeJson(`${base}${ROUTES.ack}`, body) as AckResponse
|
|
145
|
+
},
|
|
146
|
+
async consume(sessionId, intentId) {
|
|
147
|
+
const result = await writeJson(`${base}${ROUTES.ack}`, { phase: 'consumed', sessionId, intentId }) as { state?: unknown }
|
|
148
|
+
if (result.state !== 'consumed') throw new Error('reference consumption was not persisted')
|
|
149
|
+
},
|
|
150
|
+
async remove(intentId) {
|
|
151
|
+
return await writeJson(`${base}${ROUTES.remove}`, { intentId }) as RemoveResponse
|
|
152
|
+
},
|
|
153
|
+
async reveal(referenceId, partId, navigate, sourcePageId) {
|
|
154
|
+
const body: Record<string, unknown> = { referenceId }
|
|
155
|
+
if (sourcePageId !== undefined) body.sourcePageId = sourcePageId
|
|
156
|
+
if (partId !== undefined) body.partId = partId
|
|
157
|
+
// The page is moved to the source by the plugin, which owns it.
|
|
158
|
+
if (navigate === true) body.navigate = true
|
|
159
|
+
return await writeJson(`${base}${ROUTES.reveal}`, body) as RevealResultWire
|
|
160
|
+
},
|
|
161
|
+
async exportBundle(format, sessionId) {
|
|
162
|
+
const url = `${base}${ROUTES.export}${query({ format, sessionId })}`
|
|
163
|
+
const response = await request(url)
|
|
164
|
+
if (!response.ok) throw new ReferenceHttpError(`export failed with ${response.status}`, response.status)
|
|
165
|
+
return response.bytes()
|
|
166
|
+
},
|
|
167
|
+
async importBundle(zip) {
|
|
168
|
+
const response = await request(`${base}${ROUTES.import}`, {
|
|
169
|
+
method: 'POST',
|
|
170
|
+
headers: { 'content-type': 'application/zip' },
|
|
171
|
+
body: zip,
|
|
172
|
+
})
|
|
173
|
+
if (!response.ok) throw new ReferenceHttpError(`import failed with ${response.status}`, response.status)
|
|
174
|
+
return response.json()
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Wrap the host's real `fetch` into the injected `RequestLike` shape. */
|
|
180
|
+
export function createFetchRequest(
|
|
181
|
+
fetchImpl: (input: string, init?: {
|
|
182
|
+
method?: string
|
|
183
|
+
headers?: Record<string, string>
|
|
184
|
+
body?: string | Uint8Array
|
|
185
|
+
credentials?: RequestCredentials
|
|
186
|
+
signal?: AbortSignal
|
|
187
|
+
}) => Promise<{
|
|
188
|
+
ok: boolean
|
|
189
|
+
status: number
|
|
190
|
+
json(): Promise<unknown>
|
|
191
|
+
arrayBuffer(): Promise<ArrayBuffer>
|
|
192
|
+
}>,
|
|
193
|
+
signal?: () => AbortSignal | undefined,
|
|
194
|
+
): RequestLike {
|
|
195
|
+
return async (url, init) => {
|
|
196
|
+
const activeSignal = signal?.()
|
|
197
|
+
const fetchInit = {
|
|
198
|
+
...(init?.method === undefined ? {} : { method: init.method }),
|
|
199
|
+
...(init?.headers === undefined ? {} : { headers: { ...init.headers } }),
|
|
200
|
+
...(init?.body === undefined ? {} : { body: init.body }),
|
|
201
|
+
credentials: 'include' as const,
|
|
202
|
+
...(activeSignal === undefined ? {} : { signal: activeSignal }),
|
|
203
|
+
}
|
|
204
|
+
const response = await fetchImpl(url, fetchInit)
|
|
205
|
+
return {
|
|
206
|
+
ok: response.ok,
|
|
207
|
+
status: response.status,
|
|
208
|
+
json: () => response.json(),
|
|
209
|
+
bytes: async () => new Uint8Array(await response.arrayBuffer()),
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one captured reference puts into the composer.
|
|
3
|
+
*
|
|
4
|
+
* The stock conversation send path is `[...serializeAttachments(), { type: 'text', text }]`: the model
|
|
5
|
+
* sees the composer text and the composer attachments, nothing else. So a reference reaches the model
|
|
6
|
+
* only through those two places — its text, tables and image placeholders become the quote inserted
|
|
7
|
+
* into the editor, and its images become composer attachments.
|
|
8
|
+
*/
|
|
9
|
+
import { renderReferenceMarkdownTable } from '../../../../reference-text.ts'
|
|
10
|
+
import type { OrderedReferenceGroup } from '../types.ts'
|
|
11
|
+
import { createSubmissionProjector } from '../ordered-submission.ts'
|
|
12
|
+
import { composerQuote, sourceMarker } from './source-marker.ts'
|
|
13
|
+
import type { AssetBinding, AssetStore } from './asset-store.ts'
|
|
14
|
+
|
|
15
|
+
/** Stable visible label for one attached reference's source marker. */
|
|
16
|
+
export { SOURCE_LINK_LABEL } from './source-marker.ts'
|
|
17
|
+
|
|
18
|
+
export const REFERENCE_PRESENTATION = 'Browser reference presentation: this quote is already displayed as an interactive capsule. Do not repeat its marker, reference URI, source URL, or source/citation links in the reply. Answer using the quoted content; the capsule provides source navigation.'
|
|
19
|
+
|
|
20
|
+
/** One captured image that travels as a composer attachment. */
|
|
21
|
+
export interface ComposerImage {
|
|
22
|
+
readonly partId: string
|
|
23
|
+
readonly binding: AssetBinding
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ComposerReference {
|
|
27
|
+
/** The quote text inserted into the editor; the host sends it verbatim (line-quoted). */
|
|
28
|
+
readonly text: string
|
|
29
|
+
/** Images bound in the durable asset store, in capture order. */
|
|
30
|
+
readonly images: readonly ComposerImage[]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ComposerReferenceInput {
|
|
34
|
+
/** Zero-based position among this draft's references (the marker's visible number). */
|
|
35
|
+
readonly index: number
|
|
36
|
+
readonly title?: string
|
|
37
|
+
readonly assets: AssetStore
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Project one reference group into the composer quote and its image attachments. */
|
|
41
|
+
export function composerReference(group: OrderedReferenceGroup, input: ComposerReferenceInput): ComposerReference {
|
|
42
|
+
const lines: string[] = []
|
|
43
|
+
const images: ComposerImage[] = []
|
|
44
|
+
for (const part of createSubmissionProjector({ mode: 'ordered' }).project({ text: '', uploaded: [], groups: [group] })) {
|
|
45
|
+
switch (part.type) {
|
|
46
|
+
case 'text':
|
|
47
|
+
lines.push(part.text)
|
|
48
|
+
break
|
|
49
|
+
case 'table':
|
|
50
|
+
lines.push(part.table === undefined ? part.text : renderReferenceMarkdownTable(part.table))
|
|
51
|
+
break
|
|
52
|
+
case 'image': {
|
|
53
|
+
const partId = part.partId ?? part.assetKey
|
|
54
|
+
const binding = input.assets.get(part.assetKey)
|
|
55
|
+
if (binding === undefined) lines.push(`[image unavailable: ${partId}]`)
|
|
56
|
+
else {
|
|
57
|
+
images.push({ partId, binding })
|
|
58
|
+
lines.push(`[image ${images.length}: ${partId}, attached to this message]`)
|
|
59
|
+
}
|
|
60
|
+
break
|
|
61
|
+
}
|
|
62
|
+
default: {
|
|
63
|
+
const exhaustive: never = part
|
|
64
|
+
throw new Error(`unhandled projected part: ${JSON.stringify(exhaustive)}`)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
lines.push(REFERENCE_PRESENTATION)
|
|
69
|
+
return { text: composerQuote(lines.join('\n'), sourceMarker(group.referenceId, input.index, input.title)), images }
|
|
70
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { REFERENCE_REVEAL_ROUTE, REFERENCE_EXPORT_ROUTE, REFERENCE_IMPORT_ROUTE, REFERENCE_DELIVERIES_ROUTE, REFERENCE_DELIVERY_ACK_ROUTE, REFERENCE_DELIVERY_REMOVE_ROUTE, REFERENCE_ASSET_ROUTE } from '../../../../../assets/browser-policy.mjs'
|
|
2
|
+
/**
|
|
3
|
+
* Wire contract of the built-in browser's durable reference hand-off.
|
|
4
|
+
*
|
|
5
|
+
* These shapes MIRROR the plugin's own modules and are deliberately duplicated
|
|
6
|
+
* here (instead of imported across repositories): the client package must stay
|
|
7
|
+
* self-contained and compilable without the plugin checkout. Field names, the
|
|
8
|
+
* flattened `/deliveries` record and the frozen `snapshot` come from
|
|
9
|
+
* `dsh-browser/browser-reference/types.ts`, `delivery.ts` and
|
|
10
|
+
* `browser-electron/reference-route.ts`. Every content-bearing field is kept
|
|
11
|
+
* verbatim so a unit test can assert on the captured text, table cells and
|
|
12
|
+
* image bytes rather than on a call count.
|
|
13
|
+
*
|
|
14
|
+
* @module dsh-browser-reference/production/protocol
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { ReferenceTextNode } from '../../../../reference-text.ts'
|
|
18
|
+
|
|
19
|
+
/** Exact HTTP paths served by the plugin's reference router. */
|
|
20
|
+
export const ROUTES = {
|
|
21
|
+
deliveries: REFERENCE_DELIVERIES_ROUTE,
|
|
22
|
+
asset: REFERENCE_ASSET_ROUTE,
|
|
23
|
+
ack: REFERENCE_DELIVERY_ACK_ROUTE,
|
|
24
|
+
remove: REFERENCE_DELIVERY_REMOVE_ROUTE,
|
|
25
|
+
reveal: REFERENCE_REVEAL_ROUTE,
|
|
26
|
+
export: REFERENCE_EXPORT_ROUTE,
|
|
27
|
+
import: REFERENCE_IMPORT_ROUTE,
|
|
28
|
+
} as const
|
|
29
|
+
|
|
30
|
+
/** A part that could not be captured, kept visible so the user can retry/remove. */
|
|
31
|
+
export interface DeliveryFailure {
|
|
32
|
+
readonly kind: 'text' | 'image' | 'table' | 'reference'
|
|
33
|
+
readonly reason: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type DeliveryState = 'prepared' | 'draft-applied' | 'acknowledged' | 'consumed'
|
|
37
|
+
|
|
38
|
+
// ---- frozen snapshot (mirror of dsh-browser/browser-reference/types.ts) ----
|
|
39
|
+
|
|
40
|
+
export interface TextQuoteAnchor {
|
|
41
|
+
readonly exact: string
|
|
42
|
+
readonly prefix: string
|
|
43
|
+
readonly suffix: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ImageAnchor {
|
|
47
|
+
readonly src?: string
|
|
48
|
+
readonly currentSrc?: string
|
|
49
|
+
readonly alt?: string
|
|
50
|
+
readonly selector?: string
|
|
51
|
+
readonly geometry?: { readonly x: number; readonly y: number; readonly w: number; readonly h: number }
|
|
52
|
+
readonly versionStatus?: 'verified' | 'changed' | 'unverifiable'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface TextReferencePart {
|
|
56
|
+
readonly partId: string
|
|
57
|
+
readonly type: 'text'
|
|
58
|
+
readonly text: string
|
|
59
|
+
readonly content?: readonly ReferenceTextNode[]
|
|
60
|
+
readonly anchor: TextQuoteAnchor
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ImageReferencePart {
|
|
64
|
+
readonly partId: string
|
|
65
|
+
readonly type: 'image'
|
|
66
|
+
readonly assetKey: string
|
|
67
|
+
readonly representation: 'source-image' | 'rasterized-image' | 'visible-snapshot'
|
|
68
|
+
readonly alt?: string
|
|
69
|
+
readonly caption?: string
|
|
70
|
+
readonly anchor: ImageAnchor
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type TableCellRun =
|
|
74
|
+
| { readonly type: 'text'; readonly text: string }
|
|
75
|
+
| { readonly type: 'image'; readonly partId: string; readonly assetKey: string }
|
|
76
|
+
|
|
77
|
+
export interface TableCellSnapshot {
|
|
78
|
+
readonly row: number
|
|
79
|
+
readonly column: number
|
|
80
|
+
readonly rowSpan: number
|
|
81
|
+
readonly columnSpan: number
|
|
82
|
+
readonly role: 'header' | 'data'
|
|
83
|
+
readonly text: string
|
|
84
|
+
readonly includedAs: 'selection' | 'header-context'
|
|
85
|
+
readonly partialText: boolean
|
|
86
|
+
readonly inlineContent?: readonly TableCellRun[]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface TableAnchor {
|
|
90
|
+
readonly selector?: string
|
|
91
|
+
readonly caption?: string
|
|
92
|
+
readonly headers: readonly string[]
|
|
93
|
+
readonly firstCells: readonly string[]
|
|
94
|
+
readonly cell?: { readonly row: number; readonly column: number }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface TableSnapshot {
|
|
98
|
+
readonly rowCount: number
|
|
99
|
+
readonly columnCount: number
|
|
100
|
+
readonly cells: readonly TableCellSnapshot[]
|
|
101
|
+
readonly caption?: string
|
|
102
|
+
readonly completeness: 'selected-cells' | 'dom-table' | 'visible-rows' | 'aria-grid'
|
|
103
|
+
readonly normalizationVersion: string
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface TableReferencePart {
|
|
107
|
+
readonly partId: string
|
|
108
|
+
readonly type: 'table'
|
|
109
|
+
readonly table: TableSnapshot
|
|
110
|
+
readonly anchor: TableAnchor
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type BrowserReferencePart = TextReferencePart | ImageReferencePart | TableReferencePart
|
|
114
|
+
|
|
115
|
+
export interface BrowserReferenceSource {
|
|
116
|
+
readonly pageUrl: string
|
|
117
|
+
readonly title: string
|
|
118
|
+
readonly capturedAt: string
|
|
119
|
+
readonly frameUrl?: string
|
|
120
|
+
readonly frameRoute?: 'main' | 'frame'
|
|
121
|
+
readonly frameSelector?: string
|
|
122
|
+
readonly carrier: 'sidebar' | 'bundled' | 'chrome' | 'edge'
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface BrowserReferenceOwner {
|
|
126
|
+
readonly sessionId?: string
|
|
127
|
+
readonly browserSessionId?: string
|
|
128
|
+
readonly sourcePageId?: string
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface BrowserReferenceProvenance {
|
|
132
|
+
readonly origin: 'user-selection' | 'agent-excerpt'
|
|
133
|
+
readonly entry: 'native-menu' | 'extension-action' | 'page-overlay' | 'agent-tool'
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** The complete immutable capture; the client restores a draft from this. */
|
|
137
|
+
export interface FrozenSnapshot {
|
|
138
|
+
readonly version: 1
|
|
139
|
+
readonly provider: 'dsh-browser'
|
|
140
|
+
readonly referenceId: string
|
|
141
|
+
readonly owner: BrowserReferenceOwner
|
|
142
|
+
readonly provenance: BrowserReferenceProvenance
|
|
143
|
+
readonly source: BrowserReferenceSource
|
|
144
|
+
readonly parts: readonly BrowserReferencePart[]
|
|
145
|
+
/** The human's own note (three-state §3). Not part of the page snapshot. */
|
|
146
|
+
readonly comment?: string
|
|
147
|
+
readonly manifestHash: string
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** One flattened record returned by `GET /reference/deliveries`. */
|
|
151
|
+
export interface DeliveryRecord {
|
|
152
|
+
readonly intentId: string
|
|
153
|
+
readonly sessionId: string
|
|
154
|
+
readonly browserSessionId: string
|
|
155
|
+
readonly referenceId: string
|
|
156
|
+
readonly state: DeliveryState
|
|
157
|
+
readonly failures: readonly DeliveryFailure[]
|
|
158
|
+
readonly assetKeys: readonly string[]
|
|
159
|
+
/** Asset keys required before an acknowledge may succeed. */
|
|
160
|
+
readonly requiredAssets: readonly string[]
|
|
161
|
+
readonly draftRev?: number
|
|
162
|
+
readonly snapshot: FrozenSnapshot
|
|
163
|
+
readonly createdAt: string
|
|
164
|
+
readonly updatedAt: string
|
|
165
|
+
readonly sequence: number
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface DeliveriesResponse {
|
|
169
|
+
readonly ok: true
|
|
170
|
+
readonly sequence: number
|
|
171
|
+
readonly deliveries: readonly DeliveryRecord[]
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** `GET /reference/asset?encoding=base64` response. */
|
|
175
|
+
export interface AssetResponse {
|
|
176
|
+
readonly ok: true
|
|
177
|
+
readonly key: string
|
|
178
|
+
readonly mime: string
|
|
179
|
+
readonly bytes: number
|
|
180
|
+
readonly sha256: string
|
|
181
|
+
readonly data: string
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export type DeliveryAckPhase = 'draft-applied' | 'acknowledged'
|
|
185
|
+
|
|
186
|
+
export interface AckRequest {
|
|
187
|
+
readonly intentId: string
|
|
188
|
+
readonly draftRev: number
|
|
189
|
+
readonly assetKeys: readonly string[]
|
|
190
|
+
readonly phase?: DeliveryAckPhase
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface AckResponse {
|
|
194
|
+
readonly ok: true
|
|
195
|
+
readonly intentId?: string
|
|
196
|
+
readonly state: DeliveryState
|
|
197
|
+
readonly draftRev: number
|
|
198
|
+
readonly assetKeys: readonly string[]
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface RemoveResponse {
|
|
202
|
+
readonly ok: true
|
|
203
|
+
readonly intentId?: string
|
|
204
|
+
readonly state: 'removed'
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface RevealResultWire {
|
|
208
|
+
readonly ok: true
|
|
209
|
+
readonly code?: string
|
|
210
|
+
readonly status?: string
|
|
211
|
+
readonly reason?: string
|
|
212
|
+
readonly note?: string
|
|
213
|
+
readonly tabId?: string
|
|
214
|
+
readonly frameId?: string
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export type ExportFormat = 'jsonl' | 'markdown' | 'zip' | 'markdown-zip'
|
|
218
|
+
|
|
219
|
+
/** Transport error whose status shapes the caller's decision (409 = refuse ACK). */
|
|
220
|
+
export class ReferenceHttpError extends Error {
|
|
221
|
+
readonly status: number
|
|
222
|
+
readonly body?: unknown
|
|
223
|
+
constructor(
|
|
224
|
+
message: string,
|
|
225
|
+
status: number,
|
|
226
|
+
body?: unknown,
|
|
227
|
+
) {
|
|
228
|
+
|
|
229
|
+
super(message)
|
|
230
|
+
this.status = status
|
|
231
|
+
this.body = body
|
|
232
|
+
this.name = 'ReferenceHttpError'
|
|
233
|
+
}
|
|
234
|
+
}
|