refactor(api): shrink media-references surface and reuse maintained libs

- /api/file module now exports only the SessionMediaReferences plugin
  contribution; MIME and range policy helpers are module-private and
  exercised entirely through the registered route.
- Replace the hand-rolled media extension table with mime-types (served
  categories image/video/audio, excluding image/svg+xml) and the
  hand-rolled Range parser with range-parser; keep the fail-closed
  workspace containment policy.
- Spec rewritten as route-level behavior tests (12 cases) covering the
  same branches; Agent Note facts updated in the same change.
This commit is contained in:
_Kerman
2026-09-07 16:35:15 +08:00
parent f81c5072bd
commit 4b009e7f94
8 changed files with 223 additions and 270 deletions
+6 -2
View File
@@ -71,6 +71,8 @@
"@deepseek-ai/dsh-brand": "workspace:^",
"@deepseek-ai/dsh-deque": "workspace:^",
"@deepseek-ai/schemastery": "workspace:^",
"mime-types": "^3.0.2",
"range-parser": "^1.3.0",
"zod": "^4.4.3"
},
"peerDependencies": {
@@ -122,8 +124,8 @@
"@deepseek-ai/dsh-attachment": "workspace:^",
"@deepseek-ai/dsh-client-connection": "workspace:^",
"@deepseek-ai/dsh-client-file-upload": "workspace:^",
"@deepseek-ai/dsh-commands": "workspace:^",
"@deepseek-ai/dsh-client-store": "workspace:^",
"@deepseek-ai/dsh-commands": "workspace:^",
"@deepseek-ai/dsh-file-reference": "workspace:^",
"@deepseek-ai/dsh-jobs": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^",
@@ -146,6 +148,8 @@
"@deepseek-ai/dsh-util-crypto": "workspace:^",
"@deepseek-ai/dsh-util-time": "workspace:^",
"@deepseek-ai/dsh-util-workspace-path": "workspace:^",
"@deepseek-ai/dsh-workspace": "workspace:^"
"@deepseek-ai/dsh-workspace": "workspace:^",
"@types/mime-types": "^3.0.1",
"@types/range-parser": "^1.2.7"
}
}