opendevbrowser 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/accessibility-snapshot-PA6NWNS7.js +39 -0
- package/dist/accessibility-snapshot-PA6NWNS7.js.map +1 -0
- package/dist/active-window-YNYTIPZN.js +37 -0
- package/dist/active-window-YNYTIPZN.js.map +1 -0
- package/dist/annotate-STYHXZYJ.js +205 -0
- package/dist/annotate-STYHXZYJ.js.map +1 -0
- package/dist/artifacts-KJ6RNDO2.js +120 -0
- package/dist/artifacts-KJ6RNDO2.js.map +1 -0
- package/dist/attr-GHFZZ4SA.js +84 -0
- package/dist/attr-GHFZZ4SA.js.map +1 -0
- package/dist/browser/ops-client.d.ts +1 -0
- package/dist/browser/ops-client.d.ts.map +1 -1
- package/dist/canvas-54FBOEGP.js +309 -0
- package/dist/canvas-54FBOEGP.js.map +1 -0
- package/dist/capture-desktop-SNABC24E.js +38 -0
- package/dist/capture-desktop-SNABC24E.js.map +1 -0
- package/dist/capture-window-UJSB5AMP.js +40 -0
- package/dist/capture-window-UJSB5AMP.js.map +1 -0
- package/dist/check-ST5UQ2F5.js +71 -0
- package/dist/check-ST5UQ2F5.js.map +1 -0
- package/dist/checked-IEMWI5CU.js +71 -0
- package/dist/checked-IEMWI5CU.js.map +1 -0
- package/dist/chunk-2CG4SW3E.js +64 -0
- package/dist/chunk-2CG4SW3E.js.map +1 -0
- package/dist/chunk-2SIMIPLY.js +67 -0
- package/dist/chunk-2SIMIPLY.js.map +1 -0
- package/dist/chunk-37VSRUW4.js +141 -0
- package/dist/chunk-37VSRUW4.js.map +1 -0
- package/dist/chunk-5SWZDVOW.js +144 -0
- package/dist/chunk-5SWZDVOW.js.map +1 -0
- package/dist/chunk-6PVZ2ABC.js +429 -0
- package/dist/chunk-6PVZ2ABC.js.map +1 -0
- package/dist/chunk-7GVOUZMQ.js +64 -0
- package/dist/chunk-7GVOUZMQ.js.map +1 -0
- package/dist/chunk-7THCPS52.js +84 -0
- package/dist/chunk-7THCPS52.js.map +1 -0
- package/dist/chunk-ASMHEEKY.js +10 -0
- package/dist/chunk-ASMHEEKY.js.map +1 -0
- package/dist/chunk-DBF5OKH3.js +111 -0
- package/dist/chunk-DBF5OKH3.js.map +1 -0
- package/dist/chunk-DW4TX7MU.js +54 -0
- package/dist/chunk-DW4TX7MU.js.map +1 -0
- package/dist/chunk-IPE7TF2P.js +54 -0
- package/dist/chunk-IPE7TF2P.js.map +1 -0
- package/dist/chunk-IQTJHXZJ.js +126 -0
- package/dist/chunk-IQTJHXZJ.js.map +1 -0
- package/dist/chunk-J47N77VG.js +2969 -0
- package/dist/chunk-J47N77VG.js.map +1 -0
- package/dist/chunk-JZXD6FWR.js +25 -0
- package/dist/chunk-JZXD6FWR.js.map +1 -0
- package/dist/{chunk-QVWOPIZJ.js → chunk-KDSNXS6N.js} +75 -149
- package/dist/chunk-KDSNXS6N.js.map +1 -0
- package/dist/chunk-KZ2IXVQT.js +219 -0
- package/dist/chunk-KZ2IXVQT.js.map +1 -0
- package/dist/chunk-LBPELU7L.js +3649 -0
- package/dist/chunk-LBPELU7L.js.map +1 -0
- package/dist/chunk-MX3NFLCE.js +940 -0
- package/dist/chunk-MX3NFLCE.js.map +1 -0
- package/dist/chunk-N44UXKIB.js +26 -0
- package/dist/chunk-N44UXKIB.js.map +1 -0
- package/dist/chunk-OW5HMYMI.js +19 -0
- package/dist/chunk-OW5HMYMI.js.map +1 -0
- package/dist/chunk-OYNLAZQU.js +838 -0
- package/dist/chunk-OYNLAZQU.js.map +1 -0
- package/dist/chunk-PDPJN2OP.js +17 -0
- package/dist/chunk-PDPJN2OP.js.map +1 -0
- package/dist/chunk-RCZZGGJS.js +226 -0
- package/dist/chunk-RCZZGGJS.js.map +1 -0
- package/dist/chunk-RJNI3BHT.js +1 -0
- package/dist/chunk-RPXWUCQQ.js +112 -0
- package/dist/chunk-RPXWUCQQ.js.map +1 -0
- package/dist/chunk-S5KZQJJI.js +107 -0
- package/dist/chunk-S5KZQJJI.js.map +1 -0
- package/dist/{chunk-T3VVHJTK.js → chunk-S6S2UP6U.js} +1074 -1459
- package/dist/chunk-S6S2UP6U.js.map +1 -0
- package/dist/{chunk-I5ZCOZZV.js → chunk-SXAGSEKZ.js} +1202 -9561
- package/dist/chunk-SXAGSEKZ.js.map +1 -0
- package/dist/chunk-T4GMCW6Z.js +46 -0
- package/dist/chunk-T4GMCW6Z.js.map +1 -0
- package/dist/chunk-WHQZBUNY.js +982 -0
- package/dist/chunk-WHQZBUNY.js.map +1 -0
- package/dist/chunk-WOXBLP7V.js +610 -0
- package/dist/chunk-WOXBLP7V.js.map +1 -0
- package/dist/cli/commands/inspiredesign.d.ts.map +1 -1
- package/dist/cli/commands/macro-resolve.d.ts +4 -1
- package/dist/cli/commands/macro-resolve.d.ts.map +1 -1
- package/dist/cli/commands/product-video.d.ts.map +1 -1
- package/dist/cli/commands/research.d.ts.map +1 -1
- package/dist/cli/commands/serve.d.ts.map +1 -1
- package/dist/cli/commands/shopping.d.ts.map +1 -1
- package/dist/cli/commands/workflow-output.d.ts +2 -0
- package/dist/cli/commands/workflow-output.d.ts.map +1 -0
- package/dist/cli/daemon-commands.d.ts.map +1 -1
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/index.js +204 -8123
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installers/postinstall-skill-sync.js +2 -1
- package/dist/cli/installers/postinstall-skill-sync.js.map +1 -1
- package/dist/cli/remote-relay.d.ts.map +1 -1
- package/dist/click-TENZA3Y6.js +81 -0
- package/dist/click-TENZA3Y6.js.map +1 -0
- package/dist/clone-component-STH5AR6M.js +82 -0
- package/dist/clone-component-STH5AR6M.js.map +1 -0
- package/dist/clone-page-BSTWAPAJ.js +69 -0
- package/dist/clone-page-BSTWAPAJ.js.map +1 -0
- package/dist/close-CEMMAAM7.js +63 -0
- package/dist/close-CEMMAAM7.js.map +1 -0
- package/dist/close-QCWUNRAI.js +63 -0
- package/dist/close-QCWUNRAI.js.map +1 -0
- package/dist/connect-J3RVSEZF.js +107 -0
- package/dist/connect-J3RVSEZF.js.map +1 -0
- package/dist/console-poll-HL7BVIVX.js +76 -0
- package/dist/console-poll-HL7BVIVX.js.map +1 -0
- package/dist/cookie-import-WMUCIIHN.js +177 -0
- package/dist/cookie-import-WMUCIIHN.js.map +1 -0
- package/dist/cookie-list-PB2N4RPH.js +117 -0
- package/dist/cookie-list-PB2N4RPH.js.map +1 -0
- package/dist/daemon-5KSVMGN4.js +194 -0
- package/dist/daemon-5KSVMGN4.js.map +1 -0
- package/dist/daemon-fingerprint.json +1 -1
- package/dist/debug-trace-snapshot-RK7KDXA5.js +136 -0
- package/dist/debug-trace-snapshot-RK7KDXA5.js.map +1 -0
- package/dist/dialog-P6P4U7XE.js +75 -0
- package/dist/dialog-P6P4U7XE.js.map +1 -0
- package/dist/disconnect-32F7IDIP.js +58 -0
- package/dist/disconnect-32F7IDIP.js.map +1 -0
- package/dist/enabled-A6C6ZM2O.js +71 -0
- package/dist/enabled-A6C6ZM2O.js.map +1 -0
- package/dist/extension-extractor-GKWSFHPN.js +11 -0
- package/dist/extension-extractor-GKWSFHPN.js.map +1 -0
- package/dist/global-D6WLWBXA.js +56 -0
- package/dist/global-D6WLWBXA.js.map +1 -0
- package/dist/goto-ULTSABDM.js +98 -0
- package/dist/goto-ULTSABDM.js.map +1 -0
- package/dist/help-EKKKEDL5.js +491 -0
- package/dist/help-EKKKEDL5.js.map +1 -0
- package/dist/hover-UF2ZUMTQ.js +71 -0
- package/dist/hover-UF2ZUMTQ.js.map +1 -0
- package/dist/html-B6TX7GK7.js +84 -0
- package/dist/html-B6TX7GK7.js.map +1 -0
- package/dist/index.js +68 -34
- package/dist/index.js.map +1 -1
- package/dist/inspector-6S5FKUZQ.js +62 -0
- package/dist/inspector-6S5FKUZQ.js.map +1 -0
- package/dist/inspector-audit-ARGEGOS7.js +84 -0
- package/dist/inspector-audit-ARGEGOS7.js.map +1 -0
- package/dist/inspector-plan-CSG5HZOC.js +69 -0
- package/dist/inspector-plan-CSG5HZOC.js.map +1 -0
- package/dist/inspiredesign-7VRMMZN4.js +234 -0
- package/dist/inspiredesign-7VRMMZN4.js.map +1 -0
- package/dist/install-autostart-output-5DOMKCQL.js +41 -0
- package/dist/install-autostart-output-5DOMKCQL.js.map +1 -0
- package/dist/install-autostart-reconciliation-NHKOFYTD.js +73 -0
- package/dist/install-autostart-reconciliation-NHKOFYTD.js.map +1 -0
- package/dist/launch-REYCIR3Z.js +225 -0
- package/dist/launch-REYCIR3Z.js.map +1 -0
- package/dist/list-NPRXRQY2.js +51 -0
- package/dist/list-NPRXRQY2.js.map +1 -0
- package/dist/list-STYD2ZWA.js +54 -0
- package/dist/list-STYD2ZWA.js.map +1 -0
- package/dist/local-HXJLUUNT.js +54 -0
- package/dist/local-HXJLUUNT.js.map +1 -0
- package/dist/macro-resolve-ZIJZ65QI.js +253 -0
- package/dist/macro-resolve-ZIJZ65QI.js.map +1 -0
- package/dist/macros/execute-runtime.d.ts +3 -1
- package/dist/macros/execute-runtime.d.ts.map +1 -1
- package/dist/macros/execute.d.ts +2 -0
- package/dist/macros/execute.d.ts.map +1 -1
- package/dist/native-UPLVQ2SG.js +22 -0
- package/dist/native-UPLVQ2SG.js.map +1 -0
- package/dist/network-poll-HLDOSC72.js +76 -0
- package/dist/network-poll-HLDOSC72.js.map +1 -0
- package/dist/new-HXLLN6UT.js +69 -0
- package/dist/new-HXLLN6UT.js.map +1 -0
- package/dist/onboarding-metadata-7E3KLYSZ.js +27 -0
- package/dist/onboarding-metadata-7E3KLYSZ.js.map +1 -0
- package/dist/open-KDR25LQZ.js +81 -0
- package/dist/open-KDR25LQZ.js.map +1 -0
- package/dist/opendevbrowser.js +68 -34
- package/dist/opendevbrowser.js.map +1 -1
- package/dist/perf-EM6SWFJ6.js +58 -0
- package/dist/perf-EM6SWFJ6.js.map +1 -0
- package/dist/pointer-down-ZYWRZNCH.js +55 -0
- package/dist/pointer-down-ZYWRZNCH.js.map +1 -0
- package/dist/pointer-drag-LVEAVJO4.js +54 -0
- package/dist/pointer-drag-LVEAVJO4.js.map +1 -0
- package/dist/pointer-move-7SRKUS66.js +52 -0
- package/dist/pointer-move-7SRKUS66.js.map +1 -0
- package/dist/pointer-up-KLDBSK37.js +55 -0
- package/dist/pointer-up-KLDBSK37.js.map +1 -0
- package/dist/press-UIIXFTD7.js +83 -0
- package/dist/press-UIIXFTD7.js.map +1 -0
- package/dist/product-video-PYOXJVAI.js +235 -0
- package/dist/product-video-PYOXJVAI.js.map +1 -0
- package/dist/providers/artifacts.d.ts +0 -2
- package/dist/providers/artifacts.d.ts.map +1 -1
- package/dist/providers/blocker.d.ts.map +1 -1
- package/dist/providers/bounded-map.d.ts +2 -0
- package/dist/providers/bounded-map.d.ts.map +1 -0
- package/dist/providers/community/index.d.ts.map +1 -1
- package/dist/providers/constraint.d.ts.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/renderer.d.ts.map +1 -1
- package/dist/providers/research-compiler.d.ts +1 -1
- package/dist/providers/research-compiler.d.ts.map +1 -1
- package/dist/providers/research-executor.d.ts.map +1 -1
- package/dist/providers/runtime-factory.d.ts.map +1 -1
- package/dist/providers/shared/traversal-url.d.ts +3 -0
- package/dist/providers/shared/traversal-url.d.ts.map +1 -1
- package/dist/providers/shopping/index.d.ts.map +1 -1
- package/dist/providers/social/search-quality.d.ts.map +1 -1
- package/dist/providers/workflow-handoff.d.ts +4 -0
- package/dist/providers/workflow-handoff.d.ts.map +1 -1
- package/dist/providers/workflows.d.ts.map +1 -1
- package/dist/{providers-QF2RFB4J.js → providers-4YY2BLXG.js} +19 -14
- package/dist/providers-4YY2BLXG.js.map +1 -0
- package/dist/public-surface/generated-manifest.d.ts +2 -2
- package/dist/public-surface/generated-manifest.d.ts.map +1 -1
- package/dist/public-surface/source.d.ts +2 -2
- package/dist/public-surface/source.d.ts.map +1 -1
- package/dist/relay/protocol.d.ts +3 -1
- package/dist/relay/protocol.d.ts.map +1 -1
- package/dist/relay/relay-server.d.ts +6 -0
- package/dist/relay/relay-server.d.ts.map +1 -1
- package/dist/research-CKXMJ2DK.js +295 -0
- package/dist/research-CKXMJ2DK.js.map +1 -0
- package/dist/review-7HWJPZOD.js +48 -0
- package/dist/review-7HWJPZOD.js.map +1 -0
- package/dist/review-desktop-2IBJHFB5.js +54 -0
- package/dist/review-desktop-2IBJHFB5.js.map +1 -0
- package/dist/rpc-3HGIEJUO.js +159 -0
- package/dist/rpc-3HGIEJUO.js.map +1 -0
- package/dist/run-ADRYI3MS.js +180 -0
- package/dist/run-ADRYI3MS.js.map +1 -0
- package/dist/screencast-start-DTLUHD5H.js +67 -0
- package/dist/screencast-start-DTLUHD5H.js.map +1 -0
- package/dist/screencast-stop-54C5LRSS.js +59 -0
- package/dist/screencast-stop-54C5LRSS.js.map +1 -0
- package/dist/screenshot-HOAKR7P7.js +68 -0
- package/dist/screenshot-HOAKR7P7.js.map +1 -0
- package/dist/scroll-IAOO5COY.js +84 -0
- package/dist/scroll-IAOO5COY.js.map +1 -0
- package/dist/scroll-into-view-RKWSLAPH.js +71 -0
- package/dist/scroll-into-view-RKWSLAPH.js.map +1 -0
- package/dist/select-IGD3T6X4.js +86 -0
- package/dist/select-IGD3T6X4.js.map +1 -0
- package/dist/serve-7X4INUCU.js +498 -0
- package/dist/serve-7X4INUCU.js.map +1 -0
- package/dist/shopping-FC6DRW76.js +273 -0
- package/dist/shopping-FC6DRW76.js.map +1 -0
- package/dist/skill-lifecycle-5UAZGKSN.js +89 -0
- package/dist/skill-lifecycle-5UAZGKSN.js.map +1 -0
- package/dist/skills-NSXDX6YM.js +26 -0
- package/dist/skills-NSXDX6YM.js.map +1 -0
- package/dist/snapshot-X22GG324.js +113 -0
- package/dist/snapshot-X22GG324.js.map +1 -0
- package/dist/status-SP55LMNW.js +132 -0
- package/dist/status-SP55LMNW.js.map +1 -0
- package/dist/status-VH2WXIDG.js +35 -0
- package/dist/status-VH2WXIDG.js.map +1 -0
- package/dist/status-capabilities-YBERLRRA.js +57 -0
- package/dist/status-capabilities-YBERLRRA.js.map +1 -0
- package/dist/text-6TB5WNLI.js +84 -0
- package/dist/text-6TB5WNLI.js.map +1 -0
- package/dist/tools/macro_resolve.d.ts.map +1 -1
- package/dist/type-3UI3TQH3.js +94 -0
- package/dist/type-3UI3TQH3.js.map +1 -0
- package/dist/uncheck-5L3D2D4U.js +71 -0
- package/dist/uncheck-5L3D2D4U.js.map +1 -0
- package/dist/uninstall-KYKGJAX7.js +91 -0
- package/dist/uninstall-KYKGJAX7.js.map +1 -0
- package/dist/update-SMXPYGXS.js +305 -0
- package/dist/update-SMXPYGXS.js.map +1 -0
- package/dist/update-skill-modes-BVX7IVMW.js +38 -0
- package/dist/update-skill-modes-BVX7IVMW.js.map +1 -0
- package/dist/upload-YG4J2EMI.js +56 -0
- package/dist/upload-YG4J2EMI.js.map +1 -0
- package/dist/use-V3LGFP3K.js +63 -0
- package/dist/use-V3LGFP3K.js.map +1 -0
- package/dist/value-3247D57X.js +71 -0
- package/dist/value-3247D57X.js.map +1 -0
- package/dist/visible-A7HEV36U.js +71 -0
- package/dist/visible-A7HEV36U.js.map +1 -0
- package/dist/wait-UZPP4Y4R.js +109 -0
- package/dist/wait-UZPP4Y4R.js.map +1 -0
- package/dist/windows-76TR3AIP.js +37 -0
- package/dist/windows-76TR3AIP.js.map +1 -0
- package/extension/dist/background.js +99 -22
- package/extension/dist/ops/ops-runtime.js +85 -7
- package/extension/dist/ops/ops-session-store.js +3 -0
- package/extension/dist/ops/target-session-coordinator.js +3 -0
- package/extension/dist/services/CDPRouter.js +9 -0
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
- package/skills/opendevbrowser-best-practices/SKILL.md +8 -6
- package/skills/opendevbrowser-best-practices/artifacts/skill-runtime-surface-matrix.md +1 -1
- package/skills/opendevbrowser-best-practices/scripts/odb-workflow.sh +3 -2
- package/skills/opendevbrowser-best-practices/scripts/validator-fixture-cli.sh +39 -2
- package/skills/opendevbrowser-research/SKILL.md +64 -12
- package/skills/opendevbrowser-research/artifacts/research-workflows.md +56 -19
- package/skills/opendevbrowser-research/assets/templates/compact.md +31 -5
- package/skills/opendevbrowser-research/assets/templates/context.json +52 -1
- package/skills/opendevbrowser-research/assets/templates/report.md +57 -4
- package/skills/opendevbrowser-research/examples/sample-input.json +1 -1
- package/skills/opendevbrowser-research/examples/sample-output.md +27 -2
- package/skills/opendevbrowser-research/scripts/run-research.sh +2 -6
- package/skills/opendevbrowser-research/scripts/validate-skill-assets.sh +115 -1
- package/dist/chunk-I5ZCOZZV.js.map +0 -1
- package/dist/chunk-QVWOPIZJ.js.map +0 -1
- package/dist/chunk-T3VVHJTK.js.map +0 -1
- /package/dist/{providers-QF2RFB4J.js.map → chunk-RJNI3BHT.js.map} +0 -0
|
@@ -0,0 +1,940 @@
|
|
|
1
|
+
import {
|
|
2
|
+
generateSecureToken
|
|
3
|
+
} from "./chunk-ASMHEEKY.js";
|
|
4
|
+
import {
|
|
5
|
+
writeFileAtomic
|
|
6
|
+
} from "./chunk-TBUCZX4A.js";
|
|
7
|
+
|
|
8
|
+
// src/config.ts
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import * as fs from "fs";
|
|
11
|
+
import * as path from "path";
|
|
12
|
+
import * as os from "os";
|
|
13
|
+
import { parse as parseJsonc, modify, applyEdits } from "jsonc-parser";
|
|
14
|
+
|
|
15
|
+
// src/canvas/code-sync/types.ts
|
|
16
|
+
var LEGACY_CODE_SYNC_ADAPTERS = ["tsx-react-v1"];
|
|
17
|
+
var BUILT_IN_FRAMEWORK_ADAPTER_IDS = [
|
|
18
|
+
"builtin:react-tsx-v2",
|
|
19
|
+
"builtin:html-static-v1",
|
|
20
|
+
"builtin:custom-elements-v1",
|
|
21
|
+
"builtin:vue-sfc-v1",
|
|
22
|
+
"builtin:svelte-sfc-v1"
|
|
23
|
+
];
|
|
24
|
+
var CODE_SYNC_ADAPTERS = [
|
|
25
|
+
...LEGACY_CODE_SYNC_ADAPTERS,
|
|
26
|
+
...BUILT_IN_FRAMEWORK_ADAPTER_IDS
|
|
27
|
+
];
|
|
28
|
+
var CODE_SYNC_SYNC_MODES = ["manual", "watch"];
|
|
29
|
+
var CODE_SYNC_PROJECTIONS = ["canvas_html", "bound_app_runtime"];
|
|
30
|
+
var CODE_SYNC_OWNERSHIP_DIMENSIONS = [
|
|
31
|
+
"structure",
|
|
32
|
+
"text",
|
|
33
|
+
"style",
|
|
34
|
+
"tokens",
|
|
35
|
+
"behavior",
|
|
36
|
+
"data"
|
|
37
|
+
];
|
|
38
|
+
var CODE_SYNC_OWNERSHIP_STATES = ["shared", "canvas", "code"];
|
|
39
|
+
var CODE_SYNC_CAPABILITIES = [
|
|
40
|
+
"preview",
|
|
41
|
+
"inventory_extract",
|
|
42
|
+
"code_pull",
|
|
43
|
+
"code_push",
|
|
44
|
+
"token_roundtrip",
|
|
45
|
+
"figma_materialize"
|
|
46
|
+
];
|
|
47
|
+
var CODE_SYNC_STATUS_REASONS = [
|
|
48
|
+
"none",
|
|
49
|
+
"framework_migrated",
|
|
50
|
+
"manifest_migrated",
|
|
51
|
+
"requires_rebind",
|
|
52
|
+
"framework_mismatch",
|
|
53
|
+
"adapter_mismatch",
|
|
54
|
+
"capability_denied",
|
|
55
|
+
"plugin_not_found",
|
|
56
|
+
"plugin_load_failed",
|
|
57
|
+
"plugin_execution_failed",
|
|
58
|
+
"import_graph_changed"
|
|
59
|
+
];
|
|
60
|
+
var DEFAULT_CODE_SYNC_OWNERSHIP = {
|
|
61
|
+
structure: "shared",
|
|
62
|
+
text: "shared",
|
|
63
|
+
style: "shared",
|
|
64
|
+
tokens: "shared",
|
|
65
|
+
behavior: "code",
|
|
66
|
+
data: "code"
|
|
67
|
+
};
|
|
68
|
+
var BUILT_IN_FRAMEWORK_DETAILS = {
|
|
69
|
+
"builtin:react-tsx-v2": {
|
|
70
|
+
frameworkId: "react",
|
|
71
|
+
sourceFamily: "react-tsx",
|
|
72
|
+
adapterKind: "tsx-react",
|
|
73
|
+
adapterVersion: 2,
|
|
74
|
+
declaredCapabilities: ["preview", "inventory_extract", "code_pull", "code_push", "token_roundtrip"]
|
|
75
|
+
},
|
|
76
|
+
"builtin:html-static-v1": {
|
|
77
|
+
frameworkId: "html",
|
|
78
|
+
sourceFamily: "html-static",
|
|
79
|
+
adapterKind: "html-static",
|
|
80
|
+
adapterVersion: 1,
|
|
81
|
+
declaredCapabilities: ["preview", "inventory_extract", "code_pull"]
|
|
82
|
+
},
|
|
83
|
+
"builtin:custom-elements-v1": {
|
|
84
|
+
frameworkId: "custom-elements",
|
|
85
|
+
sourceFamily: "custom-elements",
|
|
86
|
+
adapterKind: "custom-elements",
|
|
87
|
+
adapterVersion: 1,
|
|
88
|
+
declaredCapabilities: ["preview", "inventory_extract", "code_pull"]
|
|
89
|
+
},
|
|
90
|
+
"builtin:vue-sfc-v1": {
|
|
91
|
+
frameworkId: "vue",
|
|
92
|
+
sourceFamily: "vue-sfc",
|
|
93
|
+
adapterKind: "vue-sfc",
|
|
94
|
+
adapterVersion: 1,
|
|
95
|
+
declaredCapabilities: ["preview", "inventory_extract", "code_pull"]
|
|
96
|
+
},
|
|
97
|
+
"builtin:svelte-sfc-v1": {
|
|
98
|
+
frameworkId: "svelte",
|
|
99
|
+
sourceFamily: "svelte-sfc",
|
|
100
|
+
adapterKind: "svelte-sfc",
|
|
101
|
+
adapterVersion: 1,
|
|
102
|
+
declaredCapabilities: ["preview", "inventory_extract", "code_pull"]
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var LEGACY_ADAPTER_MAP = {
|
|
106
|
+
"tsx-react-v1": {
|
|
107
|
+
frameworkAdapterId: "builtin:react-tsx-v2",
|
|
108
|
+
reasonCode: "framework_migrated"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
112
|
+
function readString(value) {
|
|
113
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
114
|
+
}
|
|
115
|
+
function readNumber(value) {
|
|
116
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
117
|
+
}
|
|
118
|
+
function readStringArray(value) {
|
|
119
|
+
if (!Array.isArray(value)) {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
return [...new Set(value.filter((entry) => typeof entry === "string" && entry.trim().length > 0).map((entry) => entry.trim()))];
|
|
123
|
+
}
|
|
124
|
+
function isCodeSyncProjectionMode(value) {
|
|
125
|
+
return typeof value === "string" && CODE_SYNC_PROJECTIONS.includes(value);
|
|
126
|
+
}
|
|
127
|
+
function isCodeSyncCapability(value) {
|
|
128
|
+
return typeof value === "string" && CODE_SYNC_CAPABILITIES.includes(value);
|
|
129
|
+
}
|
|
130
|
+
function isCodeSyncStatusReason(value) {
|
|
131
|
+
return typeof value === "string" && CODE_SYNC_STATUS_REASONS.includes(value);
|
|
132
|
+
}
|
|
133
|
+
function normalizeCodeSyncOwnership(value) {
|
|
134
|
+
if (!isRecord(value)) {
|
|
135
|
+
return { ...DEFAULT_CODE_SYNC_OWNERSHIP };
|
|
136
|
+
}
|
|
137
|
+
const normalized = {};
|
|
138
|
+
for (const dimension of CODE_SYNC_OWNERSHIP_DIMENSIONS) {
|
|
139
|
+
const entry = value[dimension];
|
|
140
|
+
normalized[dimension] = typeof entry === "string" && CODE_SYNC_OWNERSHIP_STATES.includes(entry) ? entry : DEFAULT_CODE_SYNC_OWNERSHIP[dimension];
|
|
141
|
+
}
|
|
142
|
+
return normalized;
|
|
143
|
+
}
|
|
144
|
+
function defaultDeclaredCapabilities(frameworkAdapterId) {
|
|
145
|
+
const details = BUILT_IN_FRAMEWORK_DETAILS[frameworkAdapterId];
|
|
146
|
+
return details ? [...details.declaredCapabilities] : ["preview"];
|
|
147
|
+
}
|
|
148
|
+
function defaultGrantedCapabilities(frameworkAdapterId) {
|
|
149
|
+
return defaultDeclaredCapabilities(frameworkAdapterId).map((capability) => ({
|
|
150
|
+
capability,
|
|
151
|
+
granted: true
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
function mergeDeclaredCapabilities(frameworkAdapterId, explicitCapabilities) {
|
|
155
|
+
const merged = new Set(defaultDeclaredCapabilities(frameworkAdapterId));
|
|
156
|
+
for (const capability of explicitCapabilities) {
|
|
157
|
+
merged.add(capability);
|
|
158
|
+
}
|
|
159
|
+
return [...merged];
|
|
160
|
+
}
|
|
161
|
+
function mergeGrantedCapabilities(frameworkAdapterId, explicitGrants) {
|
|
162
|
+
const grants = /* @__PURE__ */ new Map();
|
|
163
|
+
for (const grant of defaultGrantedCapabilities(frameworkAdapterId)) {
|
|
164
|
+
grants.set(grant.capability, grant);
|
|
165
|
+
}
|
|
166
|
+
for (const grant of explicitGrants) {
|
|
167
|
+
grants.set(grant.capability, grant);
|
|
168
|
+
}
|
|
169
|
+
return [...grants.values()];
|
|
170
|
+
}
|
|
171
|
+
function inferBuiltInFrameworkAdapterIdFromPath(repoPath) {
|
|
172
|
+
const normalized = repoPath.toLowerCase();
|
|
173
|
+
if (normalized.endsWith(".vue")) {
|
|
174
|
+
return "builtin:vue-sfc-v1";
|
|
175
|
+
}
|
|
176
|
+
if (normalized.endsWith(".svelte")) {
|
|
177
|
+
return "builtin:svelte-sfc-v1";
|
|
178
|
+
}
|
|
179
|
+
if (normalized.endsWith(".html") || normalized.endsWith(".htm")) {
|
|
180
|
+
return "builtin:html-static-v1";
|
|
181
|
+
}
|
|
182
|
+
return "builtin:react-tsx-v2";
|
|
183
|
+
}
|
|
184
|
+
function inferCodeSyncSourceFamilyFromPath(repoPath) {
|
|
185
|
+
return BUILT_IN_FRAMEWORK_DETAILS[inferBuiltInFrameworkAdapterIdFromPath(repoPath)].sourceFamily;
|
|
186
|
+
}
|
|
187
|
+
function normalizeCodeSyncRootLocator(value, options) {
|
|
188
|
+
const record = isRecord(value) ? value : {};
|
|
189
|
+
const kind = readString(record.kind);
|
|
190
|
+
const exportName = readString(record.exportName) ?? options.exportName;
|
|
191
|
+
const selector = readString(record.selector) ?? options.selector;
|
|
192
|
+
if (options.sourceFamily === "react-tsx") {
|
|
193
|
+
if (kind === "dom-selector" && selector) {
|
|
194
|
+
return { kind, selector };
|
|
195
|
+
}
|
|
196
|
+
if (exportName) {
|
|
197
|
+
return {
|
|
198
|
+
kind: "react-export",
|
|
199
|
+
exportName,
|
|
200
|
+
...selector ? { selector } : {}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
if (selector) {
|
|
204
|
+
return {
|
|
205
|
+
kind: "dom-selector",
|
|
206
|
+
selector
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
throw new Error("codeSync.exportName or codeSync.selector is required.");
|
|
210
|
+
}
|
|
211
|
+
if (options.sourceFamily === "vue-sfc") {
|
|
212
|
+
return {
|
|
213
|
+
kind: "vue-template",
|
|
214
|
+
...selector ? { selector } : {}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
if (options.sourceFamily === "svelte-sfc") {
|
|
218
|
+
return {
|
|
219
|
+
kind: "svelte-markup",
|
|
220
|
+
...selector ? { selector } : {}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
if (selector) {
|
|
224
|
+
return {
|
|
225
|
+
kind: "dom-selector",
|
|
226
|
+
selector
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
kind: "document-root"
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function normalizeCodeSyncCapabilityGrant(value) {
|
|
234
|
+
if (!isRecord(value) || !isCodeSyncCapability(value.capability)) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
capability: value.capability,
|
|
239
|
+
granted: value.granted !== false,
|
|
240
|
+
...isCodeSyncStatusReason(value.reasonCode) ? { reasonCode: value.reasonCode } : {},
|
|
241
|
+
...isRecord(value.details) ? { details: value.details } : {}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function normalizeFrameworkAdapterIdentity(input) {
|
|
245
|
+
const adapter = input.adapter ?? "";
|
|
246
|
+
const explicitFrameworkAdapterId = readString(input.frameworkAdapterId);
|
|
247
|
+
const inferredFrameworkAdapterId = explicitFrameworkAdapterId ?? (adapter in LEGACY_ADAPTER_MAP ? LEGACY_ADAPTER_MAP[adapter].frameworkAdapterId : adapter.startsWith("builtin:") ? adapter : adapter.includes("/") ? adapter : inferBuiltInFrameworkAdapterIdFromPath(input.repoPath));
|
|
248
|
+
const migratedReason = adapter in LEGACY_ADAPTER_MAP ? LEGACY_ADAPTER_MAP[adapter].reasonCode : "none";
|
|
249
|
+
if (inferredFrameworkAdapterId in BUILT_IN_FRAMEWORK_DETAILS) {
|
|
250
|
+
const details = BUILT_IN_FRAMEWORK_DETAILS[inferredFrameworkAdapterId];
|
|
251
|
+
return {
|
|
252
|
+
adapter: adapter || inferredFrameworkAdapterId,
|
|
253
|
+
frameworkAdapterId: inferredFrameworkAdapterId,
|
|
254
|
+
frameworkId: details.frameworkId,
|
|
255
|
+
sourceFamily: details.sourceFamily,
|
|
256
|
+
adapterKind: details.adapterKind,
|
|
257
|
+
adapterVersion: details.adapterVersion,
|
|
258
|
+
reasonCode: migratedReason
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
const pluginId = inferredFrameworkAdapterId.includes("/") ? inferredFrameworkAdapterId.split("/", 1)[0] : void 0;
|
|
262
|
+
const sourceFamily = inferCodeSyncSourceFamilyFromPath(input.repoPath);
|
|
263
|
+
return {
|
|
264
|
+
adapter: adapter || inferredFrameworkAdapterId,
|
|
265
|
+
frameworkAdapterId: inferredFrameworkAdapterId,
|
|
266
|
+
frameworkId: sourceFamily === "react-tsx" ? "react" : sourceFamily === "vue-sfc" ? "vue" : sourceFamily === "svelte-sfc" ? "svelte" : "html",
|
|
267
|
+
sourceFamily,
|
|
268
|
+
adapterKind: pluginId ? "plugin" : "unknown",
|
|
269
|
+
adapterVersion: 1,
|
|
270
|
+
reasonCode: migratedReason,
|
|
271
|
+
...pluginId ? { pluginId } : {}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function normalizeCodeSyncBindingMetadata(value) {
|
|
275
|
+
if (!isRecord(value)) {
|
|
276
|
+
throw new Error("Invalid code sync binding metadata.");
|
|
277
|
+
}
|
|
278
|
+
const repoPath = readString(value.repoPath);
|
|
279
|
+
const syncMode = readString(value.syncMode);
|
|
280
|
+
if (!repoPath) {
|
|
281
|
+
throw new Error("codeSync.repoPath is required.");
|
|
282
|
+
}
|
|
283
|
+
if (!syncMode || !CODE_SYNC_SYNC_MODES.includes(syncMode)) {
|
|
284
|
+
throw new Error(`Unsupported code sync mode: ${syncMode || "unknown"}`);
|
|
285
|
+
}
|
|
286
|
+
const exportName = readString(value.exportName) ?? void 0;
|
|
287
|
+
const selector = readString(value.selector) ?? void 0;
|
|
288
|
+
const identity = normalizeFrameworkAdapterIdentity({
|
|
289
|
+
adapter: readString(value.adapter),
|
|
290
|
+
frameworkAdapterId: readString(value.frameworkAdapterId),
|
|
291
|
+
repoPath
|
|
292
|
+
});
|
|
293
|
+
const rootLocator = normalizeCodeSyncRootLocator(value.rootLocator, {
|
|
294
|
+
sourceFamily: identity.sourceFamily,
|
|
295
|
+
exportName,
|
|
296
|
+
selector
|
|
297
|
+
});
|
|
298
|
+
const declaredCapabilities = readStringArray(value.declaredCapabilities).filter((entry) => isCodeSyncCapability(entry));
|
|
299
|
+
const grantedCapabilities = Array.isArray(value.grantedCapabilities) ? value.grantedCapabilities.map((entry) => normalizeCodeSyncCapabilityGrant(entry)).filter((entry) => Boolean(entry)) : [];
|
|
300
|
+
const manifestVersion = readNumber(value.manifestVersion) ?? 2;
|
|
301
|
+
const reasonCode = isCodeSyncStatusReason(value.reasonCode) ? value.reasonCode : identity.reasonCode;
|
|
302
|
+
return {
|
|
303
|
+
adapter: identity.adapter,
|
|
304
|
+
frameworkAdapterId: identity.frameworkAdapterId,
|
|
305
|
+
frameworkId: readString(value.frameworkId) ?? identity.frameworkId,
|
|
306
|
+
sourceFamily: readString(value.sourceFamily) ?? identity.sourceFamily,
|
|
307
|
+
adapterKind: readString(value.adapterKind) ?? identity.adapterKind,
|
|
308
|
+
adapterVersion: readNumber(value.adapterVersion) ?? identity.adapterVersion,
|
|
309
|
+
repoPath,
|
|
310
|
+
rootLocator,
|
|
311
|
+
exportName,
|
|
312
|
+
selector,
|
|
313
|
+
syncMode,
|
|
314
|
+
ownership: normalizeCodeSyncOwnership(value.ownership),
|
|
315
|
+
route: readString(value.route) ?? void 0,
|
|
316
|
+
verificationTarget: readString(value.verificationTarget) ?? void 0,
|
|
317
|
+
runtimeRootSelector: readString(value.runtimeRootSelector) ?? void 0,
|
|
318
|
+
projection: isCodeSyncProjectionMode(value.projection) ? value.projection : "canvas_html",
|
|
319
|
+
manifestVersion,
|
|
320
|
+
libraryAdapterIds: readStringArray(value.libraryAdapterIds ?? value.libraryAdapters),
|
|
321
|
+
pluginId: readString(value.pluginId) ?? identity.pluginId,
|
|
322
|
+
declaredCapabilities: declaredCapabilities.length > 0 ? mergeDeclaredCapabilities(identity.frameworkAdapterId, declaredCapabilities) : defaultDeclaredCapabilities(identity.frameworkAdapterId),
|
|
323
|
+
grantedCapabilities: grantedCapabilities.length > 0 ? mergeGrantedCapabilities(identity.frameworkAdapterId, grantedCapabilities) : defaultGrantedCapabilities(identity.frameworkAdapterId),
|
|
324
|
+
reasonCode
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// src/config.ts
|
|
329
|
+
function isExecutable(filePath) {
|
|
330
|
+
try {
|
|
331
|
+
fs.accessSync(filePath, fs.constants.X_OK);
|
|
332
|
+
return true;
|
|
333
|
+
} catch {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
var DEFAULT_RELAY_PORT = 8787;
|
|
338
|
+
var DEFAULT_DAEMON_PORT = 8788;
|
|
339
|
+
function buildDefaultConfigJsonc(relayToken, daemonToken) {
|
|
340
|
+
return `{
|
|
341
|
+
// Set relayToken to false to disable extension pairing.
|
|
342
|
+
"relayPort": ${DEFAULT_RELAY_PORT},
|
|
343
|
+
"relayToken": "${relayToken}",
|
|
344
|
+
// Optional: extension ID for native host auto-install.
|
|
345
|
+
// "nativeExtensionId": "abcdefghijklmnopabcdefghijklmnop",
|
|
346
|
+
"daemonPort": ${DEFAULT_DAEMON_PORT},
|
|
347
|
+
"daemonToken": "${daemonToken}"
|
|
348
|
+
}
|
|
349
|
+
`;
|
|
350
|
+
}
|
|
351
|
+
var snapshotSchema = z.object({
|
|
352
|
+
maxChars: z.number().int().min(500).max(2e5).default(16e3),
|
|
353
|
+
maxNodes: z.number().int().min(50).max(5e3).default(1e3)
|
|
354
|
+
});
|
|
355
|
+
var securitySchema = z.object({
|
|
356
|
+
allowRawCDP: z.boolean().default(false),
|
|
357
|
+
allowNonLocalCdp: z.boolean().default(false),
|
|
358
|
+
allowUnsafeExport: z.boolean().default(false),
|
|
359
|
+
promptInjectionGuard: z.object({
|
|
360
|
+
enabled: z.boolean().default(true)
|
|
361
|
+
}).default({})
|
|
362
|
+
});
|
|
363
|
+
var DEFAULT_PROVIDER_COOKIE_FILE = "~/.config/opencode/opendevbrowser.provider-cookies.json";
|
|
364
|
+
var DEFAULT_PROVIDER_COOKIE_ENV = "OPENDEVBROWSER_PROVIDER_COOKIES";
|
|
365
|
+
var providerCookieRecordSchema = z.object({
|
|
366
|
+
name: z.string().min(1),
|
|
367
|
+
value: z.string(),
|
|
368
|
+
url: z.string().min(1).optional(),
|
|
369
|
+
domain: z.string().min(1).optional(),
|
|
370
|
+
path: z.string().optional(),
|
|
371
|
+
expires: z.number().optional(),
|
|
372
|
+
httpOnly: z.boolean().optional(),
|
|
373
|
+
secure: z.boolean().optional(),
|
|
374
|
+
sameSite: z.enum(["Strict", "Lax", "None"]).optional()
|
|
375
|
+
}).superRefine((cookie, ctx) => {
|
|
376
|
+
if (!cookie.url && !cookie.domain) {
|
|
377
|
+
ctx.addIssue({
|
|
378
|
+
code: z.ZodIssueCode.custom,
|
|
379
|
+
message: "Provider cookie entries must set url or domain."
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
var providersSchema = z.object({
|
|
384
|
+
tiers: z.object({
|
|
385
|
+
default: z.enum(["A", "B", "C"]).default("A"),
|
|
386
|
+
enableHybrid: z.boolean().default(false),
|
|
387
|
+
enableRestrictedSafe: z.boolean().default(false),
|
|
388
|
+
hybridRiskThreshold: z.number().min(0).max(1).default(0.6),
|
|
389
|
+
restrictedSafeRecoveryIntervalMs: z.number().int().min(0).max(864e5).default(6e4)
|
|
390
|
+
}).default({}),
|
|
391
|
+
adaptiveConcurrency: z.object({
|
|
392
|
+
enabled: z.boolean().default(false),
|
|
393
|
+
maxGlobal: z.number().int().min(1).max(512).default(8),
|
|
394
|
+
maxPerDomain: z.number().int().min(1).max(256).default(4)
|
|
395
|
+
}).default({}),
|
|
396
|
+
crawler: z.object({
|
|
397
|
+
workerThreads: z.number().int().min(1).max(64).default(4),
|
|
398
|
+
queueMax: z.number().int().min(1).max(1e5).default(2e3)
|
|
399
|
+
}).default({}),
|
|
400
|
+
antiBotPolicy: z.object({
|
|
401
|
+
enabled: z.boolean().default(true),
|
|
402
|
+
cooldownMs: z.number().int().min(0).max(3e5).default(3e4),
|
|
403
|
+
maxChallengeRetries: z.number().int().min(0).max(10).default(1),
|
|
404
|
+
proxyHint: z.string().min(1).optional(),
|
|
405
|
+
sessionHint: z.string().min(1).optional(),
|
|
406
|
+
allowBrowserEscalation: z.boolean().default(true)
|
|
407
|
+
}).default({}),
|
|
408
|
+
challengeOrchestration: z.object({
|
|
409
|
+
mode: z.enum(["off", "browser", "browser_with_helper"]).default("browser_with_helper"),
|
|
410
|
+
attemptBudget: z.number().int().min(1).max(20).default(6),
|
|
411
|
+
noProgressLimit: z.number().int().min(1).max(10).default(3),
|
|
412
|
+
stepTimeoutMs: z.number().int().min(250).max(12e4).default(5e3),
|
|
413
|
+
minAttemptGapMs: z.number().int().min(0).max(3e5).default(1e4),
|
|
414
|
+
allowAuthNavigation: z.boolean().default(true),
|
|
415
|
+
allowSessionReuse: z.boolean().default(true),
|
|
416
|
+
allowCookieReuse: z.boolean().default(true),
|
|
417
|
+
allowNonSecretFormFill: z.boolean().default(true),
|
|
418
|
+
allowInteractionExploration: z.boolean().default(true),
|
|
419
|
+
governed: z.object({
|
|
420
|
+
allowOwnedEnvironmentFixtures: z.boolean().default(true),
|
|
421
|
+
allowSanctionedIdentity: z.boolean().default(false),
|
|
422
|
+
allowServiceAdapters: z.boolean().default(false),
|
|
423
|
+
requireAuditMetadata: z.boolean().default(true)
|
|
424
|
+
}).default({}),
|
|
425
|
+
optionalComputerUseBridge: z.object({
|
|
426
|
+
enabled: z.boolean().default(true),
|
|
427
|
+
maxSuggestions: z.number().int().min(1).max(20).default(3)
|
|
428
|
+
}).default({})
|
|
429
|
+
}).default({}),
|
|
430
|
+
transcript: z.object({
|
|
431
|
+
modeDefault: z.union([
|
|
432
|
+
z.enum(["auto", "web", "no-auto", "yt-dlp", "apify"]),
|
|
433
|
+
z.literal("ytdlp")
|
|
434
|
+
]).default("auto").transform((mode) => mode === "ytdlp" ? "yt-dlp" : mode),
|
|
435
|
+
strategyOrder: z.array(z.enum([
|
|
436
|
+
"youtubei",
|
|
437
|
+
"native_caption_parse",
|
|
438
|
+
"ytdlp_audio_asr",
|
|
439
|
+
"apify",
|
|
440
|
+
"ytdlp_subtitle",
|
|
441
|
+
"optional_asr"
|
|
442
|
+
])).default(["youtubei", "native_caption_parse", "ytdlp_audio_asr", "apify"]),
|
|
443
|
+
enableYtdlp: z.boolean().default(false),
|
|
444
|
+
enableAsr: z.boolean().default(false),
|
|
445
|
+
enableYtdlpAudioAsr: z.boolean().default(true),
|
|
446
|
+
enableApify: z.boolean().default(true),
|
|
447
|
+
apifyActorId: z.string().min(1).default("streamers/youtube-scraper"),
|
|
448
|
+
enableBrowserFallback: z.boolean().default(false),
|
|
449
|
+
ytdlpTimeoutMs: z.number().int().min(1e3).max(12e4).default(1e4)
|
|
450
|
+
}).default({}),
|
|
451
|
+
cookiePolicy: z.enum(["off", "auto", "required"]).default("auto"),
|
|
452
|
+
cookieSource: z.object({
|
|
453
|
+
type: z.enum(["file", "env", "inline"]).default("file"),
|
|
454
|
+
value: z.union([
|
|
455
|
+
z.string(),
|
|
456
|
+
z.array(providerCookieRecordSchema)
|
|
457
|
+
]).optional()
|
|
458
|
+
}).transform((raw) => {
|
|
459
|
+
if (raw.type === "inline") {
|
|
460
|
+
return {
|
|
461
|
+
type: "inline",
|
|
462
|
+
value: Array.isArray(raw.value) ? raw.value : []
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
return {
|
|
466
|
+
type: raw.type,
|
|
467
|
+
value: typeof raw.value === "string" ? raw.value : raw.type === "file" ? DEFAULT_PROVIDER_COOKIE_FILE : DEFAULT_PROVIDER_COOKIE_ENV
|
|
468
|
+
};
|
|
469
|
+
}).default({
|
|
470
|
+
type: "file",
|
|
471
|
+
value: DEFAULT_PROVIDER_COOKIE_FILE
|
|
472
|
+
})
|
|
473
|
+
}).default({});
|
|
474
|
+
var canarySchema = z.object({
|
|
475
|
+
targets: z.object({
|
|
476
|
+
enabled: z.boolean().default(false)
|
|
477
|
+
}).default({})
|
|
478
|
+
});
|
|
479
|
+
var devtoolsSchema = z.object({
|
|
480
|
+
showFullUrls: z.boolean().default(false),
|
|
481
|
+
showFullConsole: z.boolean().default(false)
|
|
482
|
+
});
|
|
483
|
+
var exportSchema = z.object({
|
|
484
|
+
maxNodes: z.number().int().min(1).max(5e3).default(1e3),
|
|
485
|
+
inlineStyles: z.boolean().default(true)
|
|
486
|
+
});
|
|
487
|
+
var desktopSchema = z.object({
|
|
488
|
+
permissionLevel: z.enum(["off", "observe"]).default("observe"),
|
|
489
|
+
commandTimeoutMs: z.number().int().min(250).max(3e5).default(1e4),
|
|
490
|
+
auditArtifactsDir: z.string().min(1).default(".opendevbrowser/desktop-runtime"),
|
|
491
|
+
accessibilityMaxDepth: z.number().int().min(1).max(8).default(2),
|
|
492
|
+
accessibilityMaxChildren: z.number().int().min(1).max(500).default(25)
|
|
493
|
+
}).default({});
|
|
494
|
+
var parallelismSchema = z.object({
|
|
495
|
+
floor: z.number().int().min(1).max(32).default(1),
|
|
496
|
+
backpressureTimeoutMs: z.number().int().min(100).max(12e4).default(5e3),
|
|
497
|
+
sampleIntervalMs: z.number().int().min(250).max(6e4).default(2e3),
|
|
498
|
+
recoveryStableWindows: z.number().int().min(1).max(20).default(3),
|
|
499
|
+
hostFreeMemMediumPct: z.number().int().min(1).max(99).default(25),
|
|
500
|
+
hostFreeMemHighPct: z.number().int().min(1).max(99).default(18),
|
|
501
|
+
hostFreeMemCriticalPct: z.number().int().min(1).max(99).default(10),
|
|
502
|
+
rssBudgetMb: z.number().int().min(64).max(65536).default(2048),
|
|
503
|
+
rssSoftPct: z.number().int().min(1).max(99).default(65),
|
|
504
|
+
rssHighPct: z.number().int().min(1).max(99).default(75),
|
|
505
|
+
rssCriticalPct: z.number().int().min(1).max(99).default(85),
|
|
506
|
+
queueAgeHighMs: z.number().int().min(100).max(12e4).default(2e3),
|
|
507
|
+
queueAgeCriticalMs: z.number().int().min(100).max(12e4).default(5e3),
|
|
508
|
+
modeCaps: z.object({
|
|
509
|
+
managedHeaded: z.number().int().min(1).max(64).default(6),
|
|
510
|
+
managedHeadless: z.number().int().min(1).max(64).default(8),
|
|
511
|
+
cdpConnectHeaded: z.number().int().min(1).max(64).default(6),
|
|
512
|
+
cdpConnectHeadless: z.number().int().min(1).max(64).default(8),
|
|
513
|
+
extensionOpsHeaded: z.number().int().min(1).max(64).default(6),
|
|
514
|
+
extensionLegacyCdpHeaded: z.number().int().min(1).max(64).default(1)
|
|
515
|
+
}).default({})
|
|
516
|
+
}).default({});
|
|
517
|
+
var blockerArtifactCapsSchema = z.object({
|
|
518
|
+
maxNetworkEvents: z.number().int().min(1).max(500).default(20),
|
|
519
|
+
maxConsoleEvents: z.number().int().min(1).max(500).default(20),
|
|
520
|
+
maxExceptionEvents: z.number().int().min(1).max(200).default(10),
|
|
521
|
+
maxHosts: z.number().int().min(1).max(200).default(10),
|
|
522
|
+
maxTextLength: z.number().int().min(32).max(4096).default(512)
|
|
523
|
+
}).default({});
|
|
524
|
+
var skillsNudgeSchema = z.object({
|
|
525
|
+
enabled: z.boolean().default(true),
|
|
526
|
+
keywords: z.array(z.string()).default([
|
|
527
|
+
"quick start",
|
|
528
|
+
"getting started",
|
|
529
|
+
"launch",
|
|
530
|
+
"connect",
|
|
531
|
+
"setup"
|
|
532
|
+
]),
|
|
533
|
+
maxAgeMs: z.number().int().min(1e3).max(6e5).default(6e4)
|
|
534
|
+
});
|
|
535
|
+
var skillsSchema = z.object({
|
|
536
|
+
nudge: skillsNudgeSchema.default({})
|
|
537
|
+
}).default({});
|
|
538
|
+
var continuityNudgeSchema = z.object({
|
|
539
|
+
enabled: z.boolean().default(true),
|
|
540
|
+
keywords: z.array(z.string()).default([
|
|
541
|
+
"plan",
|
|
542
|
+
"multi-step",
|
|
543
|
+
"multi step",
|
|
544
|
+
"long-running",
|
|
545
|
+
"long running",
|
|
546
|
+
"refactor",
|
|
547
|
+
"migration",
|
|
548
|
+
"rollout",
|
|
549
|
+
"release",
|
|
550
|
+
"upgrade",
|
|
551
|
+
"investigate",
|
|
552
|
+
"follow-up",
|
|
553
|
+
"continue"
|
|
554
|
+
]),
|
|
555
|
+
maxAgeMs: z.number().int().min(1e3).max(6e5).default(6e4)
|
|
556
|
+
});
|
|
557
|
+
var continuitySchema = z.object({
|
|
558
|
+
enabled: z.boolean().default(true),
|
|
559
|
+
filePath: z.string().min(1).default("opendevbrowser_continuity.md"),
|
|
560
|
+
nudge: continuityNudgeSchema.default({})
|
|
561
|
+
}).default({});
|
|
562
|
+
var tier1GeolocationSchema = z.object({
|
|
563
|
+
latitude: z.number().min(-90).max(90),
|
|
564
|
+
longitude: z.number().min(-180).max(180),
|
|
565
|
+
accuracy: z.number().min(1).max(1e4).default(50)
|
|
566
|
+
});
|
|
567
|
+
var fingerprintTier1Schema = z.object({
|
|
568
|
+
enabled: z.boolean().default(true),
|
|
569
|
+
warnOnly: z.boolean().default(true),
|
|
570
|
+
locale: z.string().min(2).optional(),
|
|
571
|
+
timezone: z.string().min(2).optional(),
|
|
572
|
+
languages: z.array(z.string().min(2)).default([]),
|
|
573
|
+
requireProxy: z.boolean().default(false),
|
|
574
|
+
geolocation: tier1GeolocationSchema.optional(),
|
|
575
|
+
geolocationRequired: z.boolean().default(false)
|
|
576
|
+
}).default({});
|
|
577
|
+
var fingerprintTier2Schema = z.object({
|
|
578
|
+
enabled: z.boolean().default(true),
|
|
579
|
+
mode: z.union([z.enum(["deterministic", "adaptive"]), z.literal("off")]).default("adaptive").transform((mode) => {
|
|
580
|
+
return mode === "off" ? "deterministic" : mode;
|
|
581
|
+
}),
|
|
582
|
+
continuousSignals: z.boolean().default(true),
|
|
583
|
+
rotationIntervalMs: z.number().int().min(0).max(864e5).default(9e5),
|
|
584
|
+
challengePatterns: z.array(z.string().min(1)).default([
|
|
585
|
+
"captcha",
|
|
586
|
+
"challenge",
|
|
587
|
+
"interstitial",
|
|
588
|
+
"cf_chl",
|
|
589
|
+
"bot"
|
|
590
|
+
]),
|
|
591
|
+
maxChallengeEvents: z.number().int().min(1).max(100).default(20),
|
|
592
|
+
scorePenalty: z.number().int().min(1).max(100).default(20),
|
|
593
|
+
scoreRecovery: z.number().int().min(0).max(100).default(5),
|
|
594
|
+
rotationHealthThreshold: z.number().int().min(0).max(100).default(55)
|
|
595
|
+
}).default({});
|
|
596
|
+
var fingerprintTier3CanarySchema = z.object({
|
|
597
|
+
windowSize: z.number().int().min(1).max(100).default(10),
|
|
598
|
+
minSamples: z.number().int().min(1).max(100).default(3),
|
|
599
|
+
promoteThreshold: z.number().int().min(0).max(100).default(80),
|
|
600
|
+
rollbackThreshold: z.number().int().min(0).max(100).default(35)
|
|
601
|
+
});
|
|
602
|
+
var fingerprintTier3Schema = z.object({
|
|
603
|
+
enabled: z.boolean().default(true),
|
|
604
|
+
continuousSignals: z.boolean().default(true),
|
|
605
|
+
fallbackTier: z.enum(["tier1", "tier2"]).default("tier2"),
|
|
606
|
+
canary: fingerprintTier3CanarySchema.default({})
|
|
607
|
+
}).default({});
|
|
608
|
+
var fingerprintSchema = z.object({
|
|
609
|
+
tier1: fingerprintTier1Schema.default({}),
|
|
610
|
+
tier2: fingerprintTier2Schema.default({}),
|
|
611
|
+
tier3: fingerprintTier3Schema.default({})
|
|
612
|
+
}).default({});
|
|
613
|
+
var figmaIntegrationSchema = z.object({
|
|
614
|
+
accessToken: z.string().min(1).optional()
|
|
615
|
+
}).default({});
|
|
616
|
+
var integrationsSchema = z.object({
|
|
617
|
+
figma: figmaIntegrationSchema.default({})
|
|
618
|
+
}).default({});
|
|
619
|
+
var canvasAdapterPluginDeclarationSchema = z.union([
|
|
620
|
+
z.string().min(1),
|
|
621
|
+
z.object({
|
|
622
|
+
ref: z.string().min(1),
|
|
623
|
+
enabled: z.boolean().optional(),
|
|
624
|
+
trustedWorkspaceRoots: z.array(z.string().min(1)).optional(),
|
|
625
|
+
capabilityOverrides: z.array(z.enum(CODE_SYNC_CAPABILITIES)).optional()
|
|
626
|
+
})
|
|
627
|
+
]);
|
|
628
|
+
var canvasSchema = z.object({
|
|
629
|
+
adapterPlugins: z.array(canvasAdapterPluginDeclarationSchema).default([])
|
|
630
|
+
}).default({});
|
|
631
|
+
var configSchema = z.object({
|
|
632
|
+
headless: z.boolean().default(false),
|
|
633
|
+
profile: z.string().min(1).default("default"),
|
|
634
|
+
snapshot: snapshotSchema.default({}),
|
|
635
|
+
security: securitySchema.default({}),
|
|
636
|
+
blockerDetectionThreshold: z.number().min(0).max(1).default(0.7),
|
|
637
|
+
blockerResolutionTimeoutMs: z.number().int().min(1e3).max(864e5).default(6e5),
|
|
638
|
+
blockerArtifactCaps: blockerArtifactCapsSchema,
|
|
639
|
+
providers: providersSchema.default({}),
|
|
640
|
+
integrations: integrationsSchema.default({}),
|
|
641
|
+
canvas: canvasSchema.default({}),
|
|
642
|
+
devtools: devtoolsSchema.default({}),
|
|
643
|
+
fingerprint: fingerprintSchema.default({}),
|
|
644
|
+
canary: canarySchema.default({}),
|
|
645
|
+
export: exportSchema.default({}),
|
|
646
|
+
desktop: desktopSchema,
|
|
647
|
+
parallelism: parallelismSchema.default({}),
|
|
648
|
+
skills: skillsSchema.default({}),
|
|
649
|
+
continuity: continuitySchema.default({}),
|
|
650
|
+
relayPort: z.number().int().min(0).max(65535).default(DEFAULT_RELAY_PORT),
|
|
651
|
+
relayToken: z.union([z.string(), z.literal(false)]).optional(),
|
|
652
|
+
nativeExtensionId: z.string().optional(),
|
|
653
|
+
daemonPort: z.number().int().min(0).max(65535).default(DEFAULT_DAEMON_PORT),
|
|
654
|
+
daemonToken: z.string().min(1).optional(),
|
|
655
|
+
chromePath: z.string().min(1).optional().refine(
|
|
656
|
+
(val) => val === void 0 || isExecutable(val),
|
|
657
|
+
{ message: "chromePath must point to an executable file" }
|
|
658
|
+
),
|
|
659
|
+
flags: z.array(z.string()).default([]),
|
|
660
|
+
checkForUpdates: z.boolean().default(false),
|
|
661
|
+
persistProfile: z.boolean().default(true),
|
|
662
|
+
skillPaths: z.array(z.string()).default([])
|
|
663
|
+
});
|
|
664
|
+
var CONFIG_FILE_NAME = "opendevbrowser.jsonc";
|
|
665
|
+
function getGlobalConfigPath() {
|
|
666
|
+
const configDir = process.env.OPENCODE_CONFIG_DIR || path.join(os.homedir(), ".config", "opencode");
|
|
667
|
+
return path.join(configDir, CONFIG_FILE_NAME);
|
|
668
|
+
}
|
|
669
|
+
function ensureConfigFile(filePath) {
|
|
670
|
+
const relayToken = generateSecureToken();
|
|
671
|
+
const daemonToken = generateSecureToken();
|
|
672
|
+
if (fs.existsSync(filePath)) {
|
|
673
|
+
return { relayToken, daemonToken };
|
|
674
|
+
}
|
|
675
|
+
try {
|
|
676
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true, mode: 448 });
|
|
677
|
+
fs.writeFileSync(filePath, buildDefaultConfigJsonc(relayToken, daemonToken), { encoding: "utf-8", mode: 384 });
|
|
678
|
+
} catch (error) {
|
|
679
|
+
console.warn(`[opendevbrowser] Warning: Could not create config file at ${filePath}:`, error);
|
|
680
|
+
}
|
|
681
|
+
return { relayToken, daemonToken };
|
|
682
|
+
}
|
|
683
|
+
function loadConfigFile(filePath) {
|
|
684
|
+
if (!fs.existsSync(filePath)) {
|
|
685
|
+
const tokens = ensureConfigFile(filePath);
|
|
686
|
+
const content2 = buildDefaultConfigJsonc(tokens.relayToken, tokens.daemonToken);
|
|
687
|
+
return {
|
|
688
|
+
raw: {},
|
|
689
|
+
content: content2,
|
|
690
|
+
generatedRelayToken: tokens.relayToken,
|
|
691
|
+
generatedDaemonToken: tokens.daemonToken,
|
|
692
|
+
created: true
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
696
|
+
const errors = [];
|
|
697
|
+
const parsed = parseJsonc(content, errors, { allowTrailingComma: true });
|
|
698
|
+
if (errors.length > 0) {
|
|
699
|
+
const firstError = errors[0];
|
|
700
|
+
if (!firstError) {
|
|
701
|
+
throw new Error(`Invalid JSONC in opendevbrowser config at ${filePath}: parse error`);
|
|
702
|
+
}
|
|
703
|
+
throw new Error(`Invalid JSONC in opendevbrowser config at ${filePath}: parse error at offset ${firstError.offset}`);
|
|
704
|
+
}
|
|
705
|
+
return {
|
|
706
|
+
raw: parsed ?? {},
|
|
707
|
+
content,
|
|
708
|
+
generatedRelayToken: null,
|
|
709
|
+
generatedDaemonToken: null,
|
|
710
|
+
created: false
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
function loadGlobalConfig() {
|
|
714
|
+
const configPath = getGlobalConfigPath();
|
|
715
|
+
const { raw, content, generatedRelayToken, generatedDaemonToken, created } = loadConfigFile(configPath);
|
|
716
|
+
const parsed = configSchema.safeParse(raw);
|
|
717
|
+
if (!parsed.success) {
|
|
718
|
+
const issues = parsed.error.issues.map((issue) => issue.message).join("; ");
|
|
719
|
+
throw new Error(`Invalid opendevbrowser config at ${configPath}: ${issues}`);
|
|
720
|
+
}
|
|
721
|
+
const data = parsed.data;
|
|
722
|
+
const relayToken = data.relayToken ?? generatedRelayToken ?? generateSecureToken();
|
|
723
|
+
const daemonToken = data.daemonToken ?? generatedDaemonToken ?? generateSecureToken();
|
|
724
|
+
if (!created) {
|
|
725
|
+
persistDaemonConfigDefaults({
|
|
726
|
+
configPath,
|
|
727
|
+
content,
|
|
728
|
+
raw,
|
|
729
|
+
daemonPort: data.daemonPort,
|
|
730
|
+
daemonToken
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
return { ...data, relayToken, daemonToken };
|
|
734
|
+
}
|
|
735
|
+
function resolveConfig(config) {
|
|
736
|
+
if (typeof config === "undefined") {
|
|
737
|
+
return loadGlobalConfig();
|
|
738
|
+
}
|
|
739
|
+
const parsed = configSchema.safeParse(config);
|
|
740
|
+
if (!parsed.success) {
|
|
741
|
+
const issues = parsed.error.issues.map((issue) => issue.message).join("; ");
|
|
742
|
+
throw new Error(`Invalid opendevbrowser config override: ${issues}`);
|
|
743
|
+
}
|
|
744
|
+
const data = parsed.data;
|
|
745
|
+
const relayToken = data.relayToken ?? generateSecureToken();
|
|
746
|
+
const daemonToken = data.daemonToken ?? generateSecureToken();
|
|
747
|
+
return { ...data, relayToken, daemonToken };
|
|
748
|
+
}
|
|
749
|
+
function requireChallengeOrchestrationConfig(config) {
|
|
750
|
+
const challengeOrchestration = config.providers?.challengeOrchestration;
|
|
751
|
+
if (!challengeOrchestration) {
|
|
752
|
+
throw new Error("Challenge orchestration config is unavailable.");
|
|
753
|
+
}
|
|
754
|
+
return challengeOrchestration;
|
|
755
|
+
}
|
|
756
|
+
function persistDaemonConfigDefaults(params) {
|
|
757
|
+
if (!isRecord2(params.raw)) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
const hasDaemonPort = Object.prototype.hasOwnProperty.call(params.raw, "daemonPort");
|
|
761
|
+
const hasDaemonToken = Object.prototype.hasOwnProperty.call(params.raw, "daemonToken");
|
|
762
|
+
if (hasDaemonPort && hasDaemonToken) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
const formattingOptions = { insertSpaces: true, tabSize: 2 };
|
|
766
|
+
let updatedContent = params.content;
|
|
767
|
+
if (!hasDaemonPort) {
|
|
768
|
+
const edits = modify(updatedContent, ["daemonPort"], params.daemonPort, { formattingOptions });
|
|
769
|
+
if (edits.length) {
|
|
770
|
+
updatedContent = applyEdits(updatedContent, edits);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (!hasDaemonToken) {
|
|
774
|
+
const edits = modify(updatedContent, ["daemonToken"], params.daemonToken, { formattingOptions });
|
|
775
|
+
if (edits.length) {
|
|
776
|
+
updatedContent = applyEdits(updatedContent, edits);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
if (updatedContent !== params.content) {
|
|
780
|
+
writeFileAtomic(params.configPath, updatedContent, { mode: 384 });
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
var isRecord2 = (value) => {
|
|
784
|
+
return typeof value === "object" && value !== null;
|
|
785
|
+
};
|
|
786
|
+
var ConfigStore = class {
|
|
787
|
+
current;
|
|
788
|
+
constructor(initial) {
|
|
789
|
+
this.current = initial;
|
|
790
|
+
}
|
|
791
|
+
get() {
|
|
792
|
+
return this.current;
|
|
793
|
+
}
|
|
794
|
+
set(next) {
|
|
795
|
+
this.current = next;
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
// src/cache/chrome-user-data.ts
|
|
800
|
+
import * as fs2 from "fs";
|
|
801
|
+
import * as path2 from "path";
|
|
802
|
+
import { homedir as homedir2 } from "os";
|
|
803
|
+
var PROFILE_PREFERENCES_FILES = ["Preferences", "Secure Preferences"];
|
|
804
|
+
var getChromeUserDataRootCandidates = () => {
|
|
805
|
+
if (process.platform === "darwin") {
|
|
806
|
+
return [
|
|
807
|
+
{
|
|
808
|
+
browserName: "chrome",
|
|
809
|
+
userDataDir: path2.join(homedir2(), "Library", "Application Support", "Google", "Chrome")
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
browserName: "chromium",
|
|
813
|
+
userDataDir: path2.join(homedir2(), "Library", "Application Support", "Chromium")
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
browserName: "brave",
|
|
817
|
+
userDataDir: path2.join(homedir2(), "Library", "Application Support", "BraveSoftware", "Brave-Browser")
|
|
818
|
+
}
|
|
819
|
+
];
|
|
820
|
+
}
|
|
821
|
+
if (process.platform === "linux") {
|
|
822
|
+
return [
|
|
823
|
+
{
|
|
824
|
+
browserName: "chrome",
|
|
825
|
+
userDataDir: path2.join(homedir2(), ".config", "google-chrome")
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
browserName: "chromium",
|
|
829
|
+
userDataDir: path2.join(homedir2(), ".config", "chromium")
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
browserName: "brave",
|
|
833
|
+
userDataDir: path2.join(homedir2(), ".config", "BraveSoftware", "Brave-Browser")
|
|
834
|
+
}
|
|
835
|
+
];
|
|
836
|
+
}
|
|
837
|
+
if (process.platform === "win32") {
|
|
838
|
+
const localAppData = process.env.LOCALAPPDATA || (process.env.USERPROFILE ? path2.join(process.env.USERPROFILE, "AppData", "Local") : "");
|
|
839
|
+
if (!localAppData) {
|
|
840
|
+
return [];
|
|
841
|
+
}
|
|
842
|
+
return [
|
|
843
|
+
{
|
|
844
|
+
browserName: "chrome",
|
|
845
|
+
userDataDir: path2.join(localAppData, "Google", "Chrome", "User Data")
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
browserName: "chromium",
|
|
849
|
+
userDataDir: path2.join(localAppData, "Chromium", "User Data")
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
browserName: "brave",
|
|
853
|
+
userDataDir: path2.join(localAppData, "BraveSoftware", "Brave-Browser", "User Data")
|
|
854
|
+
}
|
|
855
|
+
];
|
|
856
|
+
}
|
|
857
|
+
return [];
|
|
858
|
+
};
|
|
859
|
+
var getChromeUserDataRoots = () => {
|
|
860
|
+
return getChromeUserDataRootCandidates().map((candidate) => candidate.userDataDir);
|
|
861
|
+
};
|
|
862
|
+
var getProfileDirs = (root) => {
|
|
863
|
+
try {
|
|
864
|
+
const entries = fs2.readdirSync(root, { withFileTypes: true });
|
|
865
|
+
return entries.filter((entry) => entry.isDirectory() && (entry.name === "Default" || entry.name.startsWith("Profile "))).map((entry) => path2.join(root, entry.name)).filter((dir) => PROFILE_PREFERENCES_FILES.some((filename) => fs2.existsSync(path2.join(dir, filename))));
|
|
866
|
+
} catch {
|
|
867
|
+
return [];
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
var readProfilePreferences = (profileDir) => {
|
|
871
|
+
const records = [];
|
|
872
|
+
for (const filename of PROFILE_PREFERENCES_FILES) {
|
|
873
|
+
try {
|
|
874
|
+
const raw = fs2.readFileSync(path2.join(profileDir, filename), "utf8");
|
|
875
|
+
records.push(JSON.parse(raw));
|
|
876
|
+
} catch {
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
return records;
|
|
880
|
+
};
|
|
881
|
+
var readLocalState = (root) => {
|
|
882
|
+
try {
|
|
883
|
+
const raw = fs2.readFileSync(path2.join(root, "Local State"), "utf8");
|
|
884
|
+
return JSON.parse(raw);
|
|
885
|
+
} catch {
|
|
886
|
+
return null;
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
var pickPreferredProfileDirectory = (root, profileDirs) => {
|
|
890
|
+
if (profileDirs.length === 0) {
|
|
891
|
+
return null;
|
|
892
|
+
}
|
|
893
|
+
const available = new Set(profileDirs.map((profileDir) => path2.basename(profileDir)));
|
|
894
|
+
const localState = readLocalState(root);
|
|
895
|
+
const profileState = localState?.profile;
|
|
896
|
+
const lastUsed = typeof profileState === "object" && profileState !== null ? typeof profileState.last_used === "string" ? profileState.last_used : null : null;
|
|
897
|
+
if (lastUsed && available.has(lastUsed)) {
|
|
898
|
+
return lastUsed;
|
|
899
|
+
}
|
|
900
|
+
if (available.has("Default")) {
|
|
901
|
+
return "Default";
|
|
902
|
+
}
|
|
903
|
+
const firstProfile = profileDirs[0];
|
|
904
|
+
return path2.basename(firstProfile);
|
|
905
|
+
};
|
|
906
|
+
var discoverSystemChromeProfileSource = () => {
|
|
907
|
+
for (const candidate of getChromeUserDataRootCandidates()) {
|
|
908
|
+
const profileDirs = getProfileDirs(candidate.userDataDir);
|
|
909
|
+
const profileDirectory = pickPreferredProfileDirectory(candidate.userDataDir, profileDirs);
|
|
910
|
+
if (!profileDirectory) {
|
|
911
|
+
continue;
|
|
912
|
+
}
|
|
913
|
+
return {
|
|
914
|
+
browserName: candidate.browserName,
|
|
915
|
+
userDataDir: candidate.userDataDir,
|
|
916
|
+
profileDirectory,
|
|
917
|
+
profilePath: path2.join(candidate.userDataDir, profileDirectory)
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
return null;
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
export {
|
|
924
|
+
CODE_SYNC_CAPABILITIES,
|
|
925
|
+
isCodeSyncCapability,
|
|
926
|
+
inferBuiltInFrameworkAdapterIdFromPath,
|
|
927
|
+
normalizeCodeSyncRootLocator,
|
|
928
|
+
normalizeCodeSyncCapabilityGrant,
|
|
929
|
+
normalizeFrameworkAdapterIdentity,
|
|
930
|
+
normalizeCodeSyncBindingMetadata,
|
|
931
|
+
loadGlobalConfig,
|
|
932
|
+
resolveConfig,
|
|
933
|
+
requireChallengeOrchestrationConfig,
|
|
934
|
+
ConfigStore,
|
|
935
|
+
getChromeUserDataRoots,
|
|
936
|
+
getProfileDirs,
|
|
937
|
+
readProfilePreferences,
|
|
938
|
+
discoverSystemChromeProfileSource
|
|
939
|
+
};
|
|
940
|
+
//# sourceMappingURL=chunk-MX3NFLCE.js.map
|