@agent-spaces/server 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/claude-code-runtime/index.js +19 -1
- package/dist/adapters/codex-runtime.js +13 -3
- package/dist/agents/agent-message-parts.js +9 -1
- package/dist/agents/commit-agent.js +7 -15
- package/dist/app.js +37 -0
- package/dist/package.json +4 -1
- package/dist/routes/channel.js +18 -6
- package/dist/routes/code-favorites.js +60 -0
- package/dist/routes/file.js +15 -2
- package/dist/routes/inspector.js +14 -0
- package/dist/routes/issue.js +7 -0
- package/dist/routes/prompt-template.js +48 -0
- package/dist/services/agent.js +45 -3
- package/dist/services/channel.js +2 -0
- package/dist/services/code-favorites.js +23 -0
- package/dist/services/file.js +8 -0
- package/dist/services/inspector-history.js +53 -0
- package/dist/services/notification-hub/events.js +34 -1
- package/dist/services/persistent-agent-context.js +3 -2
- package/dist/services/prompt-template.js +93 -0
- package/dist/services/pty.js +24 -4
- package/dist/services/search.js +3 -5
- package/dist/storage/code-favorites-store.js +15 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +21 -21
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +13 -13
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/0-1pn22sg~67u.js +2 -0
- package/dist/web/_next/static/chunks/0-lseun2l1m_t.js +2 -0
- package/dist/web/_next/static/chunks/0-wkj-hzh444r.css +4 -0
- package/dist/web/_next/static/chunks/{0f6vrjsdauiwl.js → 0-~4vw4_9z_0_.js} +2 -2
- package/dist/web/_next/static/chunks/0..g0jl-8qup7.js +1 -0
- package/dist/web/_next/static/chunks/0.006.ycpe92w.js +496 -0
- package/dist/web/_next/static/chunks/0.6x8f.mb-1qf.js +1 -0
- package/dist/web/_next/static/chunks/{0qe5wvs8fe9ip.js → 004wt62de8617.js} +1 -1
- package/dist/web/_next/static/chunks/016xz2o-hv3am.js +1 -0
- package/dist/web/_next/static/chunks/01gi~q0c6ez6..js +1 -0
- package/dist/web/_next/static/chunks/023lpc7n70tav.css +1 -0
- package/dist/web/_next/static/chunks/03me5_ir..2ix.js +1 -0
- package/dist/web/_next/static/chunks/04fk~8rnrvs44.js +1 -0
- package/dist/web/_next/static/chunks/05eu2fdixf7c9.js +1 -0
- package/dist/web/_next/static/chunks/05gt_g_vbzh-5.css +1 -0
- package/dist/web/_next/static/chunks/06vadtvw631k5.css +1 -0
- package/dist/web/_next/static/chunks/07ge_85i__6pb.js +1 -0
- package/dist/web/_next/static/chunks/07ne4g8zopykv.js +1 -0
- package/dist/web/_next/static/chunks/07xvadmf~8bow.js +1 -0
- package/dist/web/_next/static/chunks/08.u~dmq20cak.css +23 -0
- package/dist/web/_next/static/chunks/08ag2f8y6f8cr.js +1 -0
- package/dist/web/_next/static/chunks/{03sd~wmqw.9gc.js → 08kpa0nox.bb1.js} +2 -2
- package/dist/web/_next/static/chunks/08o-zmr-40r5g.js +1 -0
- package/dist/web/_next/static/chunks/0_-c.y2qq4ax4.js +270 -0
- package/dist/web/_next/static/chunks/0a1rewz7xr-xi.js +1 -0
- package/dist/web/_next/static/chunks/0amcocbojo4v2.js +1 -0
- package/dist/web/_next/static/chunks/0brrgp3ki5w4_.css +17 -0
- package/dist/web/_next/static/chunks/0bzmgi.ynrn.0.css +3 -0
- package/dist/web/_next/static/chunks/0c_vfzf1z7-rt.js +2 -0
- package/dist/web/_next/static/chunks/0cjmfclopcxho.css +1 -0
- package/dist/web/_next/static/chunks/0cs830n97dgjy.js +1 -0
- package/dist/web/_next/static/chunks/0d_dp_4ofz0l3.css +3 -0
- package/dist/web/_next/static/chunks/0dws-faof-ryx.css +13 -0
- package/dist/web/_next/static/chunks/0ejc_zlyocy_r.css +1 -0
- package/dist/web/_next/static/chunks/0esty_4gmxfq3.js +1 -0
- package/dist/web/_next/static/chunks/0evjw7bao5_e~.js +1 -0
- package/dist/web/_next/static/chunks/{0ag4p6m9rze~n.js → 0g-0n6glz_z6w.js} +1 -1
- package/dist/web/_next/static/chunks/{145qu5b0tgm9w.js → 0gig.k.rq8d0x.js} +1 -1
- package/dist/web/_next/static/chunks/0hl_7y464qll6.css +2 -0
- package/dist/web/_next/static/chunks/0hrbuvzuxrjfl.js +1 -0
- package/dist/web/_next/static/chunks/0i_3.3rdsu2mw.js +2 -0
- package/dist/web/_next/static/chunks/0i_gi.kq2dau8.css +1 -0
- package/dist/web/_next/static/chunks/0j00r2f_n-.lx.js +1 -0
- package/dist/web/_next/static/chunks/0jh9xnkimjkyh.js +1 -0
- package/dist/web/_next/static/chunks/0jokpgh485~28.js +167 -0
- package/dist/web/_next/static/chunks/0kvsjgpj7zcb9.css +9 -0
- package/dist/web/_next/static/chunks/0l5ab99s37x5f.js +1 -0
- package/dist/web/_next/static/chunks/0lcc9r.o.p.sc.js +1 -0
- package/dist/web/_next/static/chunks/0lh~x2tf~i1hd.css +2 -0
- package/dist/web/_next/static/chunks/0me8ho8j4tq7_.css +2 -0
- package/dist/web/_next/static/chunks/0mny8i81aenx3.js +1 -0
- package/dist/web/_next/static/chunks/0mt-7av8yrg0o.css +3 -0
- package/dist/web/_next/static/chunks/0njy89g5coeyi.js +60 -0
- package/dist/web/_next/static/chunks/0nsu~f3voe~0i.js +5 -0
- package/dist/web/_next/static/chunks/0ow~co9wcleka.js +173 -0
- package/dist/web/_next/static/chunks/0pldvk5_h__t7.css +3 -0
- package/dist/web/_next/static/chunks/0qad.lgvtlt0b.css +16 -0
- package/dist/web/_next/static/chunks/0qpq0~_58fe9a.js +18 -0
- package/dist/web/_next/static/chunks/{0.335m_d-cd_g.js → 0qtc_rbo1oghu.js} +1 -1
- package/dist/web/_next/static/chunks/0qz5~3wquy~3q.css +2 -0
- package/dist/web/_next/static/chunks/0rv0nj__24y60.js +10 -0
- package/dist/web/_next/static/chunks/{145gbwitjxamg.js → 0sz8_nijfiz0p.js} +1 -1
- package/dist/web/_next/static/chunks/0tvd~rxgf0oh_.js +1 -0
- package/dist/web/_next/static/chunks/0wv0h27jafag4.js +1 -0
- package/dist/web/_next/static/chunks/0wwvc4zc2q6bn.js +1 -0
- package/dist/web/_next/static/chunks/0x4b-a2ixww6m.js +1 -0
- package/dist/web/_next/static/chunks/0z8ipjj2z-3al.css +8 -0
- package/dist/web/_next/static/chunks/0zd1o3u04~qvo.js +127 -0
- package/dist/web/_next/static/chunks/0~2l1-8o4delc.js +1 -0
- package/dist/web/_next/static/chunks/0~w6ugk9s5p-h.css +1 -0
- package/dist/web/_next/static/chunks/10jfi.9fw5g48.js +1 -0
- package/dist/web/_next/static/chunks/11_tltlhc8.sj.js +1 -0
- package/dist/web/_next/static/chunks/125nunjfj2fj0.js +1 -0
- package/dist/web/_next/static/chunks/12md9ajfx2o85.css +1 -0
- package/dist/web/_next/static/chunks/12odetnu-lyrr.js +167 -0
- package/dist/web/_next/static/chunks/12u4g4uzrlten.js +2 -0
- package/dist/web/_next/static/chunks/134ozsnbd~0qw.js +1 -0
- package/dist/web/_next/static/chunks/13ess~4pdmxma.js +1 -0
- package/dist/web/_next/static/chunks/13xfagjq0q~tf.js +1 -0
- package/dist/web/_next/static/chunks/143.pbs8a1ivm.js +1 -0
- package/dist/web/_next/static/chunks/14_y_s_5rhsd1.css +5 -0
- package/dist/web/_next/static/chunks/15hca2.5le07..js +3 -0
- package/dist/web/_next/static/chunks/15rf3~h7sugz4.css +19 -0
- package/dist/web/_next/static/chunks/16i87txo0qh0h.css +6 -0
- package/dist/web/_next/static/chunks/16~udgv7eel6a.css +2 -0
- package/dist/web/_next/static/chunks/{turbopack-0-j2hpomozegf.js → turbopack-000x5q9w-wx10.js} +1 -1
- package/dist/web/_next/static/chunks/{turbopack-0rrhp9pbrv0p3.js → turbopack-0hrx111grzq49.js} +1 -1
- package/dist/web/_next/static/chunks/{turbopack-0_zn00zg5kmqz.js → turbopack-0w-kua.9ymd0x.js} +1 -1
- package/dist/web/_next/static/chunks/{turbopack-0l~pq1hytx49z.js → turbopack-15zqm_4ixj.18.js} +1 -1
- package/dist/web/_next/static/media/code-icon.0g3wskzlr7oxf.svg +1 -0
- package/dist/web/_next/static/media/codicon.0pqe-t5rtghj8.ttf +0 -0
- package/dist/web/_next/static/media/continue-tb.0qei4mru4tzd2.png +0 -0
- package/dist/web/_next/static/media/dark_modern.09.uq6bp373zs.json +1 -0
- package/dist/web/_next/static/media/dark_plus.187umr0~d1_r7.json +1 -0
- package/dist/web/_next/static/media/dark_vs.12ju8ocr7rg--.json +1 -0
- package/dist/web/_next/static/media/document-dark.0vvlbsi_fdy~4.svg +3 -0
- package/dist/web/_next/static/media/document-light.0bfi_yt9e~vk7.svg +3 -0
- package/dist/web/_next/static/media/editor.worker.0ffjdaaj15t6e.js +1 -0
- package/dist/web/_next/static/media/extensionHost.worker.14sz5xf8-1efr.js +2 -0
- package/dist/web/_next/static/media/fake.16yx0-xxqj4pc.html +10 -0
- package/dist/web/_next/static/media/folder-dark.02kdicw3013tb.svg +3 -0
- package/dist/web/_next/static/media/folder-light.0s165k4fp3.53.svg +3 -0
- package/dist/web/_next/static/media/folder-open-dark.0sk6.yh45uqs3.svg +4 -0
- package/dist/web/_next/static/media/folder-open-light.10k1v_ugaq8ic.svg +4 -0
- package/dist/web/_next/static/media/hc_black.0-ul9e2oc5twb.json +1 -0
- package/dist/web/_next/static/media/hc_light.0vi.a7fr.z4gy.json +1 -0
- package/dist/web/_next/static/media/index.0jmafs_mwcjgg.html +1341 -0
- package/dist/web/_next/static/media/keyboard-dark.0t86n~1rrhj2-.svg +10 -0
- package/dist/web/_next/static/media/keyboard-light.0abw0ukjcd9ox.svg +10 -0
- package/dist/web/_next/static/media/letterpress-dark.181s2xkw~lfyo.svg +3 -0
- package/dist/web/_next/static/media/letterpress-hcDark.0ftfw8fess-5y.svg +3 -0
- package/dist/web/_next/static/media/letterpress-hcLight.06x23d0.aixf_.svg +3 -0
- package/dist/web/_next/static/media/letterpress-light.0xb1bapis~iw7.svg +3 -0
- package/dist/web/_next/static/media/light_modern.00ps-apoc9ph7.json +1 -0
- package/dist/web/_next/static/media/light_plus.0ow37ouyuazdz.json +1 -0
- package/dist/web/_next/static/media/light_vs.0fdbve5sxkgq1.json +1 -0
- package/dist/web/_next/static/media/onig.0dk~55st~1x8..wasm +0 -0
- package/dist/web/_next/static/media/opacity-background.0-9.t0ta0ko23.png +0 -0
- package/dist/web/_next/static/media/package.0_p8a~hpmb_uj.json +1 -0
- package/dist/web/_next/static/media/package.nls.0e5hn-g497b64.json +1 -0
- package/dist/web/_next/static/media/pause-tb.0ttrm1r1uuz_c.png +0 -0
- package/dist/web/_next/static/media/restart-tb.086872s_sc2qv.png +0 -0
- package/dist/web/_next/static/media/root-folder-dark.14iwnfb7p2na~.svg +5 -0
- package/dist/web/_next/static/media/root-folder-light.0ljk9fi7sw3.2.svg +5 -0
- package/dist/web/_next/static/media/root-folder-open-dark.08vw3g9zvki33.svg +5 -0
- package/dist/web/_next/static/media/root-folder-open-light.0f46.ahns5c~..svg +5 -0
- package/dist/web/_next/static/media/run-with-debugging-tb.0j1h52k~h~72z.png +0 -0
- package/dist/web/_next/static/media/service-worker.0_udu6mraxn4k.js +543 -0
- package/dist/web/_next/static/media/stepinto-tb.0cl87yt4ub_j8.png +0 -0
- package/dist/web/_next/static/media/stepout-tb.0vjib_bn-_xax.png +0 -0
- package/dist/web/_next/static/media/stepover-tb.04beeu~7cxr4l.png +0 -0
- package/dist/web/_next/static/media/stop-tb.1498tmu97_y9j.png +0 -0
- package/dist/web/_next/static/media/vs_minimal-icon-theme.0-qs73lvw4voi.json +1 -0
- package/dist/web/_next/static/media/webWorkerExtensionHostIframe.0x2r1o97s.m0m.html +156 -0
- package/dist/web/_next/static/media/worker.081j0x4avp1l1.js +2 -0
- package/dist/web/_not-found/__next._full.txt +19 -19
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +13 -13
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +19 -19
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +21 -21
- package/dist/web/login/__next._full.txt +21 -21
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +13 -13
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +21 -21
- package/dist/web/settings/__next._full.txt +23 -23
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +13 -13
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +23 -23
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +13 -13
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +23 -23
- package/dist/web/settings/mcps/__next._full.txt +23 -23
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +13 -13
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +23 -23
- package/dist/web/settings/models/__next._full.txt +23 -23
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +13 -13
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +23 -23
- package/dist/web/settings/prompts/__next._full.txt +42 -0
- package/dist/web/settings/prompts/__next._head.txt +6 -0
- package/dist/web/settings/prompts/__next._index.txt +15 -0
- package/dist/web/settings/prompts/__next._tree.txt +8 -0
- package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +9 -0
- package/dist/web/settings/prompts/__next.settings.prompts.txt +5 -0
- package/dist/web/settings/prompts/__next.settings.txt +7 -0
- package/dist/web/settings/prompts.html +1 -0
- package/dist/web/settings/prompts.txt +42 -0
- package/dist/web/settings/providers/__next._full.txt +23 -23
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +13 -13
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +23 -23
- package/dist/web/settings/skills/__next._full.txt +23 -23
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +13 -13
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +23 -23
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +23 -23
- package/dist/web/workflows/__next._full.txt +21 -21
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +13 -13
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +21 -21
- package/dist/web/workspace/_/__next._full.txt +68 -35
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +13 -13
- package/dist/web/workspace/_/__next._tree.txt +15 -3
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +16 -4
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +68 -35
- package/dist/web/workspaces/__next._full.txt +21 -21
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +13 -13
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +21 -21
- package/dist/ws/agent-runner.js +159 -20
- package/dist/ws/connection-manager.js +13 -0
- package/dist/ws/handler.js +9 -12
- package/dist/ws/message-parts.js +20 -1
- package/dist/ws/terminal-handler.js +28 -7
- package/dist/ws/typescript-lsp.js +78 -0
- package/package.json +5 -1
- package/dist/web/_next/static/chunks/0-a17~4piefz_.js +0 -1
- package/dist/web/_next/static/chunks/0anuxr11yn5iv.js +0 -2
- package/dist/web/_next/static/chunks/0cwvdk55mrt_9.css +0 -1
- package/dist/web/_next/static/chunks/0e.z4v3cd78dx.js +0 -1
- package/dist/web/_next/static/chunks/0egot8y~i-ge3.js +0 -1
- package/dist/web/_next/static/chunks/0gczc8mmde5my.js +0 -1
- package/dist/web/_next/static/chunks/0gtbd3yt7y1gx.js +0 -1
- package/dist/web/_next/static/chunks/0j2w71psq6w9u.js +0 -1
- package/dist/web/_next/static/chunks/0kyv5yika-41a.js +0 -1
- package/dist/web/_next/static/chunks/0lmeh15xwcj0s.js +0 -204
- package/dist/web/_next/static/chunks/0plreh4_gkxf9.js +0 -1
- package/dist/web/_next/static/chunks/0puhc.l_.mc99.js +0 -1
- package/dist/web/_next/static/chunks/0qxk21zejhdbm.js +0 -1
- package/dist/web/_next/static/chunks/0v7nmghv8ieef.js +0 -1
- package/dist/web/_next/static/chunks/0wekj7h15h7z7.js +0 -5
- package/dist/web/_next/static/chunks/14iaqoj9-09g..js +0 -2
- package/dist/web/_next/static/chunks/17oc2l.ekcs8b.css +0 -1
- /package/dist/web/_next/static/{gN3O86ki0NGTvGTqE2Ibh → Pf6ZjtN82szw-ZzU9lITd}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{gN3O86ki0NGTvGTqE2Ibh → Pf6ZjtN82szw-ZzU9lITd}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{gN3O86ki0NGTvGTqE2Ibh → Pf6ZjtN82szw-ZzU9lITd}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
//@ts-check
|
|
6
|
+
/// <reference lib="webworker" />
|
|
7
|
+
|
|
8
|
+
/** @type {ServiceWorkerGlobalScope} */
|
|
9
|
+
const sw = /** @type {any} */ (self);
|
|
10
|
+
|
|
11
|
+
const VERSION = 4;
|
|
12
|
+
|
|
13
|
+
const resourceCacheName = `vscode-resource-cache-${VERSION}`;
|
|
14
|
+
|
|
15
|
+
const rootPath = sw.location.pathname.replace(/\/service-worker.js$/, '');
|
|
16
|
+
|
|
17
|
+
const searchParams = new URL(location.toString()).searchParams;
|
|
18
|
+
|
|
19
|
+
const remoteAuthority = searchParams.get('remoteAuthority');
|
|
20
|
+
|
|
21
|
+
/** @type {MessagePort|undefined} */
|
|
22
|
+
let outerIframeMessagePort;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Origin used for resources
|
|
26
|
+
*/
|
|
27
|
+
const resourceBaseAuthority = searchParams.get('vscode-resource-base-authority');
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} name
|
|
31
|
+
* @param {Record<string, string>} [options]
|
|
32
|
+
*/
|
|
33
|
+
const perfMark = (name, options = {}) => {
|
|
34
|
+
performance.mark(`webview/service-worker/${name}`, {
|
|
35
|
+
detail: {
|
|
36
|
+
...options
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
perfMark('scriptStart');
|
|
42
|
+
|
|
43
|
+
/** @type {number} */
|
|
44
|
+
const resolveTimeout = 30_000;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @template T
|
|
49
|
+
* @typedef {{ status: 'ok', value: T } | { status: 'timeout' }} RequestStoreResult
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @template T
|
|
55
|
+
* @typedef {{ resolve: (x: RequestStoreResult<T>) => void, promise: Promise<RequestStoreResult<T>> }} RequestStoreEntry
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @template T
|
|
61
|
+
*/
|
|
62
|
+
class RequestStore {
|
|
63
|
+
constructor() {
|
|
64
|
+
/** @type {Map<number, RequestStoreEntry<T>>} */
|
|
65
|
+
this.map = new Map();
|
|
66
|
+
/** @type {number} */
|
|
67
|
+
this.requestPool = 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @returns {{ requestId: number, promise: Promise<RequestStoreResult<T>> }}
|
|
72
|
+
*/
|
|
73
|
+
create() {
|
|
74
|
+
const requestId = ++this.requestPool;
|
|
75
|
+
|
|
76
|
+
/** @type {(x: RequestStoreResult<T>) => void} */
|
|
77
|
+
let resolve;
|
|
78
|
+
const promise = new Promise(r => resolve = r);
|
|
79
|
+
|
|
80
|
+
/** @type {RequestStoreEntry<T>} */
|
|
81
|
+
const entry = { resolve, promise };
|
|
82
|
+
this.map.set(requestId, entry);
|
|
83
|
+
|
|
84
|
+
const dispose = () => {
|
|
85
|
+
clearTimeout(timeout);
|
|
86
|
+
const existingEntry = this.map.get(requestId);
|
|
87
|
+
if (existingEntry === entry) {
|
|
88
|
+
existingEntry.resolve({ status: 'timeout' });
|
|
89
|
+
this.map.delete(requestId);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const timeout = setTimeout(dispose, resolveTimeout);
|
|
93
|
+
return { requestId, promise };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @param {number} requestId
|
|
98
|
+
* @param {T} result
|
|
99
|
+
* @returns {boolean}
|
|
100
|
+
*/
|
|
101
|
+
resolve(requestId, result) {
|
|
102
|
+
const entry = this.map.get(requestId);
|
|
103
|
+
if (!entry) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
entry.resolve({ status: 'ok', value: result });
|
|
107
|
+
this.map.delete(requestId);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Map of requested paths to responses.
|
|
114
|
+
*/
|
|
115
|
+
/** @type {RequestStore<ResourceResponse>} */
|
|
116
|
+
const resourceRequestStore = new RequestStore();
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Map of requested localhost origins to optional redirects.
|
|
120
|
+
*/
|
|
121
|
+
/** @type {RequestStore<string|undefined>} */
|
|
122
|
+
const localhostRequestStore = new RequestStore();
|
|
123
|
+
|
|
124
|
+
const unauthorized = () =>
|
|
125
|
+
new Response('Unauthorized', { status: 401, });
|
|
126
|
+
|
|
127
|
+
const notFound = () =>
|
|
128
|
+
new Response('Not Found', { status: 404, });
|
|
129
|
+
|
|
130
|
+
const methodNotAllowed = () =>
|
|
131
|
+
new Response('Method Not Allowed', { status: 405, });
|
|
132
|
+
|
|
133
|
+
const requestTimeout = () =>
|
|
134
|
+
new Response('Request Timeout', { status: 408, });
|
|
135
|
+
|
|
136
|
+
sw.addEventListener('message', async (event) => {
|
|
137
|
+
if (!event.source) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** @type {Client} */
|
|
142
|
+
const source = event.source;
|
|
143
|
+
switch (event.data.channel) {
|
|
144
|
+
case 'version': {
|
|
145
|
+
perfMark('version/request');
|
|
146
|
+
outerIframeMessagePort = event.ports[0];
|
|
147
|
+
sw.clients.get(source.id).then(client => {
|
|
148
|
+
perfMark('version/reply');
|
|
149
|
+
if (client) {
|
|
150
|
+
client.postMessage({
|
|
151
|
+
channel: 'version',
|
|
152
|
+
version: VERSION
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
case 'did-load-resource': {
|
|
159
|
+
/** @type {ResourceResponse} */
|
|
160
|
+
const response = event.data.data;
|
|
161
|
+
if (!resourceRequestStore.resolve(response.id, response)) {
|
|
162
|
+
console.log('Could not resolve unknown resource', response.path);
|
|
163
|
+
}
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
case 'did-load-localhost': {
|
|
167
|
+
const data = event.data.data;
|
|
168
|
+
if (!localhostRequestStore.resolve(data.id, data.location)) {
|
|
169
|
+
console.log('Could not resolve unknown localhost', data.origin);
|
|
170
|
+
}
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
default: {
|
|
174
|
+
console.log('Unknown message');
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
sw.addEventListener('fetch', (event) => {
|
|
181
|
+
const requestUrl = new URL(event.request.url);
|
|
182
|
+
if (typeof resourceBaseAuthority === 'string' && requestUrl.protocol === 'https:' && requestUrl.hostname.endsWith('.' + resourceBaseAuthority)) {
|
|
183
|
+
switch (event.request.method) {
|
|
184
|
+
case 'GET':
|
|
185
|
+
case 'HEAD': {
|
|
186
|
+
const firstHostSegment = requestUrl.hostname.slice(0, requestUrl.hostname.length - (resourceBaseAuthority.length + 1));
|
|
187
|
+
const scheme = firstHostSegment.split('+', 1)[0];
|
|
188
|
+
const authority = firstHostSegment.slice(scheme.length + 1); // may be empty
|
|
189
|
+
return event.respondWith(processResourceRequest(event, {
|
|
190
|
+
scheme,
|
|
191
|
+
authority,
|
|
192
|
+
path: requestUrl.pathname,
|
|
193
|
+
query: requestUrl.search.replace(/^\?/, ''),
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
default: {
|
|
197
|
+
return event.respondWith(methodNotAllowed());
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// If we're making a request against the remote authority, we want to go
|
|
203
|
+
// through VS Code itself so that we are authenticated properly. If the
|
|
204
|
+
// service worker is hosted on the same origin we will have cookies and
|
|
205
|
+
// authentication will not be an issue.
|
|
206
|
+
if (requestUrl.origin !== sw.origin && requestUrl.host === remoteAuthority) {
|
|
207
|
+
switch (event.request.method) {
|
|
208
|
+
case 'GET':
|
|
209
|
+
case 'HEAD': {
|
|
210
|
+
return event.respondWith(processResourceRequest(event, {
|
|
211
|
+
path: requestUrl.pathname,
|
|
212
|
+
scheme: requestUrl.protocol.slice(0, requestUrl.protocol.length - 1),
|
|
213
|
+
authority: requestUrl.host,
|
|
214
|
+
query: requestUrl.search.replace(/^\?/, ''),
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
default: {
|
|
218
|
+
return event.respondWith(methodNotAllowed());
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// See if it's a localhost request
|
|
224
|
+
if (requestUrl.origin !== sw.origin && requestUrl.host.match(/^(localhost|127.0.0.1|0.0.0.0):(\d+)$/)) {
|
|
225
|
+
return event.respondWith(processLocalhostRequest(event, requestUrl));
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
sw.addEventListener('install', (event) => {
|
|
230
|
+
event.waitUntil(sw.skipWaiting()); // Activate worker immediately
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
sw.addEventListener('activate', (event) => {
|
|
234
|
+
event.waitUntil(sw.clients.claim()); // Become available to all pages
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @typedef {Object} ResourceRequestUrlComponents
|
|
240
|
+
* @property {string} scheme
|
|
241
|
+
* @property {string} authority
|
|
242
|
+
* @property {string} path
|
|
243
|
+
* @property {string} query
|
|
244
|
+
*/
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @param {FetchEvent} event
|
|
248
|
+
* @param {ResourceRequestUrlComponents} requestUrlComponents
|
|
249
|
+
* @returns {Promise<Response>}
|
|
250
|
+
*/
|
|
251
|
+
async function processResourceRequest(
|
|
252
|
+
event,
|
|
253
|
+
requestUrlComponents
|
|
254
|
+
) {
|
|
255
|
+
let client = await sw.clients.get(event.clientId);
|
|
256
|
+
if (!client) {
|
|
257
|
+
client = await getWorkerClientForId(event.clientId);
|
|
258
|
+
if (!client) {
|
|
259
|
+
console.error('Could not find inner client for request');
|
|
260
|
+
return notFound();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const webviewId = getWebviewIdForClient(client);
|
|
265
|
+
|
|
266
|
+
// Refs https://github.com/microsoft/vscode/issues/244143
|
|
267
|
+
// With PlzDedicatedWorker, worker subresources and blob wokers
|
|
268
|
+
// will use clients different from the window client.
|
|
269
|
+
// Since we cannot different a worker main resource from a worker subresource
|
|
270
|
+
// we will use message channel to the outer iframe provided at the time
|
|
271
|
+
// of service worker controller version initialization.
|
|
272
|
+
if (!webviewId && client.type !== 'worker' && client.type !== 'sharedworker') {
|
|
273
|
+
console.error('Could not resolve webview id');
|
|
274
|
+
return notFound();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const shouldTryCaching = (event.request.method === 'GET');
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @param {RequestStoreResult<ResourceResponse>} result
|
|
281
|
+
* @param {Response|undefined} cachedResponse
|
|
282
|
+
* @returns {Response}
|
|
283
|
+
*/
|
|
284
|
+
const resolveResourceEntry = (result, cachedResponse) => {
|
|
285
|
+
if (result.status === 'timeout') {
|
|
286
|
+
return requestTimeout();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** @type {Record<string, string>} */
|
|
290
|
+
const accessControlHeaders = {
|
|
291
|
+
'Access-Control-Allow-Origin': '*',
|
|
292
|
+
'Cross-Origin-Resource-Policy': 'cross-origin',
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const entry = result.value;
|
|
296
|
+
if (entry.status === 304) { // Not modified
|
|
297
|
+
if (cachedResponse) {
|
|
298
|
+
const r = cachedResponse.clone();
|
|
299
|
+
for (const [key, value] of Object.entries(accessControlHeaders)) {
|
|
300
|
+
r.headers.set(key, value);
|
|
301
|
+
}
|
|
302
|
+
return r;
|
|
303
|
+
} else {
|
|
304
|
+
throw new Error('No cache found');
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (entry.status === 401) {
|
|
309
|
+
return unauthorized();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (entry.status !== 200) {
|
|
313
|
+
return notFound();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const byteLength = entry.data.byteLength;
|
|
317
|
+
|
|
318
|
+
const range = event.request.headers.get('range');
|
|
319
|
+
if (range) {
|
|
320
|
+
// To support seeking for videos, we need to handle range requests
|
|
321
|
+
const bytes = range.match(/^bytes\=(\d+)\-(\d+)?$/g);
|
|
322
|
+
if (bytes) {
|
|
323
|
+
// TODO: Right now we are always reading the full file content. This is a bad idea
|
|
324
|
+
// for large video files :)
|
|
325
|
+
|
|
326
|
+
const start = Number(bytes[1]);
|
|
327
|
+
const end = Number(bytes[2]) || byteLength - 1;
|
|
328
|
+
return new Response(entry.data.slice(start, end + 1), {
|
|
329
|
+
status: 206,
|
|
330
|
+
headers: {
|
|
331
|
+
...accessControlHeaders,
|
|
332
|
+
'Content-range': `bytes 0-${end}/${byteLength}`,
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
} else {
|
|
336
|
+
// We don't understand the requested bytes
|
|
337
|
+
return new Response(null, {
|
|
338
|
+
status: 416,
|
|
339
|
+
headers: {
|
|
340
|
+
...accessControlHeaders,
|
|
341
|
+
'Content-range': `*/${byteLength}`
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** @type {Record<string, string>} */
|
|
348
|
+
const headers = {
|
|
349
|
+
...accessControlHeaders,
|
|
350
|
+
'Content-Type': entry.mime,
|
|
351
|
+
'Content-Length': byteLength.toString(),
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
if (entry.etag) {
|
|
355
|
+
headers['ETag'] = entry.etag;
|
|
356
|
+
headers['Cache-Control'] = 'no-cache';
|
|
357
|
+
}
|
|
358
|
+
if (entry.mtime) {
|
|
359
|
+
headers['Last-Modified'] = new Date(entry.mtime).toUTCString();
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// support COI requests, see network.ts#COI.getHeadersFromQuery(...)
|
|
363
|
+
const coiRequest = new URL(event.request.url).searchParams.get('vscode-coi');
|
|
364
|
+
if (coiRequest === '3') {
|
|
365
|
+
headers['Cross-Origin-Opener-Policy'] = 'same-origin';
|
|
366
|
+
headers['Cross-Origin-Embedder-Policy'] = 'require-corp';
|
|
367
|
+
} else if (coiRequest === '2') {
|
|
368
|
+
headers['Cross-Origin-Embedder-Policy'] = 'require-corp';
|
|
369
|
+
} else if (coiRequest === '1') {
|
|
370
|
+
headers['Cross-Origin-Opener-Policy'] = 'same-origin';
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const response = new Response(entry.data, {
|
|
374
|
+
status: 200,
|
|
375
|
+
headers
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
if (shouldTryCaching && entry.etag) {
|
|
379
|
+
caches.open(resourceCacheName).then(cache => {
|
|
380
|
+
return cache.put(event.request, response);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return response.clone();
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
/** @type {Response|undefined} */
|
|
387
|
+
let cached;
|
|
388
|
+
if (shouldTryCaching) {
|
|
389
|
+
const cache = await caches.open(resourceCacheName);
|
|
390
|
+
cached = await cache.match(event.request);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const { requestId, promise } = resourceRequestStore.create();
|
|
394
|
+
|
|
395
|
+
if (webviewId) {
|
|
396
|
+
const parentClients = await getOuterIframeClient(webviewId);
|
|
397
|
+
if (!parentClients.length) {
|
|
398
|
+
console.log('Could not find parent client for request');
|
|
399
|
+
return notFound();
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
for (const parentClient of parentClients) {
|
|
403
|
+
parentClient.postMessage({
|
|
404
|
+
channel: 'load-resource',
|
|
405
|
+
id: requestId,
|
|
406
|
+
scheme: requestUrlComponents.scheme,
|
|
407
|
+
authority: requestUrlComponents.authority,
|
|
408
|
+
path: requestUrlComponents.path,
|
|
409
|
+
query: requestUrlComponents.query,
|
|
410
|
+
ifNoneMatch: cached?.headers.get('ETag'),
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
} else if (client.type === 'worker' || client.type === 'sharedworker') {
|
|
414
|
+
outerIframeMessagePort?.postMessage({
|
|
415
|
+
channel: 'load-resource',
|
|
416
|
+
id: requestId,
|
|
417
|
+
scheme: requestUrlComponents.scheme,
|
|
418
|
+
authority: requestUrlComponents.authority,
|
|
419
|
+
path: requestUrlComponents.path,
|
|
420
|
+
query: requestUrlComponents.query,
|
|
421
|
+
ifNoneMatch: cached?.headers.get('ETag'),
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return promise.then(entry => resolveResourceEntry(entry, cached));
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* @param {FetchEvent} event
|
|
430
|
+
* @param {URL} requestUrl
|
|
431
|
+
* @returns {Promise<Response>}
|
|
432
|
+
*/
|
|
433
|
+
async function processLocalhostRequest(
|
|
434
|
+
event,
|
|
435
|
+
requestUrl
|
|
436
|
+
) {
|
|
437
|
+
const client = await sw.clients.get(event.clientId);
|
|
438
|
+
if (!client) {
|
|
439
|
+
// This is expected when requesting resources on other localhost ports
|
|
440
|
+
// that are not spawned by vs code
|
|
441
|
+
return fetch(event.request);
|
|
442
|
+
}
|
|
443
|
+
const webviewId = getWebviewIdForClient(client);
|
|
444
|
+
// Refs https://github.com/microsoft/vscode/issues/244143
|
|
445
|
+
// With PlzDedicatedWorker, worker subresources and blob wokers
|
|
446
|
+
// will use clients different from the window client.
|
|
447
|
+
// Since we cannot different a worker main resource from a worker subresource
|
|
448
|
+
// we will use message channel to the outer iframe provided at the time
|
|
449
|
+
// of service worker controller version initialization.
|
|
450
|
+
if (!webviewId && client.type !== 'worker' && client.type !== 'sharedworker') {
|
|
451
|
+
console.error('Could not resolve webview id');
|
|
452
|
+
return fetch(event.request);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const origin = requestUrl.origin;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* @param {RequestStoreResult<string|undefined>} result
|
|
459
|
+
* @returns {Promise<Response>}
|
|
460
|
+
*/
|
|
461
|
+
const resolveRedirect = async function (result) {
|
|
462
|
+
if (result.status !== 'ok' || !result.value) {
|
|
463
|
+
return fetch(event.request);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
const redirectOrigin = result.value;
|
|
467
|
+
const location = event.request.url.replace(new RegExp(`^${requestUrl.origin}(/|$)`), `${redirectOrigin}$1`);
|
|
468
|
+
return new Response(null, {
|
|
469
|
+
status: 302,
|
|
470
|
+
headers: {
|
|
471
|
+
Location: location
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
const { requestId, promise } = localhostRequestStore.create();
|
|
477
|
+
if (webviewId) {
|
|
478
|
+
const parentClients = await getOuterIframeClient(webviewId);
|
|
479
|
+
if (!parentClients.length) {
|
|
480
|
+
console.log('Could not find parent client for request');
|
|
481
|
+
return notFound();
|
|
482
|
+
}
|
|
483
|
+
for (const parentClient of parentClients) {
|
|
484
|
+
parentClient.postMessage({
|
|
485
|
+
channel: 'load-localhost',
|
|
486
|
+
origin: origin,
|
|
487
|
+
id: requestId,
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
} else if (client.type === 'worker' || client.type === 'sharedworker') {
|
|
491
|
+
outerIframeMessagePort?.postMessage({
|
|
492
|
+
channel: 'load-localhost',
|
|
493
|
+
origin: origin,
|
|
494
|
+
id: requestId,
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
return promise.then(resolveRedirect);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* @param {Client} client
|
|
503
|
+
* @returns {string|null}
|
|
504
|
+
*/
|
|
505
|
+
function getWebviewIdForClient(client) {
|
|
506
|
+
const requesterClientUrl = new URL(client.url);
|
|
507
|
+
return requesterClientUrl.searchParams.get('id');
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* @param {string} webviewId
|
|
512
|
+
* @returns {Promise<Client[]>}
|
|
513
|
+
*/
|
|
514
|
+
async function getOuterIframeClient(webviewId) {
|
|
515
|
+
const allClients = await sw.clients.matchAll({ includeUncontrolled: true });
|
|
516
|
+
return allClients.filter(client => {
|
|
517
|
+
const clientUrl = new URL(client.url);
|
|
518
|
+
return clientUrl.searchParams.get('id') === webviewId;
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @param {string} clientId
|
|
524
|
+
* @returns {Promise<Client|undefined>}
|
|
525
|
+
*/
|
|
526
|
+
async function getWorkerClientForId(clientId) {
|
|
527
|
+
const allDedicatedWorkerClients = await sw.clients.matchAll({ type: 'worker' });
|
|
528
|
+
const allSharedWorkerClients = await sw.clients.matchAll({ type: 'sharedworker' });
|
|
529
|
+
const allWorkerClients = [...allDedicatedWorkerClients, ...allSharedWorkerClients];
|
|
530
|
+
return allWorkerClients.find(client => {
|
|
531
|
+
return client.id === clientId;
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* @typedef {(
|
|
538
|
+
* | { readonly status: 200, id: number, path: string, mime: string, data: Uint8Array, etag: string|undefined, mtime: number|undefined }
|
|
539
|
+
* | { readonly status: 304, id: number, path: string, mime: string, mtime: number|undefined }
|
|
540
|
+
* | { readonly status: 401, id: number, path: string }
|
|
541
|
+
* | { readonly status: 404, id: number, path: string }
|
|
542
|
+
* )} ResourceResponse
|
|
543
|
+
*/
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"iconDefinitions":{"_root_folder_dark":{"iconPath":"./images/root-folder-dark.svg"},"_root_folder_open_dark":{"iconPath":"./images/root-folder-open-dark.svg"},"_folder_dark":{"iconPath":"./images/folder-dark.svg"},"_folder_open_dark":{"iconPath":"./images/folder-open-dark.svg"},"_file_dark":{"iconPath":"./images/document-dark.svg"},"_root_folder":{"iconPath":"./images/root-folder-light.svg"},"_root_folder_open":{"iconPath":"./images/root-folder-open-light.svg"},"_folder_light":{"iconPath":"./images/folder-light.svg"},"_folder_open_light":{"iconPath":"./images/folder-open-light.svg"},"_file_light":{"iconPath":"./images/document-light.svg"}},"folderExpanded":"_folder_open_dark","folder":"_folder_dark","file":"_file_dark","rootFolderExpanded":"_root_folder_open_dark","rootFolder":"_root_folder_dark","fileExtensions":{},"fileNames":{},"languageIds":{},"light":{"folderExpanded":"_folder_open_light","folder":"_folder_light","rootFolderExpanded":"_root_folder_open","rootFolder":"_root_folder","file":"_file_light","fileExtensions":{},"fileNames":{},"languageIds":{}},"highContrast":{}}
|