@asterxsk/kiln 0.3.0 → 0.4.2
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 +155 -155
- package/agent/AGENTS.md +67 -67
- package/agent/README.md +5 -5
- package/agent/extensions/ask-user/index.ts +418 -418
- package/agent/extensions/ask-user/install.ps1 +27 -27
- package/agent/extensions/ask-user/install.sh +24 -24
- package/agent/extensions/ask-user/package-lock.json +769 -769
- package/agent/extensions/ask-user/package.json +19 -19
- package/agent/extensions/ask-user/prompt.ts +45 -45
- package/agent/extensions/ask-user/tsconfig.json +7 -7
- package/agent/extensions/background-terminals/docs/implementation-guide.md +942 -942
- package/agent/extensions/background-terminals/index.ts +627 -627
- package/agent/extensions/background-terminals/install.ps1 +27 -27
- package/agent/extensions/background-terminals/install.sh +24 -24
- package/agent/extensions/background-terminals/manager.test.ts +735 -735
- package/agent/extensions/background-terminals/output.test.ts +109 -109
- package/agent/extensions/background-terminals/package-lock.json +769 -769
- package/agent/extensions/background-terminals/package.json +17 -17
- package/agent/extensions/background-terminals/prompt.test.ts +125 -125
- package/agent/extensions/background-terminals/ps.test.ts +82 -82
- package/agent/extensions/background-terminals/result-delivery.test.ts +44 -44
- package/agent/extensions/background-terminals/src/domain.ts +87 -87
- package/agent/extensions/background-terminals/src/manager.ts +907 -907
- package/agent/extensions/background-terminals/src/output.ts +84 -84
- package/agent/extensions/background-terminals/src/prompt.ts +142 -142
- package/agent/extensions/background-terminals/src/result-delivery.ts +27 -27
- package/agent/extensions/background-terminals/src/runtime.ts +36 -36
- package/agent/extensions/background-terminals/src/ui/output-view.ts +79 -79
- package/agent/extensions/background-terminals/src/ui/ps.ts +621 -621
- package/agent/extensions/background-terminals/tsconfig.json +7 -7
- package/agent/extensions/destructive/README.md +31 -31
- package/agent/extensions/destructive/index.ts +88 -88
- package/agent/extensions/destructive/install.ps1 +27 -27
- package/agent/extensions/destructive/install.sh +24 -24
- package/agent/extensions/file-search/index.spec.ts +443 -443
- package/agent/extensions/file-search/index.ts +459 -459
- package/agent/extensions/file-search/install.ps1 +27 -27
- package/agent/extensions/file-search/install.sh +24 -24
- package/agent/extensions/file-search/package-lock.json +2253 -2253
- package/agent/extensions/file-search/package.json +23 -23
- package/agent/extensions/file-search/src/args.ts +122 -122
- package/agent/extensions/file-search/src/binaries.ts +422 -422
- package/agent/extensions/file-search/src/output.ts +126 -126
- package/agent/extensions/file-search/src/process.ts +146 -146
- package/agent/extensions/file-search/src/prompt.ts +52 -52
- package/agent/extensions/file-search/tsconfig.json +7 -7
- package/agent/extensions/goal/README.md +50 -50
- package/agent/extensions/goal/index.ts +155 -155
- package/agent/extensions/goal/install.ps1 +27 -27
- package/agent/extensions/goal/install.sh +24 -24
- package/agent/extensions/kiln-update/README.md +38 -25
- package/agent/extensions/kiln-update/index.ts +177 -99
- package/agent/extensions/modelconf/PLAN.md +915 -915
- package/agent/extensions/modelconf/README.md +66 -66
- package/agent/extensions/modelconf/index.ts +296 -296
- package/agent/extensions/modelconf/install.ps1 +27 -27
- package/agent/extensions/modelconf/install.sh +24 -24
- package/agent/extensions/modelconf/package-lock.json +1809 -1809
- package/agent/extensions/modelconf/package.json +13 -13
- package/agent/extensions/modelconf/src/fuzzy.ts +26 -26
- package/agent/extensions/modelconf/src/glob.ts +13 -13
- package/agent/extensions/modelconf/src/persistence.test.ts +46 -46
- package/agent/extensions/modelconf/src/persistence.ts +164 -164
- package/agent/extensions/modelconf/src/ui/ModelConfView.test.ts +75 -75
- package/agent/extensions/modelconf/src/ui/ModelConfView.ts +1101 -1101
- package/agent/extensions/modelconf/tsconfig.json +15 -15
- package/agent/extensions/pi-web-access/CHANGELOG.md +690 -690
- package/agent/extensions/pi-web-access/LICENSE +21 -21
- package/agent/extensions/pi-web-access/README.md +470 -470
- package/agent/extensions/pi-web-access/SECURITY.md +5 -5
- package/agent/extensions/pi-web-access/activity.ts +101 -101
- package/agent/extensions/pi-web-access/auth-fetch.ts +148 -148
- package/agent/extensions/pi-web-access/brightdata-unlocker.ts +272 -272
- package/agent/extensions/pi-web-access/chrome-cookies.ts +669 -669
- package/agent/extensions/pi-web-access/content-find.ts +139 -139
- package/agent/extensions/pi-web-access/credential-source.ts +191 -191
- package/agent/extensions/pi-web-access/data-uri-sanitize.ts +406 -406
- package/agent/extensions/pi-web-access/datalab-pdf-extract.ts +568 -568
- package/agent/extensions/pi-web-access/declared-web-links.ts +173 -173
- package/agent/extensions/pi-web-access/evidence/CONTRACT-EVIDENCE.md +496 -496
- package/agent/extensions/pi-web-access/evidence/contract-probe.mjs +140 -140
- package/agent/extensions/pi-web-access/exa.ts +526 -526
- package/agent/extensions/pi-web-access/extract.ts +1196 -1196
- package/agent/extensions/pi-web-access/feature-config.ts +29 -29
- package/agent/extensions/pi-web-access/fetch-params.ts +111 -111
- package/agent/extensions/pi-web-access/gemini-adc.ts +298 -298
- package/agent/extensions/pi-web-access/gemini-api.ts +353 -353
- package/agent/extensions/pi-web-access/gemini-pdf-extract.ts +108 -108
- package/agent/extensions/pi-web-access/gemini-search.ts +21 -21
- package/agent/extensions/pi-web-access/gemini-url-context.ts +128 -128
- package/agent/extensions/pi-web-access/gemini-web-config.ts +101 -101
- package/agent/extensions/pi-web-access/gemini-web.ts +487 -487
- package/agent/extensions/pi-web-access/github-api.ts +197 -197
- package/agent/extensions/pi-web-access/github-extract.ts +746 -746
- package/agent/extensions/pi-web-access/github-issue-pr.ts +700 -700
- package/agent/extensions/pi-web-access/index.ts +1737 -1737
- package/agent/extensions/pi-web-access/package-lock.json +5808 -5808
- package/agent/extensions/pi-web-access/package.json +64 -64
- package/agent/extensions/pi-web-access/page-query.ts +96 -96
- package/agent/extensions/pi-web-access/pdf-extract.ts +409 -409
- package/agent/extensions/pi-web-access/promise-try.d.ts +7 -7
- package/agent/extensions/pi-web-access/query-rewrite.ts +51 -51
- package/agent/extensions/pi-web-access/render-search-error.ts +170 -170
- package/agent/extensions/pi-web-access/rsc-extract.ts +338 -338
- package/agent/extensions/pi-web-access/search-types.ts +20 -20
- package/agent/extensions/pi-web-access/source-check.ts +282 -282
- package/agent/extensions/pi-web-access/ssrf-protection.ts +526 -526
- package/agent/extensions/pi-web-access/storage.ts +521 -521
- package/agent/extensions/pi-web-access/summary-model-scope.ts +125 -125
- package/agent/extensions/pi-web-access/test/auth-fetch.test.mjs +208 -208
- package/agent/extensions/pi-web-access/test/brightdata-unlocker.test.mjs +840 -840
- package/agent/extensions/pi-web-access/test/chrome-cookie-extraction.test.mjs +441 -441
- package/agent/extensions/pi-web-access/test/config-path.test.mjs +283 -283
- package/agent/extensions/pi-web-access/test/content-find.test.mjs +25 -25
- package/agent/extensions/pi-web-access/test/credential-source.test.mjs +118 -118
- package/agent/extensions/pi-web-access/test/data-uri-sanitize.test.mjs +210 -210
- package/agent/extensions/pi-web-access/test/datalab-pdf-extract.test.mjs +552 -552
- package/agent/extensions/pi-web-access/test/declared-web-links.test.mjs +212 -212
- package/agent/extensions/pi-web-access/test/fetch-answer-storage.test.mjs +40 -40
- package/agent/extensions/pi-web-access/test/fetch-cache-storage.test.mjs +334 -334
- package/agent/extensions/pi-web-access/test/fetch-content-domain-policy.test.mjs +95 -95
- package/agent/extensions/pi-web-access/test/fetch-modes.test.mjs +53 -53
- package/agent/extensions/pi-web-access/test/fetch-not-found-guidance.test.mjs +92 -92
- package/agent/extensions/pi-web-access/test/fetch-params.test.mjs +86 -86
- package/agent/extensions/pi-web-access/test/fetch-render-call.test.mjs +34 -34
- package/agent/extensions/pi-web-access/test/fetch-routing.test.mjs +173 -173
- package/agent/extensions/pi-web-access/test/gemini-adc-auth.test.mjs +257 -257
- package/agent/extensions/pi-web-access/test/gemini-api-transport.test.mjs +170 -170
- package/agent/extensions/pi-web-access/test/gemini-pdf-extract.test.mjs +133 -133
- package/agent/extensions/pi-web-access/test/gemini-web-cookie-opt-in.test.mjs +178 -178
- package/agent/extensions/pi-web-access/test/gemini-web-header-overflow.test.mjs +148 -148
- package/agent/extensions/pi-web-access/test/get-search-content.test.mjs +223 -223
- package/agent/extensions/pi-web-access/test/github-extract.test.mjs +378 -378
- package/agent/extensions/pi-web-access/test/github-issue-pr.test.mjs +565 -565
- package/agent/extensions/pi-web-access/test/inline-content-config.test.mjs +99 -99
- package/agent/extensions/pi-web-access/test/lazy-extract-load.test.mjs +118 -118
- package/agent/extensions/pi-web-access/test/local-video-oversize.test.mjs +52 -52
- package/agent/extensions/pi-web-access/test/package-typebox-dependency.test.mjs +50 -50
- package/agent/extensions/pi-web-access/test/page-query.test.mjs +51 -51
- package/agent/extensions/pi-web-access/test/pdf-config.test.mjs +140 -140
- package/agent/extensions/pi-web-access/test/pdf-extract.test.mjs +500 -500
- package/agent/extensions/pi-web-access/test/proxy-transport.test.mjs +286 -286
- package/agent/extensions/pi-web-access/test/query-rewrite.test.mjs +52 -52
- package/agent/extensions/pi-web-access/test/rsc-fallback.test.mjs +102 -102
- package/agent/extensions/pi-web-access/test/search-error-render.test.mjs +152 -152
- package/agent/extensions/pi-web-access/test/search-providers.test.mjs +274 -274
- package/agent/extensions/pi-web-access/test/source-check.test.mjs +179 -179
- package/agent/extensions/pi-web-access/test/ssrf-allow-ranges-config.test.mjs +205 -205
- package/agent/extensions/pi-web-access/test/ssrf-protection.test.mjs +456 -456
- package/agent/extensions/pi-web-access/test/summary-model-scope.test.mjs +106 -106
- package/agent/extensions/pi-web-access/test/tool-registration-config.test.mjs +182 -182
- package/agent/extensions/pi-web-access/test/web-search-answer-render.test.mjs +66 -66
- package/agent/extensions/pi-web-access/test/youtube-extract-errors.test.mjs +64 -64
- package/agent/extensions/pi-web-access/tsconfig.json +11 -11
- package/agent/extensions/pi-web-access/utils.ts +451 -451
- package/agent/extensions/pi-web-access/video-extract.ts +392 -392
- package/agent/extensions/pi-web-access/youtube-extract.ts +328 -328
- package/agent/extensions/shared/activity-status.ts +31 -31
- package/agent/extensions/shared/child-session.test.ts +270 -270
- package/agent/extensions/shared/child-session.ts +148 -148
- package/agent/extensions/shared/context-utilization.test.ts +48 -48
- package/agent/extensions/shared/context-utilization.ts +47 -47
- package/agent/extensions/shared/dashboard-state.ts +99 -99
- package/agent/extensions/shared/install.ps1 +27 -27
- package/agent/extensions/shared/install.sh +24 -24
- package/agent/extensions/shared/tool-call-timeout.test.ts +117 -117
- package/agent/extensions/shared/tool-call-timeout.ts +104 -104
- package/agent/extensions/skillsconf/README.md +74 -74
- package/agent/extensions/skillsconf/index.ts +92 -92
- package/agent/extensions/skillsconf/install.ps1 +27 -27
- package/agent/extensions/skillsconf/install.sh +24 -24
- package/agent/extensions/skillsconf/package-lock.json +1809 -1809
- package/agent/extensions/skillsconf/package.json +18 -18
- package/agent/extensions/skillsconf/src/delete-skill.test.ts +64 -64
- package/agent/extensions/skillsconf/src/delete-skill.ts +45 -45
- package/agent/extensions/skillsconf/src/filter.test.ts +80 -80
- package/agent/extensions/skillsconf/src/filter.ts +74 -74
- package/agent/extensions/skillsconf/src/fuzzy.ts +26 -26
- package/agent/extensions/skillsconf/src/persistence.test.ts +72 -72
- package/agent/extensions/skillsconf/src/persistence.ts +169 -169
- package/agent/extensions/skillsconf/src/ui/SkillConfView.test.ts +337 -337
- package/agent/extensions/skillsconf/src/ui/SkillConfView.ts +758 -758
- package/agent/extensions/skillsconf/src/ui/text-input.ts +91 -91
- package/agent/extensions/skillsconf/src/ui/tui-helpers.ts +144 -144
- package/agent/extensions/skillsconf/tsconfig.json +15 -15
- package/agent/extensions/statusline/index.ts +273 -282
- package/agent/extensions/statusline/install.ps1 +27 -27
- package/agent/extensions/statusline/install.sh +24 -24
- package/agent/extensions/subagents/by-the-way.test.ts +29 -29
- package/agent/extensions/subagents/claude.test.ts +119 -119
- package/agent/extensions/subagents/codex.test.ts +102 -102
- package/agent/extensions/subagents/context-usage.test.ts +107 -107
- package/agent/extensions/subagents/docs/design-plan.md +568 -568
- package/agent/extensions/subagents/docs/effect-v4-extension-guide.md +354 -354
- package/agent/extensions/subagents/docs/effect-v4-notes.md +571 -571
- package/agent/extensions/subagents/index.ts +779 -779
- package/agent/extensions/subagents/install.ps1 +27 -27
- package/agent/extensions/subagents/install.sh +24 -24
- package/agent/extensions/subagents/manager.test.ts +276 -276
- package/agent/extensions/subagents/package-lock.json +2244 -2244
- package/agent/extensions/subagents/package.json +19 -19
- package/agent/extensions/subagents/result-delivery.test.ts +27 -27
- package/agent/extensions/subagents/src/backend.ts +73 -73
- package/agent/extensions/subagents/src/backends/claude.ts +701 -701
- package/agent/extensions/subagents/src/backends/codex.ts +1060 -1060
- package/agent/extensions/subagents/src/backends/pi.ts +575 -575
- package/agent/extensions/subagents/src/backends/stub.ts +300 -300
- package/agent/extensions/subagents/src/by-the-way.ts +21 -21
- package/agent/extensions/subagents/src/domain.ts +253 -253
- package/agent/extensions/subagents/src/format.ts +74 -74
- package/agent/extensions/subagents/src/manager.ts +736 -736
- package/agent/extensions/subagents/src/prompt.ts +92 -92
- package/agent/extensions/subagents/src/result-delivery.ts +20 -20
- package/agent/extensions/subagents/src/runtime.ts +53 -53
- package/agent/extensions/subagents/src/ui/takeover.ts +583 -583
- package/agent/extensions/subagents/src/ui/transcript.ts +201 -201
- package/agent/extensions/subagents/takeover.test.ts +29 -29
- package/agent/extensions/subagents/tsconfig.json +7 -7
- package/agent/extensions/todo/AGENTS.md +38 -38
- package/agent/extensions/todo/LICENSE +21 -21
- package/agent/extensions/todo/config.ts +55 -55
- package/agent/extensions/todo/index.ts +151 -151
- package/agent/extensions/todo/install.ps1 +27 -27
- package/agent/extensions/todo/install.sh +24 -24
- package/agent/extensions/todo/locales/de.json +17 -17
- package/agent/extensions/todo/locales/en.json +15 -15
- package/agent/extensions/todo/locales/es.json +17 -17
- package/agent/extensions/todo/locales/fr.json +17 -17
- package/agent/extensions/todo/locales/pt-BR.json +17 -17
- package/agent/extensions/todo/locales/pt.json +17 -17
- package/agent/extensions/todo/locales/ru.json +17 -17
- package/agent/extensions/todo/locales/uk.json +17 -17
- package/agent/extensions/todo/locales/zh.json +17 -17
- package/agent/extensions/todo/package-lock.json +3358 -3358
- package/agent/extensions/todo/package.json +67 -67
- package/agent/extensions/todo/state/i18n-bridge.ts +64 -64
- package/agent/extensions/todo/state/invariants.ts +20 -20
- package/agent/extensions/todo/state/replay.ts +38 -38
- package/agent/extensions/todo/state/selectors.ts +107 -107
- package/agent/extensions/todo/state/state-reducer.ts +326 -326
- package/agent/extensions/todo/state/state.ts +18 -18
- package/agent/extensions/todo/state/store.ts +82 -82
- package/agent/extensions/todo/state/task-graph.ts +57 -57
- package/agent/extensions/todo/todo-overlay.ts +200 -200
- package/agent/extensions/todo/todo.ts +155 -155
- package/agent/extensions/todo/tool/response-envelope.ts +109 -109
- package/agent/extensions/todo/tool/types.ts +206 -206
- package/agent/extensions/todo/view/format.ts +177 -177
- package/agent/extensions/trim-context/README.md +54 -54
- package/agent/extensions/trim-context/index.ts +487 -487
- package/agent/extensions/trim-context/install.ps1 +27 -27
- package/agent/extensions/trim-context/install.sh +24 -24
- package/agent/keybindings.json +7 -7
- package/agent/version.txt +1 -1
- package/bin/kiln.js +30 -21
- package/package.json +1 -1
- package/agent/extensions/taste/index.ts +0 -443
- package/agent/extensions/taste/install.ps1 +0 -27
- package/agent/extensions/taste/install.sh +0 -24
- package/agent.bak.20260905-190020/AGENTS.md +0 -67
- package/agent.bak.20260905-190020/README.md +0 -5
- package/agent.bak.20260905-190020/extensions/ask-user/index.ts +0 -418
- package/agent.bak.20260905-190020/extensions/ask-user/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/ask-user/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/ask-user/package-lock.json +0 -769
- package/agent.bak.20260905-190020/extensions/ask-user/package.json +0 -19
- package/agent.bak.20260905-190020/extensions/ask-user/prompt.ts +0 -45
- package/agent.bak.20260905-190020/extensions/ask-user/tsconfig.json +0 -7
- package/agent.bak.20260905-190020/extensions/background-terminals/docs/implementation-guide.md +0 -942
- package/agent.bak.20260905-190020/extensions/background-terminals/index.ts +0 -629
- package/agent.bak.20260905-190020/extensions/background-terminals/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/background-terminals/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/background-terminals/package-lock.json +0 -769
- package/agent.bak.20260905-190020/extensions/background-terminals/package.json +0 -17
- package/agent.bak.20260905-190020/extensions/background-terminals/src/domain.ts +0 -87
- package/agent.bak.20260905-190020/extensions/background-terminals/src/manager.ts +0 -907
- package/agent.bak.20260905-190020/extensions/background-terminals/src/output.ts +0 -84
- package/agent.bak.20260905-190020/extensions/background-terminals/src/prompt.ts +0 -142
- package/agent.bak.20260905-190020/extensions/background-terminals/src/result-delivery.ts +0 -27
- package/agent.bak.20260905-190020/extensions/background-terminals/src/runtime.ts +0 -36
- package/agent.bak.20260905-190020/extensions/background-terminals/src/ui/output-view.ts +0 -79
- package/agent.bak.20260905-190020/extensions/background-terminals/src/ui/ps.ts +0 -621
- package/agent.bak.20260905-190020/extensions/background-terminals/src/widget-order.ts +0 -121
- package/agent.bak.20260905-190020/extensions/background-terminals/test/manager.test.ts +0 -735
- package/agent.bak.20260905-190020/extensions/background-terminals/test/output.test.ts +0 -109
- package/agent.bak.20260905-190020/extensions/background-terminals/test/prompt.test.ts +0 -125
- package/agent.bak.20260905-190020/extensions/background-terminals/test/ps.test.ts +0 -82
- package/agent.bak.20260905-190020/extensions/background-terminals/test/result-delivery.test.ts +0 -44
- package/agent.bak.20260905-190020/extensions/background-terminals/tsconfig.json +0 -7
- package/agent.bak.20260905-190020/extensions/destructive/README.md +0 -34
- package/agent.bak.20260905-190020/extensions/destructive/index.ts +0 -124
- package/agent.bak.20260905-190020/extensions/destructive/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/destructive/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/file-search/index.ts +0 -459
- package/agent.bak.20260905-190020/extensions/file-search/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/file-search/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/file-search/package-lock.json +0 -2253
- package/agent.bak.20260905-190020/extensions/file-search/package.json +0 -23
- package/agent.bak.20260905-190020/extensions/file-search/src/args.ts +0 -122
- package/agent.bak.20260905-190020/extensions/file-search/src/binaries.ts +0 -422
- package/agent.bak.20260905-190020/extensions/file-search/src/output.ts +0 -126
- package/agent.bak.20260905-190020/extensions/file-search/src/process.ts +0 -146
- package/agent.bak.20260905-190020/extensions/file-search/src/prompt.ts +0 -52
- package/agent.bak.20260905-190020/extensions/file-search/test/index.spec.ts +0 -443
- package/agent.bak.20260905-190020/extensions/file-search/tsconfig.json +0 -7
- package/agent.bak.20260905-190020/extensions/goal/README.md +0 -50
- package/agent.bak.20260905-190020/extensions/goal/index.ts +0 -155
- package/agent.bak.20260905-190020/extensions/goal/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/goal/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/kiln-update/README.md +0 -25
- package/agent.bak.20260905-190020/extensions/kiln-update/index.ts +0 -99
- package/agent.bak.20260905-190020/extensions/kiln-update/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/kiln-update/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/modelconf/PLAN.md +0 -915
- package/agent.bak.20260905-190020/extensions/modelconf/README.md +0 -66
- package/agent.bak.20260905-190020/extensions/modelconf/index.ts +0 -296
- package/agent.bak.20260905-190020/extensions/modelconf/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/modelconf/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/modelconf/package-lock.json +0 -1809
- package/agent.bak.20260905-190020/extensions/modelconf/package.json +0 -13
- package/agent.bak.20260905-190020/extensions/modelconf/src/fuzzy.ts +0 -26
- package/agent.bak.20260905-190020/extensions/modelconf/src/glob.ts +0 -13
- package/agent.bak.20260905-190020/extensions/modelconf/src/persistence.test.ts +0 -46
- package/agent.bak.20260905-190020/extensions/modelconf/src/persistence.ts +0 -164
- package/agent.bak.20260905-190020/extensions/modelconf/src/ui/ModelConfView.test.ts +0 -75
- package/agent.bak.20260905-190020/extensions/modelconf/src/ui/ModelConfView.ts +0 -1101
- package/agent.bak.20260905-190020/extensions/modelconf/tsconfig.json +0 -15
- package/agent.bak.20260905-190020/extensions/pi-web-access/CHANGELOG.md +0 -690
- package/agent.bak.20260905-190020/extensions/pi-web-access/LICENSE +0 -21
- package/agent.bak.20260905-190020/extensions/pi-web-access/README.md +0 -470
- package/agent.bak.20260905-190020/extensions/pi-web-access/SECURITY.md +0 -5
- package/agent.bak.20260905-190020/extensions/pi-web-access/activity.ts +0 -101
- package/agent.bak.20260905-190020/extensions/pi-web-access/auth-fetch.ts +0 -148
- package/agent.bak.20260905-190020/extensions/pi-web-access/banner.png +0 -0
- package/agent.bak.20260905-190020/extensions/pi-web-access/brightdata-unlocker.ts +0 -272
- package/agent.bak.20260905-190020/extensions/pi-web-access/chrome-cookies.ts +0 -669
- package/agent.bak.20260905-190020/extensions/pi-web-access/content-find.ts +0 -139
- package/agent.bak.20260905-190020/extensions/pi-web-access/credential-source.ts +0 -191
- package/agent.bak.20260905-190020/extensions/pi-web-access/data-uri-sanitize.ts +0 -406
- package/agent.bak.20260905-190020/extensions/pi-web-access/datalab-pdf-extract.ts +0 -568
- package/agent.bak.20260905-190020/extensions/pi-web-access/declared-web-links.ts +0 -173
- package/agent.bak.20260905-190020/extensions/pi-web-access/evidence/CONTRACT-EVIDENCE.md +0 -496
- package/agent.bak.20260905-190020/extensions/pi-web-access/evidence/contract-probe.mjs +0 -140
- package/agent.bak.20260905-190020/extensions/pi-web-access/exa.ts +0 -526
- package/agent.bak.20260905-190020/extensions/pi-web-access/extract.ts +0 -1196
- package/agent.bak.20260905-190020/extensions/pi-web-access/feature-config.ts +0 -29
- package/agent.bak.20260905-190020/extensions/pi-web-access/fetch-params.ts +0 -111
- package/agent.bak.20260905-190020/extensions/pi-web-access/gemini-adc.ts +0 -298
- package/agent.bak.20260905-190020/extensions/pi-web-access/gemini-api.ts +0 -353
- package/agent.bak.20260905-190020/extensions/pi-web-access/gemini-pdf-extract.ts +0 -108
- package/agent.bak.20260905-190020/extensions/pi-web-access/gemini-search.ts +0 -21
- package/agent.bak.20260905-190020/extensions/pi-web-access/gemini-url-context.ts +0 -128
- package/agent.bak.20260905-190020/extensions/pi-web-access/gemini-web-config.ts +0 -101
- package/agent.bak.20260905-190020/extensions/pi-web-access/gemini-web.ts +0 -487
- package/agent.bak.20260905-190020/extensions/pi-web-access/github-api.ts +0 -197
- package/agent.bak.20260905-190020/extensions/pi-web-access/github-extract.ts +0 -746
- package/agent.bak.20260905-190020/extensions/pi-web-access/github-issue-pr.ts +0 -700
- package/agent.bak.20260905-190020/extensions/pi-web-access/index.ts +0 -1737
- package/agent.bak.20260905-190020/extensions/pi-web-access/package-lock.json +0 -5808
- package/agent.bak.20260905-190020/extensions/pi-web-access/package.json +0 -64
- package/agent.bak.20260905-190020/extensions/pi-web-access/page-query.ts +0 -96
- package/agent.bak.20260905-190020/extensions/pi-web-access/pdf-extract.ts +0 -409
- package/agent.bak.20260905-190020/extensions/pi-web-access/pi-web-fetch-demo.mp4 +0 -0
- package/agent.bak.20260905-190020/extensions/pi-web-access/promise-try.d.ts +0 -7
- package/agent.bak.20260905-190020/extensions/pi-web-access/query-rewrite.ts +0 -51
- package/agent.bak.20260905-190020/extensions/pi-web-access/render-search-error.ts +0 -170
- package/agent.bak.20260905-190020/extensions/pi-web-access/rsc-extract.ts +0 -338
- package/agent.bak.20260905-190020/extensions/pi-web-access/search-types.ts +0 -20
- package/agent.bak.20260905-190020/extensions/pi-web-access/source-check.ts +0 -282
- package/agent.bak.20260905-190020/extensions/pi-web-access/ssrf-protection.ts +0 -526
- package/agent.bak.20260905-190020/extensions/pi-web-access/storage.ts +0 -521
- package/agent.bak.20260905-190020/extensions/pi-web-access/summary-model-scope.ts +0 -125
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/auth-fetch.test.mjs +0 -208
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/brightdata-unlocker.test.mjs +0 -840
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/chrome-cookie-extraction.test.mjs +0 -441
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/config-path.test.mjs +0 -283
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/content-find.test.mjs +0 -25
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/credential-source.test.mjs +0 -118
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/data-uri-sanitize.test.mjs +0 -210
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/datalab-pdf-extract.test.mjs +0 -552
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/declared-web-links.test.mjs +0 -212
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/fetch-answer-storage.test.mjs +0 -40
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/fetch-cache-storage.test.mjs +0 -334
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/fetch-content-domain-policy.test.mjs +0 -95
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/fetch-modes.test.mjs +0 -53
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/fetch-not-found-guidance.test.mjs +0 -92
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/fetch-params.test.mjs +0 -86
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/fetch-render-call.test.mjs +0 -34
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/fetch-routing.test.mjs +0 -173
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/gemini-adc-auth.test.mjs +0 -257
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/gemini-api-transport.test.mjs +0 -170
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/gemini-pdf-extract.test.mjs +0 -133
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/gemini-web-cookie-opt-in.test.mjs +0 -178
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/gemini-web-header-overflow.test.mjs +0 -148
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/get-search-content.test.mjs +0 -223
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/github-extract.test.mjs +0 -378
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/github-issue-pr.test.mjs +0 -565
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/inline-content-config.test.mjs +0 -99
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/lazy-extract-load.test.mjs +0 -118
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/local-video-oversize.test.mjs +0 -52
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/package-typebox-dependency.test.mjs +0 -50
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/page-query.test.mjs +0 -51
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/pdf-config.test.mjs +0 -140
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/pdf-extract.test.mjs +0 -500
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/proxy-transport.test.mjs +0 -286
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/query-rewrite.test.mjs +0 -52
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/rsc-fallback.test.mjs +0 -102
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/search-error-render.test.mjs +0 -152
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/search-providers.test.mjs +0 -274
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/source-check.test.mjs +0 -179
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/ssrf-allow-ranges-config.test.mjs +0 -205
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/ssrf-protection.test.mjs +0 -456
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/summary-model-scope.test.mjs +0 -106
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/tool-registration-config.test.mjs +0 -182
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/web-search-answer-render.test.mjs +0 -66
- package/agent.bak.20260905-190020/extensions/pi-web-access/test/youtube-extract-errors.test.mjs +0 -64
- package/agent.bak.20260905-190020/extensions/pi-web-access/tsconfig.json +0 -11
- package/agent.bak.20260905-190020/extensions/pi-web-access/utils.ts +0 -451
- package/agent.bak.20260905-190020/extensions/pi-web-access/video-extract.ts +0 -392
- package/agent.bak.20260905-190020/extensions/pi-web-access/youtube-extract.ts +0 -328
- package/agent.bak.20260905-190020/extensions/shared/activity-status.ts +0 -31
- package/agent.bak.20260905-190020/extensions/shared/child-session.ts +0 -148
- package/agent.bak.20260905-190020/extensions/shared/context-utilization.ts +0 -47
- package/agent.bak.20260905-190020/extensions/shared/dashboard-state.ts +0 -99
- package/agent.bak.20260905-190020/extensions/shared/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/shared/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/shared/test/child-session.test.ts +0 -270
- package/agent.bak.20260905-190020/extensions/shared/test/context-utilization.test.ts +0 -48
- package/agent.bak.20260905-190020/extensions/shared/test/tool-call-timeout.test.ts +0 -117
- package/agent.bak.20260905-190020/extensions/shared/test/widget-order.test.ts +0 -167
- package/agent.bak.20260905-190020/extensions/shared/tool-call-timeout.ts +0 -104
- package/agent.bak.20260905-190020/extensions/skillsconf/README.md +0 -74
- package/agent.bak.20260905-190020/extensions/skillsconf/index.ts +0 -92
- package/agent.bak.20260905-190020/extensions/skillsconf/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/skillsconf/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/skillsconf/package-lock.json +0 -1809
- package/agent.bak.20260905-190020/extensions/skillsconf/package.json +0 -18
- package/agent.bak.20260905-190020/extensions/skillsconf/src/delete-skill.test.ts +0 -64
- package/agent.bak.20260905-190020/extensions/skillsconf/src/delete-skill.ts +0 -45
- package/agent.bak.20260905-190020/extensions/skillsconf/src/filter.test.ts +0 -80
- package/agent.bak.20260905-190020/extensions/skillsconf/src/filter.ts +0 -74
- package/agent.bak.20260905-190020/extensions/skillsconf/src/fuzzy.ts +0 -26
- package/agent.bak.20260905-190020/extensions/skillsconf/src/persistence.test.ts +0 -72
- package/agent.bak.20260905-190020/extensions/skillsconf/src/persistence.ts +0 -169
- package/agent.bak.20260905-190020/extensions/skillsconf/src/ui/SkillConfView.test.ts +0 -337
- package/agent.bak.20260905-190020/extensions/skillsconf/src/ui/SkillConfView.ts +0 -758
- package/agent.bak.20260905-190020/extensions/skillsconf/src/ui/text-input.ts +0 -91
- package/agent.bak.20260905-190020/extensions/skillsconf/src/ui/tui-helpers.ts +0 -144
- package/agent.bak.20260905-190020/extensions/skillsconf/tsconfig.json +0 -15
- package/agent.bak.20260905-190020/extensions/statusline/index.ts +0 -282
- package/agent.bak.20260905-190020/extensions/statusline/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/statusline/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/subagents/docs/design-plan.md +0 -568
- package/agent.bak.20260905-190020/extensions/subagents/docs/effect-v4-extension-guide.md +0 -354
- package/agent.bak.20260905-190020/extensions/subagents/docs/effect-v4-notes.md +0 -571
- package/agent.bak.20260905-190020/extensions/subagents/index.ts +0 -826
- package/agent.bak.20260905-190020/extensions/subagents/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/subagents/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/subagents/package-lock.json +0 -2244
- package/agent.bak.20260905-190020/extensions/subagents/package.json +0 -19
- package/agent.bak.20260905-190020/extensions/subagents/src/backend.ts +0 -73
- package/agent.bak.20260905-190020/extensions/subagents/src/backends/claude.ts +0 -701
- package/agent.bak.20260905-190020/extensions/subagents/src/backends/codex.ts +0 -1060
- package/agent.bak.20260905-190020/extensions/subagents/src/backends/pi.ts +0 -575
- package/agent.bak.20260905-190020/extensions/subagents/src/backends/stub.ts +0 -300
- package/agent.bak.20260905-190020/extensions/subagents/src/by-the-way.ts +0 -21
- package/agent.bak.20260905-190020/extensions/subagents/src/domain.ts +0 -253
- package/agent.bak.20260905-190020/extensions/subagents/src/format.ts +0 -74
- package/agent.bak.20260905-190020/extensions/subagents/src/manager.ts +0 -736
- package/agent.bak.20260905-190020/extensions/subagents/src/prompt.ts +0 -92
- package/agent.bak.20260905-190020/extensions/subagents/src/result-delivery.ts +0 -20
- package/agent.bak.20260905-190020/extensions/subagents/src/runtime.ts +0 -53
- package/agent.bak.20260905-190020/extensions/subagents/src/ui/takeover.ts +0 -583
- package/agent.bak.20260905-190020/extensions/subagents/src/ui/transcript.ts +0 -201
- package/agent.bak.20260905-190020/extensions/subagents/src/widget-order.ts +0 -121
- package/agent.bak.20260905-190020/extensions/subagents/test/by-the-way.test.ts +0 -29
- package/agent.bak.20260905-190020/extensions/subagents/test/claude.test.ts +0 -119
- package/agent.bak.20260905-190020/extensions/subagents/test/codex.test.ts +0 -102
- package/agent.bak.20260905-190020/extensions/subagents/test/context-usage.test.ts +0 -107
- package/agent.bak.20260905-190020/extensions/subagents/test/manager.test.ts +0 -276
- package/agent.bak.20260905-190020/extensions/subagents/test/result-delivery.test.ts +0 -27
- package/agent.bak.20260905-190020/extensions/subagents/test/takeover.test.ts +0 -29
- package/agent.bak.20260905-190020/extensions/subagents/tsconfig.json +0 -7
- package/agent.bak.20260905-190020/extensions/taste/index.ts +0 -443
- package/agent.bak.20260905-190020/extensions/taste/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/taste/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/todo/AGENTS.md +0 -38
- package/agent.bak.20260905-190020/extensions/todo/LICENSE +0 -21
- package/agent.bak.20260905-190020/extensions/todo/config.ts +0 -55
- package/agent.bak.20260905-190020/extensions/todo/index.ts +0 -151
- package/agent.bak.20260905-190020/extensions/todo/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/todo/install.sh +0 -21
- package/agent.bak.20260905-190020/extensions/todo/locales/de.json +0 -17
- package/agent.bak.20260905-190020/extensions/todo/locales/en.json +0 -15
- package/agent.bak.20260905-190020/extensions/todo/locales/es.json +0 -17
- package/agent.bak.20260905-190020/extensions/todo/locales/fr.json +0 -17
- package/agent.bak.20260905-190020/extensions/todo/locales/pt-BR.json +0 -17
- package/agent.bak.20260905-190020/extensions/todo/locales/pt.json +0 -17
- package/agent.bak.20260905-190020/extensions/todo/locales/ru.json +0 -17
- package/agent.bak.20260905-190020/extensions/todo/locales/uk.json +0 -17
- package/agent.bak.20260905-190020/extensions/todo/locales/zh.json +0 -17
- package/agent.bak.20260905-190020/extensions/todo/package-lock.json +0 -3358
- package/agent.bak.20260905-190020/extensions/todo/package.json +0 -67
- package/agent.bak.20260905-190020/extensions/todo/state/i18n-bridge.ts +0 -64
- package/agent.bak.20260905-190020/extensions/todo/state/invariants.ts +0 -20
- package/agent.bak.20260905-190020/extensions/todo/state/replay.ts +0 -38
- package/agent.bak.20260905-190020/extensions/todo/state/selectors.ts +0 -107
- package/agent.bak.20260905-190020/extensions/todo/state/state-reducer.ts +0 -326
- package/agent.bak.20260905-190020/extensions/todo/state/state.ts +0 -18
- package/agent.bak.20260905-190020/extensions/todo/state/store.ts +0 -82
- package/agent.bak.20260905-190020/extensions/todo/state/task-graph.ts +0 -57
- package/agent.bak.20260905-190020/extensions/todo/todo-overlay.ts +0 -204
- package/agent.bak.20260905-190020/extensions/todo/todo.ts +0 -155
- package/agent.bak.20260905-190020/extensions/todo/tool/response-envelope.ts +0 -109
- package/agent.bak.20260905-190020/extensions/todo/tool/types.ts +0 -206
- package/agent.bak.20260905-190020/extensions/todo/view/format.ts +0 -177
- package/agent.bak.20260905-190020/extensions/todo/widget-order.ts +0 -121
- package/agent.bak.20260905-190020/extensions/trim-context/README.md +0 -54
- package/agent.bak.20260905-190020/extensions/trim-context/index.ts +0 -487
- package/agent.bak.20260905-190020/extensions/trim-context/install.ps1 +0 -23
- package/agent.bak.20260905-190020/extensions/trim-context/install.sh +0 -21
- package/agent.bak.20260905-190020/keybindings.json +0 -7
package/agent.bak.20260905-190020/extensions/pi-web-access/test/brightdata-unlocker.test.mjs
DELETED
|
@@ -1,840 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
|
-
import { mkdtempSync } from "node:fs";
|
|
4
|
-
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { test } from "node:test";
|
|
8
|
-
|
|
9
|
-
const brightdataModuleUrl = new URL(
|
|
10
|
-
"../brightdata-unlocker.ts",
|
|
11
|
-
import.meta.url,
|
|
12
|
-
).href;
|
|
13
|
-
const extractModuleUrl = new URL("../extract.ts", import.meta.url).href;
|
|
14
|
-
|
|
15
|
-
// Scrubbing the env vars is not enough on its own: a `brightdataApiKey` written
|
|
16
|
-
// as an explicit `$VAR`/`!command` source in the real `~/.pi/web-search.json`
|
|
17
|
-
// overrides the environment by design, so a maintainer with one configured
|
|
18
|
-
// would resolve their own credential (and run their own resolver command)
|
|
19
|
-
// inside these tests. Every child therefore starts from an empty home unless a
|
|
20
|
-
// test hands it a purpose-built one.
|
|
21
|
-
const EMPTY_HOME = mkdtempSync(
|
|
22
|
-
join(tmpdir(), "pi-web-access-brightdata-empty-home-"),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
function runChild(script, env = {}) {
|
|
26
|
-
const childEnv = {
|
|
27
|
-
...process.env,
|
|
28
|
-
HOME: EMPTY_HOME,
|
|
29
|
-
USERPROFILE: EMPTY_HOME,
|
|
30
|
-
};
|
|
31
|
-
for (const key of [
|
|
32
|
-
"PI_CODING_AGENT_DIR",
|
|
33
|
-
"XDG_CONFIG_HOME",
|
|
34
|
-
"BRIGHTDATA_API_KEY",
|
|
35
|
-
"KAGI_API_KEY",
|
|
36
|
-
"OLLAMA_API_KEY",
|
|
37
|
-
"BRIGHTDATA_UNLOCKER_ZONE",
|
|
38
|
-
"BRIGHTDATA_SERP_ZONE",
|
|
39
|
-
"FIRECRAWL_BASE_URL",
|
|
40
|
-
"FIRECRAWL_API_KEY",
|
|
41
|
-
"PARALLEL_API_KEY",
|
|
42
|
-
"TINYFISH_API_KEY",
|
|
43
|
-
"GEMINI_API_KEY",
|
|
44
|
-
])
|
|
45
|
-
delete childEnv[key];
|
|
46
|
-
Object.assign(childEnv, env);
|
|
47
|
-
return spawnSync(process.execPath, ["--input-type=module"], {
|
|
48
|
-
input: script,
|
|
49
|
-
encoding: "utf8",
|
|
50
|
-
env: childEnv,
|
|
51
|
-
maxBuffer: 2 * 1024 * 1024,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const PUBLIC_LOOKUP = `async () => [{ address: "93.184.216.34", family: 4 }]`;
|
|
56
|
-
|
|
57
|
-
async function configHome(config) {
|
|
58
|
-
const home = await mkdtemp(join(tmpdir(), "pi-web-access-brightdata-"));
|
|
59
|
-
await writeFile(
|
|
60
|
-
join(home, "web-search.json"),
|
|
61
|
-
JSON.stringify(config) + "\n",
|
|
62
|
-
"utf8",
|
|
63
|
-
);
|
|
64
|
-
return home;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
test("Bright Data Web Unlocker maps markdown and sends the credential and Unlocker zone", async () => {
|
|
68
|
-
const child = runChild(
|
|
69
|
-
`
|
|
70
|
-
let captured = null;
|
|
71
|
-
globalThis.fetch = async (url, init) => {
|
|
72
|
-
captured = { url: String(url), method: init.method, redirect: init.redirect, headers: Object.fromEntries(new Headers(init.headers)), body: JSON.parse(init.body) };
|
|
73
|
-
return new Response("# Unlocked Title\\n\\nUnlocked body.\\n", { status: 200 });
|
|
74
|
-
};
|
|
75
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
76
|
-
const result = await extractWithBrightDataUnlocker("https://example.com/article", undefined, {
|
|
77
|
-
lookup: ${PUBLIC_LOOKUP},
|
|
78
|
-
});
|
|
79
|
-
console.log(JSON.stringify({ captured, result }));
|
|
80
|
-
`,
|
|
81
|
-
{
|
|
82
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
83
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
84
|
-
},
|
|
85
|
-
);
|
|
86
|
-
assert.equal(child.status, 0, child.stderr);
|
|
87
|
-
const output = JSON.parse(child.stdout.trim());
|
|
88
|
-
assert.equal(output.captured.url, "https://api.brightdata.com/request");
|
|
89
|
-
assert.equal(output.captured.method, "POST");
|
|
90
|
-
// `redirect: "manual"` is pinned here rather than inferred from the redirect
|
|
91
|
-
// tests below, because the stub `fetch` cannot follow a redirect and so cannot
|
|
92
|
-
// observe the difference. Under the real `fetch` the default ("follow")
|
|
93
|
-
// resolves the chain in the runtime and hands back a 200, at which point
|
|
94
|
-
// REDIRECT_STATUSES.has(200) is false, fetchBrightDataApi returns on the first
|
|
95
|
-
// iteration, and the per-hop validateRemoteUrl, the cross-origin credential
|
|
96
|
-
// strip and the 5-hop cap are all unreachable in production while every
|
|
97
|
-
// redirect test below still passes. Same idiom as
|
|
98
|
-
// test/gemini-web-cookie-opt-in.test.mjs:42 and test/search-providers.test.mjs:173.
|
|
99
|
-
assert.equal(output.captured.redirect, "manual");
|
|
100
|
-
assert.equal(output.captured.headers.authorization, "Bearer bd-test-key");
|
|
101
|
-
assert.equal(output.captured.headers["content-type"], "application/json");
|
|
102
|
-
// The Unlocker zone is sent verbatim, and markdown is requested at the API
|
|
103
|
-
// rather than converted locally.
|
|
104
|
-
assert.deepEqual(output.captured.body, {
|
|
105
|
-
url: "https://example.com/article",
|
|
106
|
-
zone: "pi_unlocker",
|
|
107
|
-
format: "raw",
|
|
108
|
-
data_format: "markdown",
|
|
109
|
-
});
|
|
110
|
-
assert.deepEqual(output.result, {
|
|
111
|
-
url: "https://example.com/article",
|
|
112
|
-
title: "Unlocked Title",
|
|
113
|
-
content: "# Unlocked Title\n\nUnlocked body.",
|
|
114
|
-
error: null,
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test("Bright Data Web Unlocker rejects private targets without invoking the paid API", async () => {
|
|
119
|
-
const child = runChild(
|
|
120
|
-
`
|
|
121
|
-
let fetchCalls = 0;
|
|
122
|
-
globalThis.fetch = async () => { fetchCalls++; return new Response("# Should never happen", { status: 200 }); };
|
|
123
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
124
|
-
const errors = [];
|
|
125
|
-
for (const target of ["http://127.0.0.1:8080/admin", "http://localhost:8080/admin", "http://169.254.169.254/latest/meta-data"]) {
|
|
126
|
-
try { await extractWithBrightDataUnlocker(target); } catch (err) { errors.push(err.message); }
|
|
127
|
-
}
|
|
128
|
-
try { await extractWithBrightDataUnlocker("https://internal.example.com/", undefined, { lookup: async () => [{ address: "10.0.0.5", family: 4 }] }); }
|
|
129
|
-
catch (err) { errors.push(err.message); }
|
|
130
|
-
// A second resolved address in a private range must also block: the guard
|
|
131
|
-
// checks every answer, not the first.
|
|
132
|
-
try { await extractWithBrightDataUnlocker("https://rebind.example.com/", undefined, { lookup: async () => [{ address: "93.184.216.34", family: 4 }, { address: "192.168.1.10", family: 4 }] }); }
|
|
133
|
-
catch (err) { errors.push(err.message); }
|
|
134
|
-
console.log(JSON.stringify({ errors, fetchCalls }));
|
|
135
|
-
`,
|
|
136
|
-
{
|
|
137
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
138
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
139
|
-
},
|
|
140
|
-
);
|
|
141
|
-
assert.equal(child.status, 0, child.stderr);
|
|
142
|
-
const output = JSON.parse(child.stdout.trim());
|
|
143
|
-
// The stub fetch succeeds, so a zero call count can only mean the guard ran first.
|
|
144
|
-
assert.equal(output.fetchCalls, 0);
|
|
145
|
-
assert.equal(output.errors.length, 5);
|
|
146
|
-
assert.match(output.errors[0], /Blocked internal address/);
|
|
147
|
-
assert.match(output.errors[1], /Blocked internal hostname/);
|
|
148
|
-
assert.match(output.errors[2], /Blocked internal address/);
|
|
149
|
-
assert.match(output.errors[3], /Blocked internal address/);
|
|
150
|
-
assert.match(output.errors[4], /Blocked internal address/);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// Redundancy is deliberate and is called out so it is not read as padding: what
|
|
154
|
-
// actually stops this case is `extractContent`'s own up-front `validateRemoteUrl`
|
|
155
|
-
// (`extract.ts:246-259`), which returns before any provider in the chain is
|
|
156
|
-
// consulted — not `brightdata-unlocker.ts`'s guard, which the preceding test
|
|
157
|
-
// pins directly. It is kept because the review asked for an end-to-end proof
|
|
158
|
-
// that a blocked private target never reaches Bright Data, and because it is the
|
|
159
|
-
// only test that fails if the Bright Data block is ever moved above that
|
|
160
|
-
// up-front guard or if "Blocked internal address" is made a recoverable error
|
|
161
|
-
// the chain continues past.
|
|
162
|
-
test("Bright Data Web Unlocker is not reached for a blocked target through fetch_content", async () => {
|
|
163
|
-
const home = await configHome({
|
|
164
|
-
brightdataApiKey: "bd-test-key",
|
|
165
|
-
brightdataUnlockerZone: "pi_unlocker",
|
|
166
|
-
});
|
|
167
|
-
const child = runChild(
|
|
168
|
-
`
|
|
169
|
-
let fetchCalls = [];
|
|
170
|
-
globalThis.fetch = async (url) => { fetchCalls.push(String(url)); return new Response("# Should never happen", { status: 200 }); };
|
|
171
|
-
const { extractContent } = await import(${JSON.stringify(extractModuleUrl)});
|
|
172
|
-
const result = await extractContent("http://169.254.169.254/latest/meta-data");
|
|
173
|
-
console.log(JSON.stringify({ fetchCalls, error: result.error, content: result.content }));
|
|
174
|
-
`,
|
|
175
|
-
{ HOME: home, USERPROFILE: home, PI_CODING_AGENT_DIR: home },
|
|
176
|
-
);
|
|
177
|
-
assert.equal(child.status, 0, child.stderr);
|
|
178
|
-
const output = JSON.parse(child.stdout.trim());
|
|
179
|
-
assert.deepEqual(output.fetchCalls, []);
|
|
180
|
-
assert.equal(output.content, "");
|
|
181
|
-
assert.match(output.error, /Blocked internal address/);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
test("Bright Data Web Unlocker validates its own fixed API endpoint, not just the target", async () => {
|
|
185
|
-
// The endpoint is a hardcoded constant, so the only way it becomes private is a
|
|
186
|
-
// resolution that points api.brightdata.com at an internal address. The lookup
|
|
187
|
-
// is hostname-aware so the *target* still passes: that is what isolates the
|
|
188
|
-
// endpoint check from the target check, which every other test exercises.
|
|
189
|
-
const child = runChild(
|
|
190
|
-
`
|
|
191
|
-
let fetchCalls = 0;
|
|
192
|
-
globalThis.fetch = async () => { fetchCalls++; return new Response("# Should never happen", { status: 200 }); };
|
|
193
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
194
|
-
let message = null;
|
|
195
|
-
try {
|
|
196
|
-
await extractWithBrightDataUnlocker("https://example.com/a", undefined, {
|
|
197
|
-
lookup: async (hostname) => hostname === "api.brightdata.com"
|
|
198
|
-
? [{ address: "10.0.0.5", family: 4 }]
|
|
199
|
-
: [{ address: "93.184.216.34", family: 4 }],
|
|
200
|
-
});
|
|
201
|
-
} catch (err) { message = err.message; }
|
|
202
|
-
console.log(JSON.stringify({ message, fetchCalls }));
|
|
203
|
-
`,
|
|
204
|
-
{
|
|
205
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
206
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
207
|
-
},
|
|
208
|
-
);
|
|
209
|
-
assert.equal(child.status, 0, child.stderr);
|
|
210
|
-
const output = JSON.parse(child.stdout.trim());
|
|
211
|
-
assert.equal(output.fetchCalls, 0);
|
|
212
|
-
assert.match(output.message, /Blocked internal address/);
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
test("Bright Data Web Unlocker credentials are stripped on public cross-origin API redirects", async () => {
|
|
216
|
-
const child = runChild(
|
|
217
|
-
`
|
|
218
|
-
let calls = [];
|
|
219
|
-
globalThis.fetch = async (url, init) => {
|
|
220
|
-
calls.push({ url: String(url), auth: Object.fromEntries(new Headers(init.headers)).authorization ?? null });
|
|
221
|
-
if (calls.length === 1) return new Response("", { status: 307, headers: { location: "https://mirror.example.com/request" } });
|
|
222
|
-
return new Response("# Redirect body", { status: 200 });
|
|
223
|
-
};
|
|
224
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
225
|
-
const result = await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} });
|
|
226
|
-
console.log(JSON.stringify({ calls, result }));
|
|
227
|
-
`,
|
|
228
|
-
{
|
|
229
|
-
BRIGHTDATA_API_KEY: "bd-secret",
|
|
230
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
231
|
-
},
|
|
232
|
-
);
|
|
233
|
-
assert.equal(child.status, 0, child.stderr);
|
|
234
|
-
const output = JSON.parse(child.stdout.trim());
|
|
235
|
-
assert.deepEqual(output.calls, [
|
|
236
|
-
{ url: "https://api.brightdata.com/request", auth: "Bearer bd-secret" },
|
|
237
|
-
{ url: "https://mirror.example.com/request", auth: null },
|
|
238
|
-
]);
|
|
239
|
-
assert.deepEqual(output.result, {
|
|
240
|
-
url: "https://example.com/a",
|
|
241
|
-
title: "Redirect body",
|
|
242
|
-
content: "# Redirect body",
|
|
243
|
-
error: null,
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
test("Bright Data Web Unlocker blocks API redirects to private targets", async () => {
|
|
248
|
-
const child = runChild(
|
|
249
|
-
`
|
|
250
|
-
let calls = [];
|
|
251
|
-
globalThis.fetch = async (url) => {
|
|
252
|
-
calls.push(String(url));
|
|
253
|
-
return new Response("", { status: 302, headers: { location: "http://127.0.0.1/admin" } });
|
|
254
|
-
};
|
|
255
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
256
|
-
let redirectError = null;
|
|
257
|
-
try { await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }); }
|
|
258
|
-
catch (err) { redirectError = err.message; }
|
|
259
|
-
console.log(JSON.stringify({ calls, redirectError }));
|
|
260
|
-
`,
|
|
261
|
-
{
|
|
262
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
263
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
264
|
-
},
|
|
265
|
-
);
|
|
266
|
-
assert.equal(child.status, 0, child.stderr);
|
|
267
|
-
const output = JSON.parse(child.stdout.trim());
|
|
268
|
-
// The hop was validated before it was followed, so only the first request happened.
|
|
269
|
-
assert.deepEqual(output.calls, ["https://api.brightdata.com/request"]);
|
|
270
|
-
assert.match(output.redirectError, /Blocked internal address/);
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
test("Bright Data Web Unlocker stops after five API redirects with an explicit message", async () => {
|
|
274
|
-
const child = runChild(
|
|
275
|
-
`
|
|
276
|
-
let calls = [];
|
|
277
|
-
globalThis.fetch = async (url, init) => {
|
|
278
|
-
calls.push({ url: String(url), auth: Object.fromEntries(new Headers(init.headers)).authorization ?? null });
|
|
279
|
-
return new Response("", { status: 302, headers: { location: "https://hop" + calls.length + ".example.com/request" } });
|
|
280
|
-
};
|
|
281
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
282
|
-
let message = null;
|
|
283
|
-
try { await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }); }
|
|
284
|
-
catch (err) { message = err.message; }
|
|
285
|
-
console.log(JSON.stringify({ calls, message }));
|
|
286
|
-
`,
|
|
287
|
-
{
|
|
288
|
-
BRIGHTDATA_API_KEY: "bd-secret",
|
|
289
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
290
|
-
},
|
|
291
|
-
);
|
|
292
|
-
assert.equal(child.status, 0, child.stderr);
|
|
293
|
-
const output = JSON.parse(child.stdout.trim());
|
|
294
|
-
// Six requests total: the initial POST plus exactly DEFAULT_MAX_REDIRECTS = 5
|
|
295
|
-
// followed hops. A seventh would mean the cap does not hold.
|
|
296
|
-
assert.deepEqual(
|
|
297
|
-
output.calls.map((call) => call.url),
|
|
298
|
-
[
|
|
299
|
-
"https://api.brightdata.com/request",
|
|
300
|
-
"https://hop1.example.com/request",
|
|
301
|
-
"https://hop2.example.com/request",
|
|
302
|
-
"https://hop3.example.com/request",
|
|
303
|
-
"https://hop4.example.com/request",
|
|
304
|
-
"https://hop5.example.com/request",
|
|
305
|
-
],
|
|
306
|
-
);
|
|
307
|
-
// The cap raises a named error rather than returning null or the last 302 body,
|
|
308
|
-
// and it names the hop it gave up on.
|
|
309
|
-
assert.equal(
|
|
310
|
-
output.message,
|
|
311
|
-
"Too many redirects fetching https://hop5.example.com/request",
|
|
312
|
-
);
|
|
313
|
-
// The credential is dropped at the first origin change and never reinstated.
|
|
314
|
-
assert.deepEqual(
|
|
315
|
-
output.calls.map((call) => call.auth),
|
|
316
|
-
["Bearer bd-secret", null, null, null, null, null],
|
|
317
|
-
);
|
|
318
|
-
assert.equal(output.message.includes("bd-secret"), false);
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
test("BRIGHTDATA_UNLOCKER_ZONE takes precedence over brightdataUnlockerZone in the config file", async () => {
|
|
322
|
-
// Both sources are populated at once, so the assertion can only pass if the
|
|
323
|
-
// precedence order is the documented one. Reversing it in getZone() still
|
|
324
|
-
// typechecks and still passes every other test in this file.
|
|
325
|
-
const home = await configHome({
|
|
326
|
-
brightdataApiKey: "bd-test-key",
|
|
327
|
-
brightdataUnlockerZone: "config_zone1",
|
|
328
|
-
});
|
|
329
|
-
for (const { env, expected } of [
|
|
330
|
-
{ env: {}, expected: "config_zone1" },
|
|
331
|
-
{ env: { BRIGHTDATA_UNLOCKER_ZONE: "env_zone1" }, expected: "env_zone1" },
|
|
332
|
-
]) {
|
|
333
|
-
const child = runChild(
|
|
334
|
-
`
|
|
335
|
-
let zone = null;
|
|
336
|
-
globalThis.fetch = async (_url, init) => {
|
|
337
|
-
zone = JSON.parse(init.body).zone;
|
|
338
|
-
return new Response("# Zone body", { status: 200 });
|
|
339
|
-
};
|
|
340
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
341
|
-
await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} });
|
|
342
|
-
console.log(JSON.stringify({ zone }));
|
|
343
|
-
`,
|
|
344
|
-
{ HOME: home, USERPROFILE: home, PI_CODING_AGENT_DIR: home, ...env },
|
|
345
|
-
);
|
|
346
|
-
assert.equal(child.status, 0, child.stderr);
|
|
347
|
-
assert.equal(
|
|
348
|
-
JSON.parse(child.stdout.trim()).zone,
|
|
349
|
-
expected,
|
|
350
|
-
JSON.stringify(env),
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
test("Bright Data Web Unlocker requires its own zone and never borrows the SERP zone", async () => {
|
|
356
|
-
const home = await configHome({
|
|
357
|
-
brightdataApiKey: "bd-test-key",
|
|
358
|
-
brightdataSerpZone: "serp_zone1",
|
|
359
|
-
});
|
|
360
|
-
const child = runChild(
|
|
361
|
-
`
|
|
362
|
-
let fetchCalls = 0;
|
|
363
|
-
globalThis.fetch = async () => { fetchCalls++; return new Response("# Should never happen", { status: 200 }); };
|
|
364
|
-
const { extractWithBrightDataUnlocker, isBrightDataUnlockerAvailable } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
365
|
-
const available = isBrightDataUnlockerAvailable();
|
|
366
|
-
let zoneError = null;
|
|
367
|
-
try { await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }); }
|
|
368
|
-
catch (err) { zoneError = err.message; }
|
|
369
|
-
console.log(JSON.stringify({ available, zoneError, fetchCalls }));
|
|
370
|
-
`,
|
|
371
|
-
{ HOME: home, USERPROFILE: home, PI_CODING_AGENT_DIR: home },
|
|
372
|
-
);
|
|
373
|
-
assert.equal(child.status, 0, child.stderr);
|
|
374
|
-
const output = JSON.parse(child.stdout.trim());
|
|
375
|
-
// A SERP-only configuration must not opt the user into Web Unlocker spend.
|
|
376
|
-
assert.equal(output.available, false);
|
|
377
|
-
assert.equal(output.fetchCalls, 0);
|
|
378
|
-
assert.match(
|
|
379
|
-
output.zoneError,
|
|
380
|
-
/Bright Data Web Unlocker zone not configured/,
|
|
381
|
-
);
|
|
382
|
-
assert.match(output.zoneError, /brightdataUnlockerZone/);
|
|
383
|
-
assert.match(output.zoneError, /BRIGHTDATA_UNLOCKER_ZONE/);
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
test("Bright Data Web Unlocker availability needs both a zone and a credential source", async () => {
|
|
387
|
-
const cases = [
|
|
388
|
-
{ env: {}, expected: false },
|
|
389
|
-
{ env: { BRIGHTDATA_API_KEY: "bd-test-key" }, expected: false },
|
|
390
|
-
{ env: { BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker" }, expected: false },
|
|
391
|
-
{
|
|
392
|
-
env: {
|
|
393
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
394
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
395
|
-
},
|
|
396
|
-
expected: true,
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
env: {
|
|
400
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
401
|
-
BRIGHTDATA_UNLOCKER_ZONE: "https://zone.example.com",
|
|
402
|
-
},
|
|
403
|
-
expected: false,
|
|
404
|
-
},
|
|
405
|
-
];
|
|
406
|
-
for (const { env, expected } of cases) {
|
|
407
|
-
const child = runChild(
|
|
408
|
-
`
|
|
409
|
-
const { isBrightDataUnlockerAvailable } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
410
|
-
console.log(JSON.stringify({ available: isBrightDataUnlockerAvailable() }));
|
|
411
|
-
`,
|
|
412
|
-
env,
|
|
413
|
-
);
|
|
414
|
-
assert.equal(child.status, 0, child.stderr);
|
|
415
|
-
assert.equal(
|
|
416
|
-
JSON.parse(child.stdout.trim()).available,
|
|
417
|
-
expected,
|
|
418
|
-
JSON.stringify(env),
|
|
419
|
-
);
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
test("Bright Data Web Unlocker resolves the credential at request time, after the SSRF guard", async () => {
|
|
424
|
-
const home = await mkdtemp(join(tmpdir(), "pi-web-access-brightdata-"));
|
|
425
|
-
const marker = join(home, "resolver-ran");
|
|
426
|
-
await writeFile(
|
|
427
|
-
join(home, "web-search.json"),
|
|
428
|
-
JSON.stringify({
|
|
429
|
-
brightdataApiKey: `!touch ${marker} && printf bd-command-key`,
|
|
430
|
-
brightdataUnlockerZone: "pi_unlocker",
|
|
431
|
-
}) + "\n",
|
|
432
|
-
"utf8",
|
|
433
|
-
);
|
|
434
|
-
const child = runChild(
|
|
435
|
-
`
|
|
436
|
-
import { existsSync } from "node:fs";
|
|
437
|
-
let auth = null;
|
|
438
|
-
globalThis.fetch = async (_url, init) => {
|
|
439
|
-
auth = Object.fromEntries(new Headers(init.headers)).authorization ?? null;
|
|
440
|
-
return new Response("# Command body", { status: 200 });
|
|
441
|
-
};
|
|
442
|
-
const { extractWithBrightDataUnlocker, isBrightDataUnlockerAvailable } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
443
|
-
const availableBefore = isBrightDataUnlockerAvailable();
|
|
444
|
-
const ranBefore = existsSync(${JSON.stringify(marker)});
|
|
445
|
-
// A blocked target must not spawn the credential command either.
|
|
446
|
-
let blockedError = null;
|
|
447
|
-
try { await extractWithBrightDataUnlocker("http://127.0.0.1:8080/admin"); } catch (err) { blockedError = err.message; }
|
|
448
|
-
const ranAfterBlocked = existsSync(${JSON.stringify(marker)});
|
|
449
|
-
await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} });
|
|
450
|
-
const ranAfter = existsSync(${JSON.stringify(marker)});
|
|
451
|
-
console.log(JSON.stringify({ availableBefore, ranBefore, blockedError, ranAfterBlocked, ranAfter, auth }));
|
|
452
|
-
`,
|
|
453
|
-
{ HOME: home, USERPROFILE: home, PI_CODING_AGENT_DIR: home },
|
|
454
|
-
);
|
|
455
|
-
assert.equal(child.status, 0, child.stderr);
|
|
456
|
-
const output = JSON.parse(child.stdout.trim());
|
|
457
|
-
assert.equal(output.availableBefore, true);
|
|
458
|
-
assert.equal(output.ranBefore, false);
|
|
459
|
-
assert.match(output.blockedError, /Blocked internal address/);
|
|
460
|
-
assert.equal(output.ranAfterBlocked, false);
|
|
461
|
-
assert.equal(output.ranAfter, true);
|
|
462
|
-
assert.equal(output.auth, "Bearer bd-command-key");
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
test("Bright Data Web Unlocker HTTP failures surface the status and redact the credential", async () => {
|
|
466
|
-
const child = runChild(
|
|
467
|
-
`
|
|
468
|
-
globalThis.fetch = async () => new Response("payment required for token bd-secret", { status: 402 });
|
|
469
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
470
|
-
let message = null;
|
|
471
|
-
let result = "not-reached";
|
|
472
|
-
try { result = await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }); }
|
|
473
|
-
catch (err) { message = err.message; }
|
|
474
|
-
console.log(JSON.stringify({ message, result }));
|
|
475
|
-
`,
|
|
476
|
-
{
|
|
477
|
-
BRIGHTDATA_API_KEY: "bd-secret",
|
|
478
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
479
|
-
},
|
|
480
|
-
);
|
|
481
|
-
assert.equal(child.status, 0, child.stderr);
|
|
482
|
-
const output = JSON.parse(child.stdout.trim());
|
|
483
|
-
// A paid failure throws; it is never collapsed into a silent null.
|
|
484
|
-
assert.equal(output.result, "not-reached");
|
|
485
|
-
assert.match(output.message, /Bright Data Web Unlocker error 402/);
|
|
486
|
-
assert.match(output.message, /payment required/);
|
|
487
|
-
assert.match(output.message, /\[redacted\]/);
|
|
488
|
-
assert.equal(output.message.includes("bd-secret"), false);
|
|
489
|
-
});
|
|
490
|
-
|
|
491
|
-
test("Bright Data Web Unlocker redacts the credential before truncating a long error body", async () => {
|
|
492
|
-
// Order is the property under test. The body is redacted *before* the
|
|
493
|
-
// 300-character slice; if it were sliced first, a token straddling the boundary
|
|
494
|
-
// would be cut into a fragment that the later message-level redaction cannot
|
|
495
|
-
// match by exact string, and the fragment would reach the user. Both redactions
|
|
496
|
-
// individually pass the 402 test above, so only this one can tell them apart.
|
|
497
|
-
const child = runChild(
|
|
498
|
-
`
|
|
499
|
-
const key = "bd-boundary-secret-0123456789";
|
|
500
|
-
globalThis.fetch = async () => new Response("e".repeat(280) + key + " trailing detail", { status: 500 });
|
|
501
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
502
|
-
let message = null;
|
|
503
|
-
try { await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }); }
|
|
504
|
-
catch (err) { message = err.message; }
|
|
505
|
-
console.log(JSON.stringify({ message }));
|
|
506
|
-
`,
|
|
507
|
-
{
|
|
508
|
-
BRIGHTDATA_API_KEY: "bd-boundary-secret-0123456789",
|
|
509
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
510
|
-
},
|
|
511
|
-
);
|
|
512
|
-
assert.equal(child.status, 0, child.stderr);
|
|
513
|
-
const output = JSON.parse(child.stdout.trim());
|
|
514
|
-
assert.match(output.message, /Bright Data Web Unlocker error 500/);
|
|
515
|
-
assert.match(output.message, /\[redacted\]/);
|
|
516
|
-
// Not even a prefix of the token survives the truncation.
|
|
517
|
-
assert.equal(output.message.includes("bd-bound"), false);
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
test("Bright Data Web Unlocker redacts transport errors and preserves the error name", async () => {
|
|
521
|
-
// The catch-level redaction, pinned on its own: this path never touches the
|
|
522
|
-
// response-body redaction, and it must rebuild the error without losing
|
|
523
|
-
// `err.name`, which is what downstream abort detection reads.
|
|
524
|
-
const child = runChild(
|
|
525
|
-
`
|
|
526
|
-
globalThis.fetch = async () => {
|
|
527
|
-
const err = new Error("socket hang up while sending token bd-secret");
|
|
528
|
-
err.name = "TypeError";
|
|
529
|
-
throw err;
|
|
530
|
-
};
|
|
531
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
532
|
-
let name = null;
|
|
533
|
-
let message = null;
|
|
534
|
-
let result = "not-reached";
|
|
535
|
-
try { result = await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }); }
|
|
536
|
-
catch (err) { name = err.name; message = err.message; }
|
|
537
|
-
console.log(JSON.stringify({ name, message, result }));
|
|
538
|
-
`,
|
|
539
|
-
{
|
|
540
|
-
BRIGHTDATA_API_KEY: "bd-secret",
|
|
541
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
542
|
-
},
|
|
543
|
-
);
|
|
544
|
-
assert.equal(child.status, 0, child.stderr);
|
|
545
|
-
const output = JSON.parse(child.stdout.trim());
|
|
546
|
-
assert.equal(output.result, "not-reached");
|
|
547
|
-
assert.equal(output.name, "TypeError");
|
|
548
|
-
assert.match(output.message, /socket hang up/);
|
|
549
|
-
assert.match(output.message, /\[redacted\]/);
|
|
550
|
-
assert.equal(output.message.includes("bd-secret"), false);
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
test("Bright Data Web Unlocker returns null only for genuinely empty content", async () => {
|
|
554
|
-
const child = runChild(
|
|
555
|
-
`
|
|
556
|
-
const bodies = ["", " \\n\\t ", "Paywalled: subscribe to continue reading."];
|
|
557
|
-
let index = 0;
|
|
558
|
-
globalThis.fetch = async () => new Response(bodies[index++], { status: 200 });
|
|
559
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
560
|
-
const results = [];
|
|
561
|
-
for (let i = 0; i < bodies.length; i++) {
|
|
562
|
-
results.push(await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }));
|
|
563
|
-
}
|
|
564
|
-
console.log(JSON.stringify({ results }));
|
|
565
|
-
`,
|
|
566
|
-
{
|
|
567
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
568
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
569
|
-
},
|
|
570
|
-
);
|
|
571
|
-
assert.equal(child.status, 0, child.stderr);
|
|
572
|
-
const results = JSON.parse(child.stdout.trim()).results;
|
|
573
|
-
assert.equal(results[0], null);
|
|
574
|
-
assert.equal(results[1], null);
|
|
575
|
-
// Short content is billed content: it is returned, not silently dropped.
|
|
576
|
-
assert.deepEqual(results[2], {
|
|
577
|
-
url: "https://example.com/a",
|
|
578
|
-
title: "",
|
|
579
|
-
content: "Paywalled: subscribe to continue reading.",
|
|
580
|
-
error: null,
|
|
581
|
-
});
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
test("Bright Data Web Unlocker propagates cancellation instead of returning null", async () => {
|
|
585
|
-
const child = runChild(
|
|
586
|
-
`
|
|
587
|
-
let sawAbortedSignal = null;
|
|
588
|
-
globalThis.fetch = async (_url, init) => {
|
|
589
|
-
sawAbortedSignal = init.signal?.aborted ?? null;
|
|
590
|
-
if (init.signal?.aborted) throw new DOMException("This operation was aborted", "AbortError");
|
|
591
|
-
return new Response("# Never returned", { status: 200 });
|
|
592
|
-
};
|
|
593
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
594
|
-
let name = null;
|
|
595
|
-
let message = null;
|
|
596
|
-
try { await extractWithBrightDataUnlocker("https://example.com/a", AbortSignal.abort(), { lookup: ${PUBLIC_LOOKUP} }); }
|
|
597
|
-
catch (err) { name = err.name; message = err.message; }
|
|
598
|
-
console.log(JSON.stringify({ sawAbortedSignal, name, message }));
|
|
599
|
-
`,
|
|
600
|
-
{
|
|
601
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
602
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
603
|
-
},
|
|
604
|
-
);
|
|
605
|
-
assert.equal(child.status, 0, child.stderr);
|
|
606
|
-
const output = JSON.parse(child.stdout.trim());
|
|
607
|
-
// The caller signal reaches the request, and the abort is rethrown so
|
|
608
|
-
// extractContent can report "Aborted" instead of falling through the chain.
|
|
609
|
-
assert.equal(output.sawAbortedSignal, true);
|
|
610
|
-
assert.equal(output.name, "AbortError");
|
|
611
|
-
assert.match(output.message, /aborted/i);
|
|
612
|
-
});
|
|
613
|
-
|
|
614
|
-
test("Bright Data Web Unlocker uses fetch_content's timeoutMs and its own 60s default otherwise", async () => {
|
|
615
|
-
const child = runChild(
|
|
616
|
-
`
|
|
617
|
-
// AbortSignal.timeout is the only place the effective budget is observable,
|
|
618
|
-
// and the signal it returns is the one handed to fetch.
|
|
619
|
-
const realTimeout = AbortSignal.timeout;
|
|
620
|
-
const requested = [];
|
|
621
|
-
AbortSignal.timeout = (ms) => { requested.push(ms); return realTimeout.call(AbortSignal, ms); };
|
|
622
|
-
|
|
623
|
-
let sawSignal = null;
|
|
624
|
-
globalThis.fetch = async (_url, init) => {
|
|
625
|
-
sawSignal = init.signal instanceof AbortSignal;
|
|
626
|
-
return new Response("# Body", { status: 200 });
|
|
627
|
-
};
|
|
628
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
629
|
-
|
|
630
|
-
await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP}, timeoutMs: 12345 });
|
|
631
|
-
const explicit = requested.splice(0);
|
|
632
|
-
await extractWithBrightDataUnlocker("https://example.com/b", undefined, { lookup: ${PUBLIC_LOOKUP} });
|
|
633
|
-
const fallback = requested.splice(0);
|
|
634
|
-
|
|
635
|
-
// A tiny budget must actually abort the in-flight request, not merely be recorded.
|
|
636
|
-
globalThis.fetch = async (_url, init) => new Promise((_resolve, reject) => {
|
|
637
|
-
// AbortSignal.timeout unrefs its timer, so hold the loop open ourselves;
|
|
638
|
-
// otherwise the child exits before the deadline and proves nothing.
|
|
639
|
-
const keepAlive = setTimeout(() => {}, 5000);
|
|
640
|
-
init.signal.addEventListener("abort", () => {
|
|
641
|
-
clearTimeout(keepAlive);
|
|
642
|
-
reject(new DOMException("This operation was aborted", "AbortError"));
|
|
643
|
-
});
|
|
644
|
-
});
|
|
645
|
-
let timedOutName = null;
|
|
646
|
-
let timedOutResult = "not-reached";
|
|
647
|
-
try { timedOutResult = await extractWithBrightDataUnlocker("https://example.com/c", undefined, { lookup: ${PUBLIC_LOOKUP}, timeoutMs: 25 }); }
|
|
648
|
-
catch (err) { timedOutName = err.name; }
|
|
649
|
-
console.log(JSON.stringify({ explicit, fallback, tiny: requested, sawSignal, timedOutName, timedOutResult }));
|
|
650
|
-
`,
|
|
651
|
-
{
|
|
652
|
-
BRIGHTDATA_API_KEY: "bd-test-key",
|
|
653
|
-
BRIGHTDATA_UNLOCKER_ZONE: "pi_unlocker",
|
|
654
|
-
},
|
|
655
|
-
);
|
|
656
|
-
assert.equal(child.status, 0, child.stderr);
|
|
657
|
-
const output = JSON.parse(child.stdout.trim());
|
|
658
|
-
assert.equal(output.sawSignal, true);
|
|
659
|
-
// The caller's budget is used verbatim, not clamped and not ignored.
|
|
660
|
-
assert.deepEqual(output.explicit, [12345]);
|
|
661
|
-
// With no caller budget the module's own EXTRACT_TIMEOUT_MS applies. This is
|
|
662
|
-
// deliberately 60s, not the 30s of the direct HTTP path, because Bright Data is
|
|
663
|
-
// retrying and rendering on our behalf; it matches firecrawl.ts:10.
|
|
664
|
-
assert.deepEqual(output.fallback, [60_000]);
|
|
665
|
-
assert.deepEqual(output.tiny, [25]);
|
|
666
|
-
// A timeout is a thrown abort, never a silent null the chain walks past.
|
|
667
|
-
assert.equal(output.timedOutResult, "not-reached");
|
|
668
|
-
assert.equal(output.timedOutName, "AbortError");
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
// Scope, stated exactly: this fixture configures Bright Data and nothing else, so
|
|
672
|
-
// Firecrawl, TinyFish and Parallel are unavailable and make no calls. Their
|
|
673
|
-
// position relative to Bright Data is therefore NOT what this asserts — only
|
|
674
|
-
// that Bright Data runs after the direct HTTP fetch and Jina Reader, and that a
|
|
675
|
-
// Bright Data hit returns before the Gemini fallbacks are consulted. The full
|
|
676
|
-
// ordering is a source-order property of `extractContent`, not a tested one.
|
|
677
|
-
test("fetch_content tries Bright Data after the direct fetch and Jina Reader, and returns before Gemini", async () => {
|
|
678
|
-
const home = await configHome({
|
|
679
|
-
brightdataApiKey: "bd-test-key",
|
|
680
|
-
brightdataUnlockerZone: "pi_unlocker",
|
|
681
|
-
fetchRouting: { allowRemoteHostedProviders: true },
|
|
682
|
-
});
|
|
683
|
-
const child = runChild(
|
|
684
|
-
`
|
|
685
|
-
let calls = [];
|
|
686
|
-
globalThis.fetch = async (url) => {
|
|
687
|
-
calls.push(String(url));
|
|
688
|
-
if (calls.length === 1) return new Response("blocked", { status: 403 });
|
|
689
|
-
if (String(url).startsWith("https://r.jina.ai/")) return new Response("nope", { status: 500 });
|
|
690
|
-
return new Response("# Unblocked\\n\\nUnblocked body.", { status: 200 });
|
|
691
|
-
};
|
|
692
|
-
const { extractContent } = await import(${JSON.stringify(extractModuleUrl)});
|
|
693
|
-
const result = await extractContent("https://example.com/protected", undefined, { lookup: ${PUBLIC_LOOKUP} });
|
|
694
|
-
console.log(JSON.stringify({ calls, result }));
|
|
695
|
-
`,
|
|
696
|
-
{ HOME: home, USERPROFILE: home, PI_CODING_AGENT_DIR: home },
|
|
697
|
-
);
|
|
698
|
-
assert.equal(child.status, 0, child.stderr);
|
|
699
|
-
const output = JSON.parse(child.stdout.trim());
|
|
700
|
-
assert.deepEqual(output.calls, [
|
|
701
|
-
"https://example.com/protected",
|
|
702
|
-
"https://r.jina.ai/https://example.com/protected",
|
|
703
|
-
"https://api.brightdata.com/request",
|
|
704
|
-
]);
|
|
705
|
-
assert.deepEqual(output.result, {
|
|
706
|
-
url: "https://example.com/protected",
|
|
707
|
-
title: "Unblocked",
|
|
708
|
-
content: "# Unblocked\n\nUnblocked body.",
|
|
709
|
-
error: null,
|
|
710
|
-
});
|
|
711
|
-
});
|
|
712
|
-
|
|
713
|
-
test("Bright Data Web Unlocker failures stay visible in fetch_content guidance", async () => {
|
|
714
|
-
const home = await configHome({
|
|
715
|
-
brightdataApiKey: "bd-secret",
|
|
716
|
-
brightdataUnlockerZone: "pi_unlocker",
|
|
717
|
-
fetchRouting: { allowRemoteHostedProviders: true },
|
|
718
|
-
});
|
|
719
|
-
const child = runChild(
|
|
720
|
-
`
|
|
721
|
-
let calls = [];
|
|
722
|
-
globalThis.fetch = async (url) => {
|
|
723
|
-
calls.push(String(url));
|
|
724
|
-
if (calls.length === 1) return new Response("blocked", { status: 403 });
|
|
725
|
-
if (String(url).startsWith("https://r.jina.ai/")) return new Response("nope", { status: 500 });
|
|
726
|
-
return new Response("payment required for token bd-secret", { status: 402 });
|
|
727
|
-
};
|
|
728
|
-
const { extractContent } = await import(${JSON.stringify(extractModuleUrl)});
|
|
729
|
-
const result = await extractContent("https://example.com/paywalled", undefined, { lookup: ${PUBLIC_LOOKUP} });
|
|
730
|
-
console.log(JSON.stringify({ calls, error: result.error }));
|
|
731
|
-
`,
|
|
732
|
-
{ HOME: home, USERPROFILE: home, PI_CODING_AGENT_DIR: home },
|
|
733
|
-
);
|
|
734
|
-
assert.equal(child.status, 0, child.stderr);
|
|
735
|
-
const output = JSON.parse(child.stdout.trim());
|
|
736
|
-
assert.match(
|
|
737
|
-
output.error,
|
|
738
|
-
/Bright Data fallback failed: Bright Data Web Unlocker error 402/,
|
|
739
|
-
);
|
|
740
|
-
assert.match(
|
|
741
|
-
output.error,
|
|
742
|
-
/Set brightdataApiKey and brightdataUnlockerZone in .*web-search\.json or BRIGHTDATA_API_KEY and BRIGHTDATA_UNLOCKER_ZONE/,
|
|
743
|
-
);
|
|
744
|
-
assert.equal(output.error.includes("bd-secret"), false);
|
|
745
|
-
});
|
|
746
|
-
|
|
747
|
-
test("Bright Data Web Unlocker rejects a malformed zone and a malformed config root", async () => {
|
|
748
|
-
const badZone = await configHome({
|
|
749
|
-
brightdataApiKey: "bd-test-key",
|
|
750
|
-
brightdataUnlockerZone: "https://zone.example.com",
|
|
751
|
-
});
|
|
752
|
-
const badZoneChild = runChild(
|
|
753
|
-
`
|
|
754
|
-
let fetchCalls = 0;
|
|
755
|
-
globalThis.fetch = async () => { fetchCalls++; return new Response("# Should never happen", { status: 200 }); };
|
|
756
|
-
const { extractWithBrightDataUnlocker, isBrightDataUnlockerAvailable } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
757
|
-
const available = isBrightDataUnlockerAvailable();
|
|
758
|
-
let message = null;
|
|
759
|
-
try { await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }); }
|
|
760
|
-
catch (err) { message = err.message; }
|
|
761
|
-
console.log(JSON.stringify({ available, message, fetchCalls }));
|
|
762
|
-
`,
|
|
763
|
-
{ HOME: badZone, USERPROFILE: badZone, PI_CODING_AGENT_DIR: badZone },
|
|
764
|
-
);
|
|
765
|
-
assert.equal(badZoneChild.status, 0, badZoneChild.stderr);
|
|
766
|
-
const badZoneOutput = JSON.parse(badZoneChild.stdout.trim());
|
|
767
|
-
assert.equal(badZoneOutput.available, false);
|
|
768
|
-
assert.equal(badZoneOutput.fetchCalls, 0);
|
|
769
|
-
assert.match(
|
|
770
|
-
badZoneOutput.message,
|
|
771
|
-
/Invalid Bright Data Unlocker zone: brightdataUnlockerZone in .*web-search\.json/,
|
|
772
|
-
);
|
|
773
|
-
|
|
774
|
-
const badRoot = await mkdtemp(join(tmpdir(), "pi-web-access-brightdata-"));
|
|
775
|
-
await writeFile(join(badRoot, "web-search.json"), "[]\n", "utf8");
|
|
776
|
-
const badRootChild = runChild(
|
|
777
|
-
`
|
|
778
|
-
const { extractWithBrightDataUnlocker } = await import(${JSON.stringify(brightdataModuleUrl)});
|
|
779
|
-
let message = null;
|
|
780
|
-
try { await extractWithBrightDataUnlocker("https://example.com/a", undefined, { lookup: ${PUBLIC_LOOKUP} }); }
|
|
781
|
-
catch (err) { message = err.message; }
|
|
782
|
-
console.log(JSON.stringify({ message }));
|
|
783
|
-
`,
|
|
784
|
-
{ HOME: badRoot, USERPROFILE: badRoot, PI_CODING_AGENT_DIR: badRoot },
|
|
785
|
-
);
|
|
786
|
-
assert.equal(badRootChild.status, 0, badRootChild.stderr);
|
|
787
|
-
assert.match(
|
|
788
|
-
JSON.parse(badRootChild.stdout.trim()).message,
|
|
789
|
-
/Invalid config in .*web-search\.json: expected a JSON object/,
|
|
790
|
-
);
|
|
791
|
-
});
|
|
792
|
-
|
|
793
|
-
test("a private Bright Data endpoint mirror requires an explicit narrow SSRF range", async () => {
|
|
794
|
-
// The API host is fixed, so the only way a private address can be reached is
|
|
795
|
-
// through a redirect. That hop is exempt only when the user opted a narrow
|
|
796
|
-
// range into ssrf.allowRanges, which extract.ts threads in per attempt.
|
|
797
|
-
for (const allowRanges of [undefined, ["127.0.0.0/8"]]) {
|
|
798
|
-
const home = await configHome({
|
|
799
|
-
brightdataApiKey: "bd-test-key",
|
|
800
|
-
brightdataUnlockerZone: "pi_unlocker",
|
|
801
|
-
fetchRouting: { allowRemoteHostedProviders: true },
|
|
802
|
-
...(allowRanges ? { ssrf: { allowRanges } } : {}),
|
|
803
|
-
});
|
|
804
|
-
const child = runChild(
|
|
805
|
-
`
|
|
806
|
-
let calls = [];
|
|
807
|
-
globalThis.fetch = async (url) => {
|
|
808
|
-
calls.push(String(url));
|
|
809
|
-
if (calls.length === 1) return new Response("blocked", { status: 403 });
|
|
810
|
-
if (String(url).startsWith("https://r.jina.ai/")) return new Response("nope", { status: 500 });
|
|
811
|
-
if (String(url) === "https://api.brightdata.com/request") {
|
|
812
|
-
return new Response("", { status: 307, headers: { location: "http://127.0.0.1:3002/request" } });
|
|
813
|
-
}
|
|
814
|
-
return new Response("# Local mirror", { status: 200 });
|
|
815
|
-
};
|
|
816
|
-
const { extractContent } = await import(${JSON.stringify(extractModuleUrl)});
|
|
817
|
-
const result = await extractContent("https://example.com/protected", undefined, { lookup: ${PUBLIC_LOOKUP} });
|
|
818
|
-
console.log(JSON.stringify({ calls, result }));
|
|
819
|
-
`,
|
|
820
|
-
{ HOME: home, USERPROFILE: home, PI_CODING_AGENT_DIR: home },
|
|
821
|
-
);
|
|
822
|
-
assert.equal(child.status, 0, child.stderr);
|
|
823
|
-
const output = JSON.parse(child.stdout.trim());
|
|
824
|
-
if (allowRanges) {
|
|
825
|
-
assert.deepEqual(output.calls.slice(2), [
|
|
826
|
-
"https://api.brightdata.com/request",
|
|
827
|
-
"http://127.0.0.1:3002/request",
|
|
828
|
-
]);
|
|
829
|
-
assert.equal(output.result.content, "# Local mirror");
|
|
830
|
-
} else {
|
|
831
|
-
assert.deepEqual(output.calls.slice(2), [
|
|
832
|
-
"https://api.brightdata.com/request",
|
|
833
|
-
]);
|
|
834
|
-
assert.match(
|
|
835
|
-
output.result.error,
|
|
836
|
-
/Bright Data fallback failed: Blocked internal address/,
|
|
837
|
-
);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
});
|