@surething/cockpit 1.0.251 → 1.0.252
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/.next-prod/BUILD_ID +1 -1
- package/.next-prod/app-path-routes-manifest.json +6 -6
- package/.next-prod/build-manifest.json +2 -2
- package/.next-prod/prerender-manifest.json +3 -3
- package/.next-prod/server/app/_global-error/page.js.nft.json +1 -1
- package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_global-error.html +1 -1
- package/.next-prod/server/app/_global-error.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found/page.js +1 -1
- package/.next-prod/server/app/_not-found/page.js.nft.json +1 -1
- package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_not-found.html +2 -2
- package/.next-prod/server/app/_not-found.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next-prod/server/app/api/agent/test/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/bash/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/codex/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/deepseek/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/kimi/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/ollama/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/pty-input/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/stop/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/claude-stats/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/commands/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/comments/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/columns/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/export/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/schemas/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/deepseek/credentials/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/dev/spans/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/extension/version/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/file/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/blame/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/clipboard/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/copy/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/delete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/expanded/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/index/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/init/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/paste/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/read/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/readdir/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/recent/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/save/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/search/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/stat/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/text/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/branch-diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/branches/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/commit-diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/current-branch/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/discard/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/stage/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/status/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/unstage/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/worktree/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/health/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/html-apps/[id]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/html-apps/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/load/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/save/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/shutdown/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/definition/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/hover/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/references/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/status/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/warmup/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/columns/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/export/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/schemas/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/schema/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/note/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/ollama/config/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/ollama/models/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/ollama/start/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/open-cursor/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/open-vscode/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/pick-folder/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/pinned-sessions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/project-settings/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/affected/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/callees/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/callers/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/coedit/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/context/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/file/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/file-functions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/impact/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/related/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/risk/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/search/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projects/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/push/public-key/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/push/subscribe/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/push/unsubscribe/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/command/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/delete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/get/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/keys/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/set/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/comments/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/replies/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/identify/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/order/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/share-info/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/users/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/scheduled-tasks/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/services/config/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/services/scripts/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/fork/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/history/route.js +2 -2
- package/.next-prod/server/app/api/session/[sessionId]/history/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session-by-path/route.js +2 -2
- package/.next-prod/server/app/api/session-by-path/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/projects/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/settings/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/[id]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/content/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/route.js +1 -1
- package/.next-prod/server/app/api/skills/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/snapshots/diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/snapshots/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/aliases/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/autocomplete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/bubble-order/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/env/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/history/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/version/route.js.nft.json +1 -1
- package/.next-prod/server/app/apps/[...path]/route.js.nft.json +1 -1
- package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next-prod/server/app/m/page.js +1 -1
- package/.next-prod/server/app/m/page.js.nft.json +1 -1
- package/.next-prod/server/app/m/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next-prod/server/app/page.js +1 -1
- package/.next-prod/server/app/page.js.nft.json +1 -1
- package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/project/page.js +1 -1
- package/.next-prod/server/app/project/page.js.nft.json +1 -1
- package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/review/[id]/page.js +1 -1
- package/.next-prod/server/app/review/[id]/page.js.nft.json +1 -1
- package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app-paths-manifest.json +6 -6
- package/.next-prod/server/chunks/{6023.js → 293.js} +2 -2
- package/.next-prod/server/chunks/4848.js +6 -6
- package/.next-prod/server/chunks/5292.js +2 -2
- package/.next-prod/server/chunks/6038.js +1 -1
- package/.next-prod/server/chunks/9658.js +8 -10
- package/.next-prod/server/middleware-build-manifest.js +1 -1
- package/.next-prod/server/pages/404.html +2 -2
- package/.next-prod/server/pages/500.html +1 -1
- package/.next-prod/server/server-reference-manifest.json +1 -1
- package/.next-prod/static/chunks/2876-e1f46119599a536b.js +25 -0
- package/.next-prod/static/chunks/{6784-0a1757d891ff579f.js → 6784-06048becad37f010.js} +0 -0
- package/.next-prod/static/chunks/{4473-6877df387a4a05a5.js → 7241-aa9e33a07f5ce517.js} +2 -2
- package/.next-prod/static/chunks/9530-8c647490a5290e9a.js +15 -0
- package/.next-prod/static/chunks/app/{layout-fe0749dfc3651e66.js → layout-145570f39a827c0f.js} +1 -1
- package/.next-prod/static/chunks/app/m/{page-03365a5db8980b50.js → page-6c37d1fb9db9b9d6.js} +1 -1
- package/.next-prod/static/chunks/app/{page-ce4888a98fda86ff.js → page-487095ac01a4c1ef.js} +1 -1
- package/.next-prod/static/chunks/app/project/{page-ce4888a98fda86ff.js → page-487095ac01a4c1ef.js} +1 -1
- package/.next-prod/static/css/16fd09c7889dec84.css +1 -0
- package/.next-prod/trace +14 -14
- package/.next-prod/trace-build +1 -1
- package/dist/scheduledTasks.mjs +6 -6
- package/package.json +1 -1
- package/.next-prod/static/chunks/4518-ddb1c50646c70ed5.js +0 -25
- package/.next-prod/static/chunks/9530-573e8f94413410d4.js +0 -17
- package/.next-prod/static/css/940b6d97248df0ed.css +0 -1
- /package/.next-prod/static/{43gzI6NymSKUFfFxi94ui → c5kafUZf0iWY6C4N_N-5-}/_buildManifest.js +0 -0
- /package/.next-prod/static/{43gzI6NymSKUFfFxi94ui → c5kafUZf0iWY6C4N_N-5-}/_ssgManifest.js +0 -0
|
@@ -926,16 +926,16 @@ description: "完整代码审查:静态 + 动态一遍做完。静态三角校
|
|
|
926
926
|
|
|
927
927
|
两条副作用红线:① 主会话**不替 subagent 做实质判断**;② 静态拆出去还顺带消掉"静态广度摊薄动态建模"的主稀释。
|
|
928
928
|
|
|
929
|
-
按规模三档(**都至少进一个干净 subagent**):
|
|
929
|
+
按规模三档(**都至少进一个干净 subagent**)。**前两档你自己按规模选;hard 只由用户显式指定,你不得自行升档**——改动再大、风险再高,用户没说 hard 就封顶在默认档,报告里也不要建议改用 hard:
|
|
930
930
|
- **单 subagent**:无动态面 / 极小 → 1 个干净 subagent 跑 Part A。主会话只转交 diff + 收报告。
|
|
931
931
|
- **默认(2 subagent)**:有动态面 → 1 静态 + 1 动态,**两个都干净、并行**,各自在干净 diff 上自行 triage(静态扫全部改动 / 动态用切片原型清单列全切片)。
|
|
932
|
-
- **hard(1 + N subagent)
|
|
932
|
+
- **hard(1 + N subagent)**:**仅当用户显式要 hard(如 \`/cr hard\`)** → 先 1 个干净 triage subagent 出切片清单,据此 fan out 1 静态 + 每切片 1 个 subagent。最深、最慢。用户点了就照跑,不因为"这次改动不大"自行降档;真拆不出动态切片时,注明"无动态切片,per-slice fan-out 退化为 1 静态"即可。
|
|
933
933
|
|
|
934
934
|
subagent prompt 模板:\`读本 skill (cr/SKILL.md),只对 <你那块(Part A 全部 / 某个动态切片)> 应用对应 Part,自行 triage,按统一格式输出 findings\`。
|
|
935
935
|
|
|
936
936
|
**Synthesis(主会话,只整理不重判)**:汇总各 subagent 的 findings → 去重(同根因标"共犯")→ 影响 \xd7 概率排序 → 一份报告 + 梯度图。**禁止用主会话的开发上下文给任何 finding 洗白 / 降级**——subagent 怎么判就怎么收。要质疑某条,**重新 spawn 一个干净 subagent 复核**,而不是主会话自己拍。
|
|
937
937
|
|
|
938
|
-
> 取舍:默认 2-subagent 既隔离开发污染、又消掉静态摊薄动态;hard 的 per-slice fan-out 是额外深度(实测把 image/video 挖到 🔴 + 多 subagent 独立收敛提置信度)
|
|
938
|
+
> 取舍:默认 2-subagent 既隔离开发污染、又消掉静态摊薄动态;hard 的 per-slice fan-out 是额外深度(实测把 image/video 挖到 🔴 + 多 subagent 独立收敛提置信度),贵且慢,由用户显式选用(不自动升档)。
|
|
939
939
|
|
|
940
940
|
## Step 1 — 分诊(triage;两种模式都先做这步)
|
|
941
941
|
读 diff,切两面(可重叠):
|
|
@@ -1071,16 +1071,16 @@ Most PR review is static — read the snapshot and you can judge right/wrong, **
|
|
|
1071
1071
|
|
|
1072
1072
|
Two side-effect red lines: ① the main session **does not make substantive judgements on the subagent's behalf**; ② splitting static out also removes the "static breadth dilutes dynamic modelling" dilution of the main thread.
|
|
1073
1073
|
|
|
1074
|
-
Three tiers by scale (**all enter at least one clean subagent**):
|
|
1074
|
+
Three tiers by scale (**all enter at least one clean subagent**). **You pick between the first two by scale yourself; hard is enabled ONLY when the user explicitly asks for it — never escalate to it on your own** — however large the diff or however high the risk, without the user saying hard you cap at the default tier, and don't suggest switching to hard in the report either:
|
|
1075
1075
|
- **Single subagent**: no dynamic surface / tiny → 1 clean subagent runs Part A. Main session just relays the diff + collects the report.
|
|
1076
1076
|
- **Default (2 subagents)**: has a dynamic surface → 1 static + 1 dynamic, **both clean, in parallel**, each triaging on the clean diff itself (static scans all changes / dynamic lists every slice via the slice-archetype checklist).
|
|
1077
|
-
- **hard (1 + N subagents)**:
|
|
1077
|
+
- **hard (1 + N subagents)**: **only when the user explicitly asks for hard (e.g. \`/cr hard\`)** → first 1 clean triage subagent produces the slice list, then fan out 1 static + 1 subagent per slice. Deepest, slowest. Once the user asks for it, run it as asked — don't downgrade on your own because "this change is small"; if no dynamic slice can be carved out, just note "no dynamic slice, per-slice fan-out degenerates to 1 static".
|
|
1078
1078
|
|
|
1079
1079
|
Subagent prompt template: \`Read this skill (cr/SKILL.md); apply only the matching Part to <your chunk (all of Part A / one dynamic slice)>, triage it yourself, and output findings in the unified format\`.
|
|
1080
1080
|
|
|
1081
1081
|
**Synthesis (main session, organize only — never re-judge)**: gather each subagent's findings → dedup (mark same-root-cause as "accomplices") → sort by impact \xd7 probability → one report + gradient chart. **It is forbidden to use the main session's dev context to whitewash / downgrade any finding** — take what the subagent judged as-is. To dispute one, **spawn a fresh clean subagent to re-check**, not the main session deciding on its own.
|
|
1082
1082
|
|
|
1083
|
-
> Trade-off: the default 2-subagent both isolates dev pollution and removes static-dilutes-dynamic; hard's per-slice fan-out is extra depth (in practice it dug image/video up to 🔴, and multiple independently-converging subagents raised confidence), expensive and slow,
|
|
1083
|
+
> Trade-off: the default 2-subagent both isolates dev pollution and removes static-dilutes-dynamic; hard's per-slice fan-out is extra depth (in practice it dug image/video up to 🔴, and multiple independently-converging subagents raised confidence), expensive and slow, selected explicitly by the user (never auto-escalated).
|
|
1084
1084
|
|
|
1085
1085
|
## Step 1 — Triage (do this first in both modes)
|
|
1086
1086
|
Read the diff, cut two surfaces (may overlap):
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";exports.id=5292,exports.ids=[5292],exports.modules={15090:(a,b,c)=>{c.d(b,{rL:()=>
|
|
1
|
+
"use strict";exports.id=5292,exports.ids=[5292],exports.modules={15090:(a,b,c)=>{c.d(b,{rL:()=>q,bX:()=>p,BS:()=>r});var d=c(33873),e=c(55511),f=c(79646),g=c(79748),h=c(29021);class i{spawn(){let a=this.findTsserver();console.log(`[tsserver] spawning: node ${a}`);let b=(0,d.resolve)(process.cwd(),"bin/set-title.js"),c=(0,f.spawn)("node",["--require",b,a,"--disableAutomaticTypingAcquisition"],{stdio:["pipe","pipe","pipe"],env:{...process.env,TSS_LOG:""}});return c.stdout.on("data",a=>this.onData(a)),c.stderr.setEncoding("utf-8"),c.stderr.on("data",a=>{console.log(`[tsserver stderr] ${a.trim()}`)}),c.stdin.on("error",a=>{console.error("[tsserver] stdin error:",a.message)}),c.on("error",a=>{console.error("[tsserver] process error:",a),this.rejectAll(Error("tsserver process error"))}),c.on("exit",a=>{console.log(`[tsserver] exited with code ${a}`),this.rejectAll(Error(`tsserver exited with code ${a}`)),this.process=null}),this.process=c,c}openFile(a,b){let c=(0,d.resolve)(a);this.openedFiles.has(c)?this.sendRequest("reload",{file:c,tmpfile:c}):(this.openedFiles.add(c),this.sendRequest("open",{file:c,fileContent:b}))}closeFile(a){let b=(0,d.resolve)(a);this.openedFiles.has(b)&&(this.openedFiles.delete(b),this.sendRequest("close",{file:b}))}async definition(a,b,c){let e=(0,d.resolve)(a);await this.ensureFileOpen(e);let f=await this.sendRequestWithResponse("definition",{file:e,line:b,offset:c});return f?.body&&Array.isArray(f.body)?Promise.all(f.body.map(async a=>{let b=await this.readLineFromFile(a.file,a.start.line);return{file:a.file,line:a.start.line,column:a.start.offset,lineText:b}})):[]}async hover(a,b,c){let e,f=(0,d.resolve)(a);await this.ensureFileOpen(f);try{e=await this.sendRequestWithResponse("quickinfo",{file:f,line:b,offset:c},this.coldStart?3e4:3e3)}catch{return null}if(!e?.body)return null;let g=e.body;return{displayString:g.displayString||"",documentation:g.documentation||"",kind:g.kind||""}}async references(a,b,c){let e=(0,d.resolve)(a);await this.ensureFileOpen(e);let f=await this.sendRequestWithResponse("references",{file:e,line:b,offset:c});return f?.body?.refs&&Array.isArray(f.body.refs)?f.body.refs.map(a=>({file:a.file,line:a.start.line,column:a.start.offset,lineText:a.lineText||""})):[]}shutdown(){if(!this.process)return;console.log("[tsserver] shutting down"),this.rejectAll(Error("tsserver shutting down")),this.openedFiles.clear();try{this.sendRequest("exit",{})}catch{}let a=this.process;setTimeout(()=>{a&&!a.killed&&a.kill("SIGTERM")},1e3),this.process=null}findTsserver(){try{if((0,h.existsSync)(28483))return console.log("[tsserver] found via require.resolve: 28483"),28483}catch{}let a=(0,d.join)(process.cwd(),"node_modules/typescript/lib/tsserver.js");if((0,h.existsSync)(a))return console.log(`[tsserver] found via cwd: ${a}`),a;try{let a=(0,f.execSync)("which tsserver",{encoding:"utf-8"}).trim();if(a)return console.log(`[tsserver] found via which: ${a}`),a}catch{}return console.warn("[tsserver] using fallback path"),"node_modules/typescript/lib/tsserver.js"}async ensureFileOpen(a){if(!this.openedFiles.has(a))try{let b=await (0,g.readFile)(a,"utf-8");this.openFile(a,b)}catch{}}sendRequest(a,b){if(!this.process?.stdin?.writable)return;this.seq++;let c=JSON.stringify({seq:this.seq,type:"request",command:a,arguments:b});try{this.process.stdin.write(c+"\n")}catch(b){console.error(`[tsserver] write error for ${a}:`,b)}}sendRequestWithResponse(a,b,c=1e4){return new Promise((d,e)=>{if(!this.process?.stdin?.writable)return void e(Error("tsserver not running"));this.seq++;let f=this.seq,g=setTimeout(()=>{this.pendingRequests.delete(f),e(Error(`tsserver request timeout: ${a}`))},c);this.pendingRequests.set(f,{resolve:d,reject:e,timer:g});let h=JSON.stringify({seq:f,type:"request",command:a,arguments:b});try{this.process.stdin.write(h+"\n")}catch(a){this.pendingRequests.delete(f),clearTimeout(g),e(Error(`tsserver write error: ${a}`))}})}onData(a){this.buffer=Buffer.concat([this.buffer,a]),this.processBuffer()}processBuffer(){let a=Buffer.from("\r\n\r\n"),b=Buffer.from("Content-Length:");for(;;){let c=this.buffer.indexOf(a);if(-1===c)break;let d=this.buffer.subarray(0,c).toString("utf-8").match(/Content-Length:\s*(\d+)/i);if(!d){let a=this.buffer.indexOf(b,c+4);if(-1===a){this.buffer=Buffer.alloc(0);break}this.buffer=this.buffer.subarray(a);continue}let e=parseInt(d[1],10),f=c+4,g=f+e;if(this.buffer.length<g)break;let h=this.buffer.subarray(f,g).toString("utf-8");this.buffer=this.buffer.subarray(g);try{let a=JSON.parse(h);this.handleMessage(a)}catch{}}}handleMessage(a){if("response"===a.type&&void 0!==a.request_seq){let b=this.pendingRequests.get(a.request_seq);b&&(clearTimeout(b.timer),this.pendingRequests.delete(a.request_seq),!1===a.success?b.reject(Error(`tsserver error: ${a.command}`)):(this.coldStart&&(this.coldStart=!1,console.log("[tsserver] project loaded, switching to fast timeout")),b.resolve(a)))}}rejectAll(a){for(let[,b]of this.pendingRequests)clearTimeout(b.timer),b.reject(a);this.pendingRequests.clear()}async readLineFromFile(a,b){try{let c=(await (0,g.readFile)(a,"utf-8")).split("\n");return c[b-1]?.trim()||""}catch{return""}}constructor(){this.language="typescript",this.process=null,this.seq=0,this.pendingRequests=new Map,this.buffer=Buffer.alloc(0),this.openedFiles=new Set,this.coldStart=!0}}var j=c(1932);class k{static isAvailable(){try{return(0,f.execSync)("which pyright-langserver",{stdio:"ignore"}),!0}catch{try{return(0,f.execSync)("which basedpyright-langserver",{stdio:"ignore"}),!0}catch{return!1}}}static getCommand(){try{return(0,f.execSync)("which pyright-langserver",{stdio:"ignore"}),"pyright-langserver"}catch{return"basedpyright-langserver"}}spawn(){let a=k.getCommand();console.log(`[pyright] spawning: ${a} --stdio`);let b=(0,f.spawn)(a,["--stdio"],{stdio:["pipe","pipe","pipe"],env:process.env});return b.stdout.setEncoding("utf-8"),b.stdout.on("data",a=>this.onData(a)),b.stderr.on("data",()=>{}),b.on("error",a=>{console.error("[pyright] process error:",a),this.rejectAll(Error("pyright process error"))}),b.on("exit",a=>{console.log(`[pyright] exited with code ${a}`),this.rejectAll(Error(`pyright exited with code ${a}`))}),this.process=b,b}async initialize(){this.initialized||await this.sendLSPRequest("initialize",{processId:process.pid,capabilities:{textDocument:{hover:{contentFormat:["plaintext"]},definition:{},references:{}}},rootUri:null})&&(this.sendLSPNotification("initialized",{}),this.initialized=!0,console.log("[pyright] initialized"))}openFile(a,b){let c=(0,d.resolve)(a),e=(0,j.pathToFileURL)(c).href;this.openedFiles.has(c)?this.sendLSPNotification("textDocument/didChange",{textDocument:{uri:e,version:Date.now()},contentChanges:[{text:b}]}):(this.openedFiles.add(c),this.sendLSPNotification("textDocument/didOpen",{textDocument:{uri:e,languageId:"python",version:1,text:b}}))}closeFile(a){let b=(0,d.resolve)(a);if(!this.openedFiles.has(b))return;this.openedFiles.delete(b);let c=(0,j.pathToFileURL)(b).href;this.sendLSPNotification("textDocument/didClose",{textDocument:{uri:c}})}async definition(a,b,c){let e=(0,d.resolve)(a);await this.ensureFileOpen(e);let f=(0,j.pathToFileURL)(e).href,g=await this.sendLSPRequest("textDocument/definition",{textDocument:{uri:f},position:{line:b-1,character:c-1}});return g?Promise.all((Array.isArray(g)?g:[g]).map(async a=>{let b=new URL(a.uri).pathname,c=a.range.start.line+1,d=await this.readLineFromFile(b,c);return{file:b,line:c,column:a.range.start.character+1,lineText:d}})):[]}async hover(a,b,c){let e=(0,d.resolve)(a);await this.ensureFileOpen(e);let f=(0,j.pathToFileURL)(e).href,g=await this.sendLSPRequest("textDocument/hover",{textDocument:{uri:f},position:{line:b-1,character:c-1}});if(!g?.contents)return null;let h=g.contents,i="";return"string"==typeof h?i=h:h.value?i=h.value:Array.isArray(h)&&(i=h.map(a=>"string"==typeof a?a:a.value).join("\n")),{displayString:i,documentation:"",kind:""}}async references(a,b,c){let e=(0,d.resolve)(a);await this.ensureFileOpen(e);let f=(0,j.pathToFileURL)(e).href,g=await this.sendLSPRequest("textDocument/references",{textDocument:{uri:f},position:{line:b-1,character:c-1},context:{includeDeclaration:!0}});return Array.isArray(g)?Promise.all(g.map(async a=>{let b=new URL(a.uri).pathname,c=a.range.start.line+1,d=await this.readLineFromFile(b,c);return{file:b,line:c,column:a.range.start.character+1,lineText:d}})):[]}shutdown(){if(this.process){console.log("[pyright] shutting down"),this.rejectAll(Error("pyright shutting down")),this.openedFiles.clear();try{this.sendLSPRequest("shutdown",{}).then(()=>{this.sendLSPNotification("exit",{})}).catch(()=>{})}catch{}setTimeout(()=>{this.process&&!this.process.killed&&this.process.kill("SIGTERM")},1e3),this.process=null}}async ensureFileOpen(a){if(!this.openedFiles.has(a))try{let b=await (0,g.readFile)(a,"utf-8");this.openFile(a,b)}catch{}}sendLSPRequest(a,b){return new Promise((c,d)=>{if(!this.process?.stdin?.writable)return void d(Error("pyright not running"));this.seq++;let e=this.seq,f=setTimeout(()=>{this.pendingRequests.delete(e),d(Error(`pyright request timeout: ${a}`))},1e4);this.pendingRequests.set(e,{resolve:c,reject:d,timer:f});let g=JSON.stringify({jsonrpc:"2.0",id:e,method:a,params:b}),h=`Content-Length: ${Buffer.byteLength(g)}\r
|
|
2
2
|
\r
|
|
3
3
|
`;this.process.stdin.write(h+g)})}sendLSPNotification(a,b){if(!this.process?.stdin?.writable)return;let c=JSON.stringify({jsonrpc:"2.0",method:a,params:b}),d=`Content-Length: ${Buffer.byteLength(c)}\r
|
|
4
4
|
\r
|
|
5
|
-
`;this.process.stdin.write(d+c)}onData(a){this.buffer+=a,this.processBuffer()}processBuffer(){for(;;){let a=this.buffer.indexOf("\r\n\r\n");if(-1===a)break;let b=this.buffer.slice(0,a).match(/Content-Length:\s*(\d+)/i);if(!b){this.buffer=this.buffer.slice(a+4);continue}let c=parseInt(b[1],10),d=a+4,e=d+c;if(this.buffer.length<e)break;let f=this.buffer.slice(d,e);this.buffer=this.buffer.slice(e);try{let a=JSON.parse(f);this.handleMessage(a)}catch{}}}handleMessage(a){if(void 0!==a.id){let b=this.pendingRequests.get(a.id);b&&(clearTimeout(b.timer),this.pendingRequests.delete(a.id),a.error?b.reject(Error(`pyright error: ${a.error.message}`)):b.resolve(a.result))}}rejectAll(a){for(let[,b]of this.pendingRequests)clearTimeout(b.timer),b.reject(a);this.pendingRequests.clear()}async readLineFromFile(a,b){try{let c=(await (0,
|
|
5
|
+
`;this.process.stdin.write(d+c)}onData(a){this.buffer+=a,this.processBuffer()}processBuffer(){for(;;){let a=this.buffer.indexOf("\r\n\r\n");if(-1===a)break;let b=this.buffer.slice(0,a).match(/Content-Length:\s*(\d+)/i);if(!b){this.buffer=this.buffer.slice(a+4);continue}let c=parseInt(b[1],10),d=a+4,e=d+c;if(this.buffer.length<e)break;let f=this.buffer.slice(d,e);this.buffer=this.buffer.slice(e);try{let a=JSON.parse(f);this.handleMessage(a)}catch{}}}handleMessage(a){if(void 0!==a.id){let b=this.pendingRequests.get(a.id);b&&(clearTimeout(b.timer),this.pendingRequests.delete(a.id),a.error?b.reject(Error(`pyright error: ${a.error.message}`)):b.resolve(a.result))}}rejectAll(a){for(let[,b]of this.pendingRequests)clearTimeout(b.timer),b.reject(a);this.pendingRequests.clear()}async readLineFromFile(a,b){try{let c=(await (0,g.readFile)(a,"utf-8")).split("\n");return c[b-1]?.trim()||""}catch{return""}}constructor(){this.language="python",this.process=null,this.seq=0,this.pendingRequests=new Map,this.buffer="",this.openedFiles=new Set,this.initialized=!1}}let l=Symbol.for("lsp_server_registry_v2"),m=Symbol.for("lsp_idle_timer_v2");function n(){let a=globalThis;return a[l]||(a[l]=new Map,console.log("[lsp-registry] initialized"),process.on("exit",()=>{let a=n();for(let[,b]of a){console.log(`[lsp-registry] shutting down ${b.language} server (cwd=${b.cwd})`);try{b.adapter.shutdown()}catch{}}a.clear(),o()})),a[l]}function o(){let a=globalThis;a[m]&&(clearInterval(a[m]),a[m]=void 0)}async function p(a,b){let c,e,f=(0,d.resolve)(b),g=`${a}:${(0,d.resolve)(f)}`,h=n(),j=h.get(g);if(j)return j.lastUsedAt=Date.now(),await j.readyPromise,j;let l=n();for(;l.size>=5;){let a=null,b=1/0;for(let[c,d]of l)d.lastUsedAt<b&&(b=d.lastUsedAt,a=c);if(!a)break;let c=l.get(a);console.log(`[lsp-registry] LRU evict: ${c.language} @ ${c.cwd}, pid=${c.process.pid}`);try{c.adapter.shutdown()}catch{}l.delete(a)}let p=function(a){switch(a){case"typescript":return new i;case"python":if(!k.isAvailable())return console.log("[lsp-registry] pyright-langserver not found, python LSP disabled"),null;return new k;default:return null}}(a);if(!p)return null;let q=new Promise(a=>{c=a}),r=p.spawn(),s={language:a,cwd:f,adapter:p,process:r,openedFiles:new Map,ready:!1,readyPromise:q,lastUsedAt:Date.now()};if(h.set(g,s),console.log(`[lsp-registry] started ${a} server for ${f}, pid=${r.pid}`),(e=globalThis)[m]||(e[m]=setInterval(()=>{let a=n(),b=Date.now();for(let[c,d]of a)if(b-d.lastUsedAt>3e5){console.log(`[lsp-registry] idle timeout: ${d.language} @ ${d.cwd}, closing`);try{d.adapter.shutdown()}catch{}a.delete(c)}0===a.size&&o()},6e4),"function"==typeof e[m].unref&&e[m].unref()),r.on("exit",()=>{console.log(`[lsp-registry] ${a} server exited (cwd=${f})`),h.delete(g)}),p.initialize)try{await p.initialize()}catch(b){console.error(`[lsp-registry] ${a} initialize error:`,b)}return s.ready=!0,c(),s}async function q(a,b,c){a.lastUsedAt=Date.now();let d=(0,e.createHash)("sha1").update(c).digest("hex");(a.openedFiles.get(b)!==d||a.lastOpenedFile!==b)&&(a.openedFiles.set(b,d),a.adapter.openFile(b,c),a.lastOpenedFile=b)}function r(){let a=[];for(let[,b]of n())a.push({language:b.language,cwd:b.cwd,pid:b.process.pid,ready:b.ready,openedFiles:b.openedFiles.size});return a}},72891:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{OZ:()=>o,RL:()=>n,k9:()=>p,ok:()=>l});var e=c(37625),f=c(52693),g=c(18412),h=c(89705),i=c(94506),j=c(770),k=a([i]);i=(k.then?(await k)():k)[0];let l=(a,b=200)=>new Response(JSON.stringify(a),{status:b,headers:{"content-type":"application/json"}}),m=a=>{let b=e.od(a);if(f.Ru(b)){let a=b.value,c=(0,j.Sh)(a);return new Response(JSON.stringify({error:(a=>{let b=a.message;if("string"==typeof b&&b.length>0)return b;let c=a.cause;if(c instanceof Error&&c.message.length>0)return c.message;switch(a._tag){case"ValidationError":return`Invalid ${a.field}: ${a.reason}`;case"NotFoundError":return`${a.resource} not found: ${a.id}`;case"PermissionError":return`Permission denied: ${a.action} on ${a.resource}`;case"DBError":return`${a.db} ${a.op} failed`;case"FSError":return`${a.op} ${a.path} failed`;case"WSError":return`${a.proto} ${a.kind} failed`;case"AgentError":return`${a.provider} ${a.kind} failed`;default:return a._tag}})(a),tag:a._tag}),{status:c,headers:{"content-type":"application/json"}})}return console.error("[handler] uncaught defect:\n"+e.j9(a)),new Response(JSON.stringify({error:"Internal Server Error",tag:"InternalError"}),{status:500,headers:{"content-type":"application/json"}})},n=a=>async b=>{let c=await i.s9.runPromiseExit(a(b));return g.YW(c,{onFailure:a=>m(a),onSuccess:a=>a})},o=a=>async(b,c)=>{let d=await c.params,e=await i.s9.runPromiseExit(a(b,d));return g.YW(e,{onFailure:a=>m(a),onSuccess:a=>a})},p=a=>h.$mh({try:()=>a.json(),catch:()=>new j.yI({field:"body",reason:"invalid JSON"})});d()}catch(a){d(a)}})}};
|