@thevinci/web 1.0.0
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 +197 -0
- package/bin/cli-entry.js +55 -0
- package/bin/cli-output.js +145 -0
- package/bin/cli.js +4887 -0
- package/bin/cli.test.js +64 -0
- package/dist/apple-touch-icon-120x120.png +0 -0
- package/dist/apple-touch-icon-152x152.png +0 -0
- package/dist/apple-touch-icon-167x167.png +0 -0
- package/dist/apple-touch-icon-180x180.png +0 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/apple-touch-icon.svg +528 -0
- package/dist/assets/JsonTreeView-CSm9OzXG.js +1 -0
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/MarkdownRendererImpl-DensKOLc.js +6 -0
- package/dist/assets/MultiRunWindow-Bo7THayo.js +1 -0
- package/dist/assets/OnboardingScreen-BDqmzTVR.js +2 -0
- package/dist/assets/SettingsWindow-coz__Ykw.js +1 -0
- package/dist/assets/TerminalView-DrZ-i3Dr.js +1 -0
- package/dist/assets/ToolOutputDialog-Eglzslt3.js +16 -0
- package/dist/assets/es-4o9ciP61.js +15 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/dist/assets/index-DLTDToSP.css +1 -0
- package/dist/assets/index-DgiFEKGN.js +1 -0
- package/dist/assets/ko-B20imCHE.js +15 -0
- package/dist/assets/main-BV3KOtdA.css +1 -0
- package/dist/assets/main-CDKJj0sH.js +226 -0
- package/dist/assets/main-LC-PSNVM.js +2 -0
- package/dist/assets/miniChat-CQUiG_cr.js +2 -0
- package/dist/assets/modelPrefsAutoSave-Dm799vzR.js +6986 -0
- package/dist/assets/pl-DQJ7LSzj.js +15 -0
- package/dist/assets/pt-BR-OmjHUz9y.js +15 -0
- package/dist/assets/renderElectronMiniChatApp-CARbeW0G.js +2 -0
- package/dist/assets/uk-BNFxOlO4.js +15 -0
- package/dist/assets/vendor--DBfsbEis.css +1 -0
- package/dist/assets/vendor-.bun-B9l0ZNi2.js +4094 -0
- package/dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/assets/wasmSttWorker-Dtlxac_K.js +1 -0
- package/dist/assets/wasmSttWorker-oo7Dm_jy.js +1806 -0
- package/dist/assets/worker-CbT6TVo7.js +155 -0
- package/dist/assets/zh-CN-C6T-Ac7F.js +15 -0
- package/dist/favicon-16.png +0 -0
- package/dist/favicon-32.png +0 -0
- package/dist/favicon.png +0 -0
- package/dist/favicon.svg +528 -0
- package/dist/index.html +607 -0
- package/dist/logo-dark-192x192.png +0 -0
- package/dist/logo-dark-512x512.png +0 -0
- package/dist/logo-dark-512x512.svg +528 -0
- package/dist/logo-light-192x192.png +0 -0
- package/dist/logo-light-512x512.png +0 -0
- package/dist/logo-light-512x512.svg +528 -0
- package/dist/mini-chat.html +16 -0
- package/dist/pwa-192.png +0 -0
- package/dist/pwa-512.png +0 -0
- package/dist/pwa-maskable-192.png +0 -0
- package/dist/pwa-maskable-512.png +0 -0
- package/dist/site.webmanifest +21 -0
- package/dist/sw.js +1 -0
- package/package.json +118 -0
- package/public/apple-touch-icon-120x120.png +0 -0
- package/public/apple-touch-icon-152x152.png +0 -0
- package/public/apple-touch-icon-167x167.png +0 -0
- package/public/apple-touch-icon-180x180.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/apple-touch-icon.svg +528 -0
- package/public/favicon-16.png +0 -0
- package/public/favicon-32.png +0 -0
- package/public/favicon.png +0 -0
- package/public/favicon.svg +528 -0
- package/public/logo-dark-192x192.png +0 -0
- package/public/logo-dark-512x512.png +0 -0
- package/public/logo-dark-512x512.svg +528 -0
- package/public/logo-light-192x192.png +0 -0
- package/public/logo-light-512x512.png +0 -0
- package/public/logo-light-512x512.svg +528 -0
- package/public/pwa-192.png +0 -0
- package/public/pwa-512.png +0 -0
- package/public/pwa-maskable-192.png +0 -0
- package/public/pwa-maskable-512.png +0 -0
- package/public/site.webmanifest +21 -0
- package/server/TERMINAL_WS_PROTOCOL.md +48 -0
- package/server/index.d.ts +39 -0
- package/server/index.js +1311 -0
- package/server/lib/cloudflare-tunnel.js +650 -0
- package/server/lib/event-stream/DOCUMENTATION.md +61 -0
- package/server/lib/event-stream/directory-ws-bridge.js +185 -0
- package/server/lib/event-stream/global-hub.js +158 -0
- package/server/lib/event-stream/global-hub.test.js +140 -0
- package/server/lib/event-stream/global-ws-bridge.js +206 -0
- package/server/lib/event-stream/index.js +25 -0
- package/server/lib/event-stream/protocol.js +131 -0
- package/server/lib/event-stream/protocol.test.js +182 -0
- package/server/lib/event-stream/runtime.js +180 -0
- package/server/lib/event-stream/runtime.test.js +512 -0
- package/server/lib/event-stream/upstream-reader.js +226 -0
- package/server/lib/event-stream/upstream-reader.test.js +276 -0
- package/server/lib/fs/DOCUMENTATION.md +36 -0
- package/server/lib/fs/routes.js +1040 -0
- package/server/lib/fs/search.js +238 -0
- package/server/lib/git/DOCUMENTATION.md +152 -0
- package/server/lib/git/credentials.js +74 -0
- package/server/lib/git/identity-storage.js +112 -0
- package/server/lib/git/index.js +6 -0
- package/server/lib/git/routes.js +972 -0
- package/server/lib/git/service.js +3432 -0
- package/server/lib/git/service.test.js +39 -0
- package/server/lib/github/DOCUMENTATION.md +171 -0
- package/server/lib/github/auth.js +307 -0
- package/server/lib/github/device-flow.js +50 -0
- package/server/lib/github/index.js +24 -0
- package/server/lib/github/octokit.js +10 -0
- package/server/lib/github/pr-status.js +519 -0
- package/server/lib/github/repo/fork-detection.js +102 -0
- package/server/lib/github/repo/index.js +55 -0
- package/server/lib/github/routes.js +1560 -0
- package/server/lib/magic-prompts/routes.js +63 -0
- package/server/lib/magic-prompts/runtime.js +119 -0
- package/server/lib/notifications/DOCUMENTATION.md +122 -0
- package/server/lib/notifications/emitter-runtime.js +102 -0
- package/server/lib/notifications/index.js +4 -0
- package/server/lib/notifications/message.js +52 -0
- package/server/lib/notifications/message.test.js +34 -0
- package/server/lib/notifications/push-runtime.js +304 -0
- package/server/lib/notifications/routes.js +315 -0
- package/server/lib/notifications/runtime.js +566 -0
- package/server/lib/notifications/template-runtime.js +349 -0
- package/server/lib/notifications/template-runtime.test.js +26 -0
- package/server/lib/opencode/DOCUMENTATION.md +362 -0
- package/server/lib/opencode/agents.js +634 -0
- package/server/lib/opencode/auth-state-runtime.js +88 -0
- package/server/lib/opencode/auth.js +83 -0
- package/server/lib/opencode/bootstrap-runtime.js +131 -0
- package/server/lib/opencode/cli-entry-runtime.js +43 -0
- package/server/lib/opencode/cli-options.js +128 -0
- package/server/lib/opencode/commands.js +339 -0
- package/server/lib/opencode/config-entity-routes.js +370 -0
- package/server/lib/opencode/core-routes.js +500 -0
- package/server/lib/opencode/core-routes.test.js +26 -0
- package/server/lib/opencode/env-config.js +74 -0
- package/server/lib/opencode/env-keys.js +68 -0
- package/server/lib/opencode/env-runtime.js +1162 -0
- package/server/lib/opencode/env-runtime.test.js +116 -0
- package/server/lib/opencode/feature-routes-runtime.js +244 -0
- package/server/lib/opencode/hmr-state-runtime.js +85 -0
- package/server/lib/opencode/index.js +66 -0
- package/server/lib/opencode/lifecycle.js +1019 -0
- package/server/lib/opencode/lifecycle.test.js +240 -0
- package/server/lib/opencode/mcp.js +278 -0
- package/server/lib/opencode/network-runtime.js +104 -0
- package/server/lib/opencode/network-runtime.test.js +37 -0
- package/server/lib/opencode/opencode-resolution-runtime.js +71 -0
- package/server/lib/opencode/path-utils.js +100 -0
- package/server/lib/opencode/path-utils.test.js +71 -0
- package/server/lib/opencode/project-directory-runtime.js +124 -0
- package/server/lib/opencode/project-icon-routes.js +399 -0
- package/server/lib/opencode/project-icon-routes.test.js +107 -0
- package/server/lib/opencode/providers.js +96 -0
- package/server/lib/opencode/proxy.js +445 -0
- package/server/lib/opencode/pwa-manifest-routes.js +257 -0
- package/server/lib/opencode/pwa-manifest-routes.test.js +133 -0
- package/server/lib/opencode/routes.js +541 -0
- package/server/lib/opencode/server-startup-runtime.js +156 -0
- package/server/lib/opencode/server-utils-runtime.js +168 -0
- package/server/lib/opencode/server-utils-runtime.test.js +135 -0
- package/server/lib/opencode/session-runtime.js +356 -0
- package/server/lib/opencode/session-runtime.test.js +151 -0
- package/server/lib/opencode/settings-helpers.js +770 -0
- package/server/lib/opencode/settings-helpers.test.js +109 -0
- package/server/lib/opencode/settings-normalization-runtime.js +428 -0
- package/server/lib/opencode/settings-runtime.js +826 -0
- package/server/lib/opencode/settings-runtime.test.js +85 -0
- package/server/lib/opencode/shared.js +615 -0
- package/server/lib/opencode/shutdown-runtime.js +139 -0
- package/server/lib/opencode/shutdown-runtime.test.js +58 -0
- package/server/lib/opencode/skill-routes.js +701 -0
- package/server/lib/opencode/skills.js +548 -0
- package/server/lib/opencode/startup-pipeline-runtime.js +130 -0
- package/server/lib/opencode/static-routes-runtime.js +65 -0
- package/server/lib/opencode/theme-runtime.js +167 -0
- package/server/lib/opencode/tunnel-auth.js +591 -0
- package/server/lib/opencode/tunnel-wiring-runtime.js +94 -0
- package/server/lib/opencode/vinci-routes.js +76 -0
- package/server/lib/opencode/watcher.js +115 -0
- package/server/lib/opencode/watcher.test.js +239 -0
- package/server/lib/preview/proxy-runtime.js +1333 -0
- package/server/lib/preview/proxy-runtime.test.js +144 -0
- package/server/lib/projects/project-config.js +567 -0
- package/server/lib/projects/project-config.test.js +175 -0
- package/server/lib/projects/project-id.js +13 -0
- package/server/lib/quota/DOCUMENTATION.md +58 -0
- package/server/lib/quota/index.js +25 -0
- package/server/lib/quota/providers/claude.js +107 -0
- package/server/lib/quota/providers/codex.js +113 -0
- package/server/lib/quota/providers/copilot.js +165 -0
- package/server/lib/quota/providers/google/api.js +92 -0
- package/server/lib/quota/providers/google/auth.js +108 -0
- package/server/lib/quota/providers/google/index.js +124 -0
- package/server/lib/quota/providers/google/transforms.js +109 -0
- package/server/lib/quota/providers/index.js +168 -0
- package/server/lib/quota/providers/interface.js +55 -0
- package/server/lib/quota/providers/kimi.js +108 -0
- package/server/lib/quota/providers/minimax-cn-coding-plan.js +140 -0
- package/server/lib/quota/providers/minimax-coding-plan.js +139 -0
- package/server/lib/quota/providers/nanogpt.js +124 -0
- package/server/lib/quota/providers/ollama-cloud.js +112 -0
- package/server/lib/quota/providers/openai.js +91 -0
- package/server/lib/quota/providers/openrouter.js +92 -0
- package/server/lib/quota/providers/zai.js +91 -0
- package/server/lib/quota/providers/zhipuai-coding-plan.js +133 -0
- package/server/lib/quota/providers/zhipuai.js +114 -0
- package/server/lib/quota/routes.js +27 -0
- package/server/lib/quota/utils/auth.js +50 -0
- package/server/lib/quota/utils/formatters.js +85 -0
- package/server/lib/quota/utils/formatters.test.js +54 -0
- package/server/lib/quota/utils/index.js +10 -0
- package/server/lib/quota/utils/transformers.js +55 -0
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +44 -0
- package/server/lib/scheduled-tasks/routes.js +235 -0
- package/server/lib/scheduled-tasks/runtime.js +773 -0
- package/server/lib/scheduled-tasks/runtime.test.js +100 -0
- package/server/lib/security/request-security.js +115 -0
- package/server/lib/session-folders/routes.js +63 -0
- package/server/lib/session-folders/routes.test.js +102 -0
- package/server/lib/skills-catalog/DOCUMENTATION.md +178 -0
- package/server/lib/skills-catalog/cache.js +29 -0
- package/server/lib/skills-catalog/clawdhub/api.js +158 -0
- package/server/lib/skills-catalog/clawdhub/index.js +30 -0
- package/server/lib/skills-catalog/clawdhub/install.js +238 -0
- package/server/lib/skills-catalog/clawdhub/scan.js +113 -0
- package/server/lib/skills-catalog/curated-sources.js +21 -0
- package/server/lib/skills-catalog/git.js +77 -0
- package/server/lib/skills-catalog/index.js +42 -0
- package/server/lib/skills-catalog/install.js +294 -0
- package/server/lib/skills-catalog/scan.js +221 -0
- package/server/lib/skills-catalog/source.js +87 -0
- package/server/lib/terminal/DOCUMENTATION.md +76 -0
- package/server/lib/terminal/index.js +31 -0
- package/server/lib/terminal/output-replay-buffer.js +78 -0
- package/server/lib/terminal/output-replay-buffer.test.js +75 -0
- package/server/lib/terminal/runtime.js +850 -0
- package/server/lib/terminal/runtime.test.js +96 -0
- package/server/lib/terminal/terminal-ws-protocol.js +68 -0
- package/server/lib/terminal/terminal-ws-protocol.test.js +145 -0
- package/server/lib/text/DOCUMENTATION.md +35 -0
- package/server/lib/text/summarization.js +138 -0
- package/server/lib/text/summarization.test.js +34 -0
- package/server/lib/tts/DOCUMENTATION.md +146 -0
- package/server/lib/tts/base-url.js +62 -0
- package/server/lib/tts/capability-runtime.js +31 -0
- package/server/lib/tts/index.js +19 -0
- package/server/lib/tts/routes.js +261 -0
- package/server/lib/tts/routes.test.js +53 -0
- package/server/lib/tts/service.js +178 -0
- package/server/lib/tts/stt.js +75 -0
- package/server/lib/tunnels/DOCUMENTATION.md +18 -0
- package/server/lib/tunnels/index.js +166 -0
- package/server/lib/tunnels/managed-config.js +201 -0
- package/server/lib/tunnels/providers/cloudflare.js +260 -0
- package/server/lib/tunnels/registry.js +51 -0
- package/server/lib/tunnels/routes.js +605 -0
- package/server/lib/tunnels/types.js +219 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +38 -0
- package/server/lib/ui-auth/ui-auth.js +673 -0
- package/server/lib/ui-auth/ui-passkeys.js +545 -0
- package/server/opencode-proxy.test.js +151 -0
- package/server/proxy-headers.js +61 -0
- package/server/proxy-headers.test.js +58 -0
- package/server/sse-routes.test.js +152 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { parseSseEventEnvelope } from './protocol.js';
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_UPSTREAM_STALL_TIMEOUT_MS = 20_000;
|
|
4
|
+
export const UPSTREAM_STALL_TIMEOUT_CONCURRENT_MS = DEFAULT_UPSTREAM_STALL_TIMEOUT_MS * 3;
|
|
5
|
+
export const DEFAULT_UPSTREAM_RECONNECT_DELAY_MS = 250;
|
|
6
|
+
|
|
7
|
+
function resolveTimeoutMs(value, fallback) {
|
|
8
|
+
const resolved = typeof value === 'function' ? value() : value;
|
|
9
|
+
return Number.isFinite(resolved) ? resolved : fallback;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function waitForReconnectDelay(ms, signal) {
|
|
13
|
+
if (signal?.aborted) {
|
|
14
|
+
return Promise.resolve();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
let settled = false;
|
|
19
|
+
const finish = () => {
|
|
20
|
+
if (settled) return;
|
|
21
|
+
settled = true;
|
|
22
|
+
signal?.removeEventListener('abort', onAbort);
|
|
23
|
+
resolve();
|
|
24
|
+
};
|
|
25
|
+
const timeout = setTimeout(finish, Math.max(0, ms));
|
|
26
|
+
const onAbort = () => {
|
|
27
|
+
clearTimeout(timeout);
|
|
28
|
+
finish();
|
|
29
|
+
};
|
|
30
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function normalizeHeaders(headers) {
|
|
35
|
+
if (!headers || typeof headers !== 'object') {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return { ...headers };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function cancelResponseBody(response) {
|
|
43
|
+
if (response?.body && typeof response.body.cancel === 'function') {
|
|
44
|
+
await response.body.cancel().catch(() => {});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function createUpstreamSseReader({
|
|
49
|
+
buildUrl,
|
|
50
|
+
getHeaders = () => ({}),
|
|
51
|
+
fetchImpl = fetch,
|
|
52
|
+
parseBlock = parseSseEventEnvelope,
|
|
53
|
+
initialLastEventId = '',
|
|
54
|
+
signal,
|
|
55
|
+
stallTimeoutMs = DEFAULT_UPSTREAM_STALL_TIMEOUT_MS,
|
|
56
|
+
reconnectDelayMs = DEFAULT_UPSTREAM_RECONNECT_DELAY_MS,
|
|
57
|
+
onEvent,
|
|
58
|
+
onConnect,
|
|
59
|
+
onDisconnect,
|
|
60
|
+
onError,
|
|
61
|
+
}) {
|
|
62
|
+
let running = null;
|
|
63
|
+
let stopped = false;
|
|
64
|
+
let activeController = null;
|
|
65
|
+
let lastEventId = typeof initialLastEventId === 'string' ? initialLastEventId : '';
|
|
66
|
+
|
|
67
|
+
const stop = () => {
|
|
68
|
+
stopped = true;
|
|
69
|
+
if (activeController && !activeController.signal.aborted) {
|
|
70
|
+
activeController.abort();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
signal?.addEventListener('abort', stop, { once: true });
|
|
75
|
+
|
|
76
|
+
const start = () => {
|
|
77
|
+
if (running) {
|
|
78
|
+
return running;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
stopped = false;
|
|
82
|
+
running = (async () => {
|
|
83
|
+
while (!stopped && !signal?.aborted) {
|
|
84
|
+
const controller = new AbortController();
|
|
85
|
+
activeController = controller;
|
|
86
|
+
const abortActive = () => controller.abort();
|
|
87
|
+
signal?.addEventListener('abort', abortActive, { once: true });
|
|
88
|
+
|
|
89
|
+
let abortReason = null;
|
|
90
|
+
let stallTimer = null;
|
|
91
|
+
const clearStallTimer = () => {
|
|
92
|
+
if (stallTimer) {
|
|
93
|
+
clearTimeout(stallTimer);
|
|
94
|
+
stallTimer = null;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const resetStallTimer = () => {
|
|
98
|
+
clearStallTimer();
|
|
99
|
+
const currentStallTimeoutMs = resolveTimeoutMs(stallTimeoutMs, DEFAULT_UPSTREAM_STALL_TIMEOUT_MS);
|
|
100
|
+
if (currentStallTimeoutMs <= 0) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
stallTimer = setTimeout(() => {
|
|
105
|
+
abortReason = 'upstream_stalled';
|
|
106
|
+
controller.abort();
|
|
107
|
+
}, currentStallTimeoutMs);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
const url = buildUrl();
|
|
112
|
+
const headers = {
|
|
113
|
+
Accept: 'text/event-stream',
|
|
114
|
+
'Cache-Control': 'no-cache',
|
|
115
|
+
Connection: 'keep-alive',
|
|
116
|
+
...normalizeHeaders(getHeaders()),
|
|
117
|
+
};
|
|
118
|
+
if (lastEventId) {
|
|
119
|
+
headers['Last-Event-ID'] = lastEventId;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const response = await fetchImpl(url.toString(), {
|
|
123
|
+
headers,
|
|
124
|
+
signal: controller.signal,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
if (!response?.ok || !response.body) {
|
|
128
|
+
onError?.({
|
|
129
|
+
type: 'upstream_unavailable',
|
|
130
|
+
status: response?.status ?? 0,
|
|
131
|
+
response,
|
|
132
|
+
});
|
|
133
|
+
await cancelResponseBody(response);
|
|
134
|
+
await waitForReconnectDelay(reconnectDelayMs, signal);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
onConnect?.({ response, lastEventId });
|
|
139
|
+
|
|
140
|
+
const decoder = new TextDecoder();
|
|
141
|
+
const reader = response.body.getReader();
|
|
142
|
+
let buffer = '';
|
|
143
|
+
|
|
144
|
+
resetStallTimer();
|
|
145
|
+
|
|
146
|
+
while (!stopped && !signal?.aborted) {
|
|
147
|
+
const { value, done } = await reader.read();
|
|
148
|
+
if (done) {
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
resetStallTimer();
|
|
153
|
+
buffer += decoder.decode(value, { stream: true }).replace(/\r\n/g, '\n');
|
|
154
|
+
|
|
155
|
+
let separatorIndex = buffer.indexOf('\n\n');
|
|
156
|
+
while (separatorIndex !== -1 && !stopped && !signal?.aborted) {
|
|
157
|
+
const block = buffer.slice(0, separatorIndex);
|
|
158
|
+
buffer = buffer.slice(separatorIndex + 2);
|
|
159
|
+
const envelope = parseBlock(block);
|
|
160
|
+
if (envelope?.payload) {
|
|
161
|
+
if (typeof envelope.eventId === 'string' && envelope.eventId.length > 0) {
|
|
162
|
+
lastEventId = envelope.eventId;
|
|
163
|
+
}
|
|
164
|
+
onEvent?.({
|
|
165
|
+
block,
|
|
166
|
+
envelope,
|
|
167
|
+
payload: envelope.payload,
|
|
168
|
+
eventId: envelope.eventId,
|
|
169
|
+
directory: envelope.directory,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
separatorIndex = buffer.indexOf('\n\n');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (!stopped && !signal?.aborted && buffer.trim().length > 0) {
|
|
177
|
+
const block = buffer.trim();
|
|
178
|
+
const envelope = parseBlock(block);
|
|
179
|
+
if (envelope?.payload) {
|
|
180
|
+
if (typeof envelope.eventId === 'string' && envelope.eventId.length > 0) {
|
|
181
|
+
lastEventId = envelope.eventId;
|
|
182
|
+
}
|
|
183
|
+
onEvent?.({
|
|
184
|
+
block,
|
|
185
|
+
envelope,
|
|
186
|
+
payload: envelope.payload,
|
|
187
|
+
eventId: envelope.eventId,
|
|
188
|
+
directory: envelope.directory,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} catch (error) {
|
|
193
|
+
if (!stopped && !signal?.aborted && abortReason !== 'upstream_stalled') {
|
|
194
|
+
onError?.({
|
|
195
|
+
type: 'stream_error',
|
|
196
|
+
error,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
} finally {
|
|
200
|
+
clearStallTimer();
|
|
201
|
+
signal?.removeEventListener('abort', abortActive);
|
|
202
|
+
if (activeController === controller) {
|
|
203
|
+
activeController = null;
|
|
204
|
+
}
|
|
205
|
+
onDisconnect?.({ reason: abortReason ?? (stopped || signal?.aborted ? 'stopped' : 'closed') });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!stopped && !signal?.aborted) {
|
|
209
|
+
await waitForReconnectDelay(reconnectDelayMs, signal);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
})().finally(() => {
|
|
213
|
+
running = null;
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
return running;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
return {
|
|
220
|
+
start,
|
|
221
|
+
stop,
|
|
222
|
+
getLastEventId() {
|
|
223
|
+
return lastEventId;
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { createUpstreamSseReader } from './upstream-reader.js';
|
|
4
|
+
|
|
5
|
+
function createSseResponse({ blocks = [], signal, holdOpen = false }) {
|
|
6
|
+
const encoder = new TextEncoder();
|
|
7
|
+
let index = 0;
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
ok: true,
|
|
11
|
+
status: 200,
|
|
12
|
+
body: {
|
|
13
|
+
getReader() {
|
|
14
|
+
return {
|
|
15
|
+
async read() {
|
|
16
|
+
if (index < blocks.length) {
|
|
17
|
+
return { value: encoder.encode(blocks[index++]), done: false };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!holdOpen) {
|
|
21
|
+
return { value: undefined, done: true };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return new Promise((_resolve, reject) => {
|
|
25
|
+
const onAbort = () => {
|
|
26
|
+
signal.removeEventListener('abort', onAbort);
|
|
27
|
+
const error = new Error('Aborted');
|
|
28
|
+
error.name = 'AbortError';
|
|
29
|
+
reject(error);
|
|
30
|
+
};
|
|
31
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createTrackedSignal() {
|
|
41
|
+
const listeners = new Set();
|
|
42
|
+
return {
|
|
43
|
+
signal: {
|
|
44
|
+
aborted: false,
|
|
45
|
+
addEventListener(type, listener) {
|
|
46
|
+
if (type === 'abort') {
|
|
47
|
+
listeners.add(listener);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
removeEventListener(type, listener) {
|
|
51
|
+
if (type === 'abort') {
|
|
52
|
+
listeners.delete(listener);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
getListenerCount() {
|
|
57
|
+
return listeners.size;
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
describe('createUpstreamSseReader', () => {
|
|
63
|
+
it('emits parsed events and tracks the latest event id', async () => {
|
|
64
|
+
const events = [];
|
|
65
|
+
let reader;
|
|
66
|
+
|
|
67
|
+
reader = createUpstreamSseReader({
|
|
68
|
+
buildUrl: () => 'http://127.0.0.1:4096/global/event',
|
|
69
|
+
reconnectDelayMs: 0,
|
|
70
|
+
fetchImpl: async (_url, options) => createSseResponse({
|
|
71
|
+
signal: options.signal,
|
|
72
|
+
blocks: [
|
|
73
|
+
'id: evt-1\r\ndata: {"type":"server.connected","properties":{"directory":"/tmp/project"}}\r\n\r\n',
|
|
74
|
+
],
|
|
75
|
+
}),
|
|
76
|
+
onEvent(event) {
|
|
77
|
+
events.push(event);
|
|
78
|
+
reader.stop();
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
await reader.start();
|
|
83
|
+
|
|
84
|
+
expect(events).toHaveLength(1);
|
|
85
|
+
expect(events[0].eventId).toBe('evt-1');
|
|
86
|
+
expect(events[0].directory).toBe('/tmp/project');
|
|
87
|
+
expect(events[0].payload).toEqual({
|
|
88
|
+
type: 'server.connected',
|
|
89
|
+
properties: {
|
|
90
|
+
directory: '/tmp/project',
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
expect(reader.getLastEventId()).toBe('evt-1');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('reconnects a stalled stream with Last-Event-ID', async () => {
|
|
97
|
+
const fetchLastEventIds = [];
|
|
98
|
+
const events = [];
|
|
99
|
+
let attempt = 0;
|
|
100
|
+
let reader;
|
|
101
|
+
|
|
102
|
+
reader = createUpstreamSseReader({
|
|
103
|
+
buildUrl: () => 'http://127.0.0.1:4096/global/event',
|
|
104
|
+
stallTimeoutMs: 10,
|
|
105
|
+
reconnectDelayMs: 0,
|
|
106
|
+
fetchImpl: async (_url, options) => {
|
|
107
|
+
fetchLastEventIds.push(options.headers['Last-Event-ID'] ?? null);
|
|
108
|
+
attempt += 1;
|
|
109
|
+
|
|
110
|
+
if (attempt === 1) {
|
|
111
|
+
return createSseResponse({
|
|
112
|
+
signal: options.signal,
|
|
113
|
+
holdOpen: true,
|
|
114
|
+
blocks: [
|
|
115
|
+
'id: evt-1\ndata: {"type":"server.connected","properties":{}}\n\n',
|
|
116
|
+
],
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return createSseResponse({
|
|
121
|
+
signal: options.signal,
|
|
122
|
+
blocks: [
|
|
123
|
+
'id: evt-2\ndata: {"type":"session.updated","properties":{}}\n\n',
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
onEvent(event) {
|
|
128
|
+
events.push(event.eventId);
|
|
129
|
+
if (event.eventId === 'evt-2') {
|
|
130
|
+
reader.stop();
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
await reader.start();
|
|
136
|
+
|
|
137
|
+
expect(events).toEqual(['evt-1', 'evt-2']);
|
|
138
|
+
expect(fetchLastEventIds.slice(0, 2)).toEqual([null, 'evt-1']);
|
|
139
|
+
expect(reader.getLastEventId()).toBe('evt-2');
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('resolves the stall timeout for each upstream read window', async () => {
|
|
143
|
+
const events = [];
|
|
144
|
+
let attempt = 0;
|
|
145
|
+
let currentTimeout = 10;
|
|
146
|
+
let reader;
|
|
147
|
+
|
|
148
|
+
reader = createUpstreamSseReader({
|
|
149
|
+
buildUrl: () => 'http://127.0.0.1:4096/global/event',
|
|
150
|
+
stallTimeoutMs: () => currentTimeout,
|
|
151
|
+
reconnectDelayMs: 0,
|
|
152
|
+
fetchImpl: async (_url, options) => {
|
|
153
|
+
attempt += 1;
|
|
154
|
+
|
|
155
|
+
if (attempt === 1) {
|
|
156
|
+
currentTimeout = 60;
|
|
157
|
+
return createSseResponse({
|
|
158
|
+
signal: options.signal,
|
|
159
|
+
holdOpen: true,
|
|
160
|
+
blocks: [
|
|
161
|
+
'id: evt-1\ndata: {"type":"server.connected","properties":{}}\n\n',
|
|
162
|
+
],
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return createSseResponse({
|
|
167
|
+
signal: options.signal,
|
|
168
|
+
blocks: [
|
|
169
|
+
'id: evt-2\ndata: {"type":"session.updated","properties":{}}\n\n',
|
|
170
|
+
],
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
onEvent(event) {
|
|
174
|
+
events.push(event.eventId);
|
|
175
|
+
if (event.eventId === 'evt-2') {
|
|
176
|
+
reader.stop();
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
await reader.start();
|
|
182
|
+
|
|
183
|
+
expect(events).toEqual(['evt-1', 'evt-2']);
|
|
184
|
+
expect(attempt).toBe(2);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('reports unavailable upstream responses and continues reconnecting until stopped', async () => {
|
|
188
|
+
const errors = [];
|
|
189
|
+
let attempt = 0;
|
|
190
|
+
let unavailableBodyCanceled = false;
|
|
191
|
+
let reader;
|
|
192
|
+
|
|
193
|
+
reader = createUpstreamSseReader({
|
|
194
|
+
buildUrl: () => 'http://127.0.0.1:4096/global/event',
|
|
195
|
+
reconnectDelayMs: 0,
|
|
196
|
+
fetchImpl: async (_url, options) => {
|
|
197
|
+
attempt += 1;
|
|
198
|
+
if (attempt === 1) {
|
|
199
|
+
return {
|
|
200
|
+
ok: false,
|
|
201
|
+
status: 503,
|
|
202
|
+
body: {
|
|
203
|
+
cancel: async () => {
|
|
204
|
+
unavailableBodyCanceled = true;
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return createSseResponse({
|
|
211
|
+
signal: options.signal,
|
|
212
|
+
blocks: [
|
|
213
|
+
'id: evt-1\ndata: {"type":"server.connected","properties":{}}\n\n',
|
|
214
|
+
],
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
onError(error) {
|
|
218
|
+
errors.push(error);
|
|
219
|
+
},
|
|
220
|
+
onEvent() {
|
|
221
|
+
reader.stop();
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
await reader.start();
|
|
226
|
+
|
|
227
|
+
expect(errors).toEqual([
|
|
228
|
+
expect.objectContaining({
|
|
229
|
+
type: 'upstream_unavailable',
|
|
230
|
+
status: 503,
|
|
231
|
+
}),
|
|
232
|
+
]);
|
|
233
|
+
expect(unavailableBodyCanceled).toBe(true);
|
|
234
|
+
expect(attempt).toBe(2);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('removes reconnect delay abort listeners after normal timeout completion', async () => {
|
|
238
|
+
const tracked = createTrackedSignal();
|
|
239
|
+
let attempt = 0;
|
|
240
|
+
let reader;
|
|
241
|
+
|
|
242
|
+
reader = createUpstreamSseReader({
|
|
243
|
+
buildUrl: () => 'http://127.0.0.1:4096/global/event',
|
|
244
|
+
reconnectDelayMs: 1,
|
|
245
|
+
signal: tracked.signal,
|
|
246
|
+
fetchImpl: async (_url, options) => {
|
|
247
|
+
attempt += 1;
|
|
248
|
+
if (attempt === 1) {
|
|
249
|
+
return {
|
|
250
|
+
ok: false,
|
|
251
|
+
status: 503,
|
|
252
|
+
body: {
|
|
253
|
+
cancel: async () => {},
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return createSseResponse({
|
|
259
|
+
signal: options.signal,
|
|
260
|
+
blocks: [
|
|
261
|
+
'id: evt-1\ndata: {"type":"server.connected","properties":{}}\n\n',
|
|
262
|
+
],
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
onEvent() {
|
|
266
|
+
reader.stop();
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
await reader.start();
|
|
271
|
+
|
|
272
|
+
expect(attempt).toBe(2);
|
|
273
|
+
// The top-level stop listener remains; the reconnect-delay listener should be removed.
|
|
274
|
+
expect(tracked.getListenerCount()).toBe(1);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# FS Module Documentation
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Own filesystem API behavior for the web server runtime, including workspace-bound file operations, directory listing, reveal, and background command execution jobs.
|
|
5
|
+
|
|
6
|
+
## Entrypoints and structure
|
|
7
|
+
- `packages/web/server/lib/fs/routes.js`: route registration and runtime-owned state for `/api/fs/*` endpoints.
|
|
8
|
+
- `packages/web/server/lib/fs/search.js`: fuzzy filesystem search runtime used by non-FS routes (for example project icon discovery).
|
|
9
|
+
|
|
10
|
+
## Public exports
|
|
11
|
+
- `registerFsRoutes(app, dependencies)` from `routes.js`
|
|
12
|
+
- Registers all filesystem routes:
|
|
13
|
+
- `GET /api/fs/home`
|
|
14
|
+
- `POST /api/fs/mkdir`
|
|
15
|
+
- `GET /api/fs/read`
|
|
16
|
+
- `GET /api/fs/raw`
|
|
17
|
+
- `POST /api/fs/write`
|
|
18
|
+
- `POST /api/fs/delete`
|
|
19
|
+
- `POST /api/fs/rename`
|
|
20
|
+
- `POST /api/fs/reveal`
|
|
21
|
+
- `POST /api/fs/exec`
|
|
22
|
+
- `GET /api/fs/exec/:jobId`
|
|
23
|
+
- `GET /api/fs/list`
|
|
24
|
+
- Owns exec job queue state (`execJobs`) and lifecycle/TTL pruning.
|
|
25
|
+
- Enforces workspace boundary checks with active project + worktree fallback support.
|
|
26
|
+
- `createFsSearchRuntime({ fsPromises, path, spawn, resolveGitBinaryForSpawn })` from `search.js`
|
|
27
|
+
- Returns `{ searchFilesystemFiles(rootPath, options) }`.
|
|
28
|
+
- Supports fuzzy matching, hidden-file handling, and optional `git check-ignore` filtering.
|
|
29
|
+
|
|
30
|
+
## Composition contract with `index.js`
|
|
31
|
+
- `index.js` provides composition-time dependencies only (platform primitives + callbacks such as `resolveProjectDirectory`, `normalizeDirectoryPath`, and `buildAugmentedPath`).
|
|
32
|
+
- `index.js` no longer owns FS route handlers or FS exec job state.
|
|
33
|
+
|
|
34
|
+
## Notes for contributors
|
|
35
|
+
- Keep filesystem policy (workspace root checks, error mapping, exec timeout behavior) inside this module, not in the composition root.
|
|
36
|
+
- If adding new `/api/fs/*` endpoints, add them in `routes.js` and extend this document.
|