dsh-plugin-dev-kb 1.8.0 → 1.8.1
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/CHANGELOG.md +186 -178
- package/README.en.md +172 -172
- package/README.md +183 -183
- package/kb/INDEX.md +236 -234
- package/kb/README.md +88 -88
- package/kb/extra/AGENTS.md +77 -77
- package/kb/extra/deepseek-llm-api-wire-extensions.md +162 -162
- package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +162 -162
- package/kb/extra/defensive-patterns/package-surface.md +233 -232
- package/kb/extra/defensive-patterns/package-surface.zh.md +233 -232
- package/kb/extra/defensive-patterns/remote-and-api.md +117 -117
- package/kb/extra/defensive-patterns/remote-and-api.zh.md +117 -117
- package/kb/extra/development.md +221 -221
- package/kb/extra/development.zh.md +228 -228
- package/kb/extra/event-producer-consumer.md +133 -123
- package/kb/extra/event-producer-consumer.zh.md +135 -125
- package/kb/extra/module-graph.md +1961 -1888
- package/kb/extra/module-graph.zh.md +1963 -1890
- package/kb/extra/persistence-changes/2026-11-05-timeline-priority-notice.md +60 -0
- package/kb/extra/persistence-changes/2026-11-05-timeline-priority-notice.zh.md +60 -0
- package/kb/extra/persistence-changes/README.md +92 -92
- package/kb/extra/persistence-changes/README.zh.md +92 -92
- package/kb/extra/persistence-changes/historical-formats/README.md +75 -75
- package/kb/extra/persistence-changes/historical-formats/README.zh.md +75 -75
- package/kb/extra/persistence-changes/releases/README.md +103 -103
- package/kb/extra/persistence-changes/releases/README.zh.md +103 -103
- package/kb/extra/rescope.md +55 -55
- package/kb/extra/rescope.zh.md +55 -55
- package/kb/extra/subsystems/boot.md +631 -621
- package/kb/extra/subsystems/boot.zh.md +631 -621
- package/kb/extra/subsystems/computer-use.md +179 -137
- package/kb/extra/subsystems/computer-use.zh.md +179 -137
- package/kb/extra/subsystems/extensions.md +387 -384
- package/kb/extra/subsystems/extensions.zh.md +387 -384
- package/kb/extra/subsystems/feedback.md +418 -400
- package/kb/extra/subsystems/feedback.zh.md +418 -400
- package/kb/extra/subsystems/forge.md +2169 -1226
- package/kb/extra/subsystems/forge.zh.md +2171 -1226
- package/kb/extra/subsystems/liveshare.md +167 -158
- package/kb/extra/subsystems/liveshare.zh.md +167 -158
- package/kb/extra/subsystems/mcp.md +237 -234
- package/kb/extra/subsystems/mcp.zh.md +237 -234
- package/kb/extra/subsystems/office-kit.md +122 -0
- package/kb/extra/subsystems/office-kit.zh.md +122 -0
- package/kb/extra/subsystems/working-directory.md +95 -64
- package/kb/extra/subsystems/working-directory.zh.md +95 -64
- package/kb/extra/subsystems/worktrees.md +187 -127
- package/kb/extra/subsystems/worktrees.zh.md +187 -127
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.md +21 -21
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.zh.md +21 -21
- package/kb/extra/upgrade-guide/v0.2.1-rc.4/sandbox-unsupported-policy-error/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.4/sandbox-unsupported-policy-error/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-error-builtin-codes/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-error-builtin-codes/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-kit-package/guide.md +34 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-kit-package/guide.zh.md +34 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.md +49 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.zh.md +49 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-skill-resources/guide.md +36 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-skill-resources/guide.zh.md +36 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-notification-fields/guide.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-notification-fields/guide.zh.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-remote-provider/guide.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-remote-provider/guide.zh.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/archive-worktrees/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/archive-worktrees/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/attachment-error-codes/guide.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/attachment-error-codes/guide.zh.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-ax-read-limits/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-ax-read-limits/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-hover-ax-only/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-hover-ax-only/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-native-platform/guide.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-native-platform/guide.zh.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/dsh-doc-skill/guide.md +35 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/dsh-doc-skill/guide.zh.md +35 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-change-request-overview/guide.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-change-request-overview/guide.zh.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-pinned-diff/guide.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-pinned-diff/guide.zh.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-review-reads/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-review-reads/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/package-export-cleanup/guide.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/package-export-cleanup/guide.zh.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/plugin-update-method/guide.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/plugin-update-method/guide.zh.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-bootstrap-protocol/guide.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-bootstrap-protocol/guide.zh.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-inspect-output/guide.md +48 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-inspect-output/guide.zh.md +48 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-scoped-repl-default/guide.md +45 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-scoped-repl-default/guide.zh.md +45 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/runtime-context-reminders/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/runtime-context-reminders/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/session-append-overloads/guide.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/session-append-overloads/guide.zh.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.md +27 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.zh.md +27 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-backend-cleanup-error/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-backend-cleanup-error/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-bundle-sidebar-backend/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-bundle-sidebar-backend/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-fetch-transport-error-codes/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-fetch-transport-error-codes/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-search-billing/guide.md +41 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-search-billing/guide.zh.md +41 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/window-drag-regions/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.1/window-drag-regions/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/client-module-metadata/guide.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/client-module-metadata/guide.zh.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/connection-page-peer/guide.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/connection-page-peer/guide.zh.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/cordis-root-and-intercept-metadata/guide.md +31 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/cordis-root-and-intercept-metadata/guide.zh.md +31 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-agents-without-preset/guide.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-agents-without-preset/guide.zh.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-macos-provider/guide.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-macos-provider/guide.zh.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-partial-observations/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-partial-observations/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/deepseek-files-timeout/guide.md +15 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/deepseek-files-timeout/guide.zh.md +15 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/experimental-tool-error-codes/guide.md +28 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/experimental-tool-error-codes/guide.zh.md +28 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/package-export-cleanup/guide.md +36 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/package-export-cleanup/guide.zh.md +36 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/python-ptc-removal/guide.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/python-ptc-removal/guide.zh.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/session-status-package/guide.md +31 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/session-status-package/guide.zh.md +31 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/shared-search-filter/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/shared-search-filter/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/shell-fs-tool-error-codes/guide.md +30 -0
- package/kb/extra/upgrade-guide/v0.2.2-rc.2/shell-fs-tool-error-codes/guide.zh.md +30 -0
- package/kb/extra/web-styling.md +57 -57
- package/kb/extra/web-styling.zh.md +57 -57
- package/kb/meta/search-index.json +4508 -3980
- package/kb/meta/source.json +18 -18
- package/kb/site/develop/practice/llm-adapter.md +192 -192
- package/kb/site/en/develop/practice/llm-adapter.md +192 -192
- package/kb/site/en/guide/desktop-uninstall-cleanup.md +63 -0
- package/kb/site/en/guide/plugin-market.md +153 -151
- package/kb/site/en/guide/providers.md +234 -234
- package/kb/site/en/guide/quickstart.md +35 -34
- package/kb/site/en/reference/capability-seams.md +789 -767
- package/kb/site/en/reference/config-catalog.md +5432 -5128
- package/kb/site/en/reference/cookbook/adding-a-package.md +175 -175
- package/kb/site/en/reference/cookbook/adding-a-tool.md +105 -104
- package/kb/site/en/reference/cookbook/extension-cookbook.md +178 -135
- package/kb/site/en/reference/cordis-api/context.md +373 -369
- package/kb/site/en/reference/cordis-api/fiber.md +457 -433
- package/kb/site/en/reference/cordis-api/inherited.md +44 -44
- package/kb/site/en/reference/cordis-api/service.md +118 -107
- package/kb/site/en/reference/experimental-persistence-catalog.md +36 -23
- package/kb/site/en/reference/index.md +174 -174
- package/kb/site/en/reference/persistence-catalog.md +9453 -9432
- package/kb/site/en/reference/subsystems/compaction.md +288 -288
- package/kb/site/en/reference/subsystems/core.md +1172 -1171
- package/kb/site/en/reference/subsystems/credentials.md +526 -497
- package/kb/site/en/reference/subsystems/filesystem.md +708 -708
- package/kb/site/en/reference/subsystems/index.md +82 -82
- package/kb/site/en/reference/subsystems/llm-streaming.md +1290 -1288
- package/kb/site/en/reference/subsystems/lsp.md +230 -206
- package/kb/site/en/reference/subsystems/persistence.md +451 -432
- package/kb/site/en/reference/subsystems/plan.md +91 -91
- package/kb/site/en/reference/subsystems/ptc-runtime.md +295 -261
- package/kb/site/en/reference/subsystems/sandbox.md +250 -232
- package/kb/site/en/reference/subsystems/session-query.md +525 -515
- package/kb/site/en/reference/subsystems/session-reference.md +231 -229
- package/kb/site/en/reference/subsystems/session.md +1478 -1431
- package/kb/site/en/reference/subsystems/sidebar-right.md +165 -165
- package/kb/site/en/reference/subsystems/skills.md +356 -356
- package/kb/site/en/reference/subsystems/slots.md +235 -231
- package/kb/site/en/reference/subsystems/terminal.md +188 -188
- package/kb/site/en/reference/subsystems/tools.md +902 -891
- package/kb/site/en/reference/subsystems/user-questions.md +330 -327
- package/kb/site/en/reference/subsystems/web-client.md +161 -104
- package/kb/site/en/reference/subsystems/web-server.md +434 -351
- package/kb/site/en/reference/subsystems/web.md +268 -268
- package/kb/site/en/reference/subsystems/workflow.md +287 -282
- package/kb/site/en/reference/subsystems/workspace.md +743 -651
- package/kb/site/en/reference/tool-catalog.md +2867 -2704
- package/kb/site/guide/desktop-uninstall-cleanup.md +63 -0
- package/kb/site/guide/plugin-market.md +153 -151
- package/kb/site/guide/providers.md +234 -234
- package/kb/site/guide/quickstart.md +35 -34
- package/kb/site/reference/capability-seams.md +789 -767
- package/kb/site/reference/config-catalog.md +5432 -5128
- package/kb/site/reference/cookbook/adding-a-package.md +175 -175
- package/kb/site/reference/cookbook/adding-a-tool.md +107 -106
- package/kb/site/reference/cookbook/extension-cookbook.md +182 -139
- package/kb/site/reference/cordis-api/context.md +373 -369
- package/kb/site/reference/cordis-api/fiber.md +459 -435
- package/kb/site/reference/cordis-api/inherited.md +44 -44
- package/kb/site/reference/cordis-api/service.md +118 -107
- package/kb/site/reference/experimental-persistence-catalog.md +36 -23
- package/kb/site/reference/index.md +178 -178
- package/kb/site/reference/persistence-catalog.md +9453 -9432
- package/kb/site/reference/subsystems/compaction.md +288 -288
- package/kb/site/reference/subsystems/core.md +1184 -1183
- package/kb/site/reference/subsystems/credentials.md +526 -497
- package/kb/site/reference/subsystems/filesystem.md +708 -708
- package/kb/site/reference/subsystems/index.md +82 -82
- package/kb/site/reference/subsystems/llm-streaming.md +1296 -1294
- package/kb/site/reference/subsystems/lsp.md +230 -206
- package/kb/site/reference/subsystems/persistence.md +451 -432
- package/kb/site/reference/subsystems/plan.md +91 -91
- package/kb/site/reference/subsystems/ptc-runtime.md +295 -261
- package/kb/site/reference/subsystems/sandbox.md +250 -232
- package/kb/site/reference/subsystems/session-query.md +525 -515
- package/kb/site/reference/subsystems/session-reference.md +231 -229
- package/kb/site/reference/subsystems/session.md +1482 -1435
- package/kb/site/reference/subsystems/sidebar-right.md +165 -165
- package/kb/site/reference/subsystems/skills.md +356 -356
- package/kb/site/reference/subsystems/slots.md +239 -235
- package/kb/site/reference/subsystems/terminal.md +188 -188
- package/kb/site/reference/subsystems/tools.md +902 -891
- package/kb/site/reference/subsystems/user-questions.md +330 -327
- package/kb/site/reference/subsystems/web-client.md +161 -104
- package/kb/site/reference/subsystems/web-server.md +434 -351
- package/kb/site/reference/subsystems/web.md +268 -268
- package/kb/site/reference/subsystems/workflow.md +287 -282
- package/kb/site/reference/subsystems/workspace.md +743 -651
- package/kb/site/reference/tool-catalog.md +2872 -2709
- package/lib/index.js +359 -359
- package/package.json +68 -68
- package/skills/dsh-plugin-dev-kb.md +71 -70
- package/kb/extra/subsystems/office-to-pdf.md +0 -87
- package/kb/extra/subsystems/office-to-pdf.zh.md +0 -87
|
@@ -1,351 +1,434 @@
|
|
|
1
|
-
---
|
|
2
|
-
editSource: "docs/subsystems/web-server.md"
|
|
3
|
-
rawMarkdownPath: "en/reference/subsystems/web-server.md"
|
|
4
|
-
outline: [2,3]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# HTTP Server
|
|
8
|
-
|
|
9
|
-
[dsh-host-webserver](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/host/webserver)
|
|
10
|
-
|
|
11
|
-
Source: [`packages/host/webserver/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/src/index.ts)
|
|
12
|
-
|
|
13
|
-
## Routes
|
|
14
|
-
|
|
15
|
-
```ts type-equiv
|
|
16
|
-
/** Route match kind: 'exact' matches the pathname verbatim; 'prefix' p matches p and p/<anything>. */
|
|
17
|
-
type WebRouteKind = 'exact' | 'prefix'
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
```ts type-equiv
|
|
21
|
-
/** One named route registration. */
|
|
22
|
-
interface WebRoute {
|
|
23
|
-
kind: WebRouteKind
|
|
24
|
-
/** Absolute pathname, no trailing slash. */
|
|
25
|
-
path: string
|
|
26
|
-
/** Owns the full response lifecycle (may hold the response open, e.g. SSE). */
|
|
27
|
-
handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
*
|
|
146
|
-
* @
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
*
|
|
153
|
-
* @
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
*
|
|
160
|
-
* @
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
*
|
|
179
|
-
* @
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
*
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* @
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* @
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
1
|
+
---
|
|
2
|
+
editSource: "docs/subsystems/web-server.md"
|
|
3
|
+
rawMarkdownPath: "en/reference/subsystems/web-server.md"
|
|
4
|
+
outline: [2,3]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# HTTP Server
|
|
8
|
+
|
|
9
|
+
[dsh-host-webserver](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/host/webserver) provides the GUI Host's HTTP or TLS listener, route matching and admission, optional gzip, index rendering, and one fallback. Feature plugins register their own routes; Connection supplies source and credential decisions through `webserver/authorize`. The carrier passes each admitted Peer directly to the handler or resource rather than constructing a request-context container ([layering reference](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/boot/app-boot/README.md)).
|
|
10
|
+
|
|
11
|
+
Source: [`packages/host/webserver/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/src/index.ts)
|
|
12
|
+
|
|
13
|
+
## Routes
|
|
14
|
+
|
|
15
|
+
```ts type-equiv
|
|
16
|
+
/** Route match kind: 'exact' matches the pathname verbatim; 'prefix' p matches p and p/<anything>. */
|
|
17
|
+
type WebRouteKind = 'exact' | 'prefix'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts type-equiv
|
|
21
|
+
/** One named route registration. */
|
|
22
|
+
interface WebRoute {
|
|
23
|
+
kind: WebRouteKind
|
|
24
|
+
/** Absolute pathname, no trailing slash. */
|
|
25
|
+
path: string
|
|
26
|
+
/** Owns the full response lifecycle (may hold the response open, e.g. SSE). */
|
|
27
|
+
handler: (req: IncomingMessage, res: ServerResponse, peer?: PeerScope) => void | Promise<void>
|
|
28
|
+
/** Defaults to required. Anonymous handlers may receive no Peer. */
|
|
29
|
+
auth?: WebAuthenticationRule
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```ts type-equiv
|
|
34
|
+
/**
|
|
35
|
+
* Answers one GET or HEAD request with a Fetch response and its admitted Peer.
|
|
36
|
+
* Anonymous HTTP admission may omit the Peer; an in-process
|
|
37
|
+
* {@link WebServer.readResource} read passes the Peer its caller admitted.
|
|
38
|
+
*/
|
|
39
|
+
type WebResource = (request: Request, peer?: PeerScope) => Promise<Response>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```ts type-equiv
|
|
43
|
+
/** One named route answered by a resource instead of a handler. */
|
|
44
|
+
interface WebResourceRoute {
|
|
45
|
+
kind: WebRouteKind
|
|
46
|
+
/** Absolute pathname, no trailing slash. */
|
|
47
|
+
path: string
|
|
48
|
+
/** Answers HTTP GET and HEAD requests and in-process reads. */
|
|
49
|
+
resource: WebResource
|
|
50
|
+
/** Defaults to required; in-process reads still enforce deny. */
|
|
51
|
+
auth?: WebAuthenticationRule
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
All `webserver/*` events use the corresponding WebServer as their dispatch subject, including `index-inject` and `entry-url`. Ordinary listeners match the emitter's `webServer` isolation; explicit `{ global: true }` listeners bypass that filter. Passing a Peer as event data does not select listeners. Custom carriers and application emitters must supply the WebServer subject.
|
|
56
|
+
|
|
57
|
+
Match order is exact, longest prefix, then the single-owner fallback; upgrades match exact paths. After matching, `auth` resolves to `anonymous`, `required` (default), or `deny`, either directly or through a synchronous request selector. `deny` returns 403 without an authorization event. Other policies emit synchronous `webserver/authorize`; the first decision wins. Without a decision, `anonymous` allows and `required` returns 503. Connection checks sources for both and calls ConnectionAuthentication only for authenticated routes. Anonymous assets are therefore credential-free, not exempt from active Connection source policy.
|
|
58
|
+
|
|
59
|
+
Handlers receive the admitted Peer as their trailing parameter; resources receive it through the existing `resource(request, peer?)` argument. Authenticated routes require a live Peer; anonymous routes may omit it. After admission, resources accept only GET/HEAD. Trusted `readResource(request, peer)` follows the same match order and reaches only resources, bypassing source and credential checks but still returning 403 for a resolved `deny`. The [frontend fallback](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/frontend-static/README.md) selects authenticated index access and anonymous static assets, then renders index startup data for the supplied Peer.
|
|
60
|
+
|
|
61
|
+
`webserver/request(request, response, next)` remains an HTTP waterfall before route selection and admission; a listener owns the response or awaits `next()`. The [Token plugin](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/authentication-token/README.md) uses it for root Token exchange and registers `/connect` with anonymous auth, verifying the launch token after Connection source checks. Page resources consume their admitted Peer without repeating authentication.
|
|
62
|
+
|
|
63
|
+
After successful upgrade admission, `webserver/upgrade(req, socket, head, peer, next)` runs before the registered protocol handler. It carries the admitted Peer, or `undefined` for anonymous access; denied requests never enter it. Listeners handle the Socket or await `next()`; the fallback awaits the route handler, including asynchronous completion. Middleware or handler failures are logged and destroy the Socket. On `/api/remote.mux`, Token applies single-Socket ownership and credential revocation only to API Peers in its own map; other Providers delegate without Token policy.
|
|
64
|
+
|
|
65
|
+
`webserver/entry-url(baseUrl, entries)` synchronously collects complete entry URLs for a supplied server base URL as `WebEntryUrl` records with `label`, complete `url`, and boolean `open`. WebApp emits it after Loader settlement and startup audit, prints each entry when configured, and opens only the first eligible entry outside SSH. An empty list produces neither output nor opening. Token contributes its signed URL without reading WebApp services; public-address configuration remains in WebApp.
|
|
66
|
+
|
|
67
|
+
<a id="config"></a>
|
|
68
|
+
|
|
69
|
+
## Config
|
|
70
|
+
|
|
71
|
+
```ts type-equiv
|
|
72
|
+
/** Web server listen, TLS, and response-compression config. */
|
|
73
|
+
interface Config {
|
|
74
|
+
/**
|
|
75
|
+
* Listen address: a concrete IPv4 or IPv6 literal of one local interface,
|
|
76
|
+
* for example the container's own Pod address from `hostname -i`. A loopback
|
|
77
|
+
* literal (any address in 127/8, `::1`, or a mapped form of either) keeps the
|
|
78
|
+
* server on this machine; any other literal serves the network that address
|
|
79
|
+
* belongs to, over plain HTTP unless `tls` is set. The unspecified address —
|
|
80
|
+
* IPv4 any, IPv6 any, and the IPv4-mapped forms of IPv4 any — is rejected at
|
|
81
|
+
* load: it would expose the port on every interface at once.
|
|
82
|
+
*/
|
|
83
|
+
host: string
|
|
84
|
+
/** Listen port; zero requests an OS-assigned port. */
|
|
85
|
+
port: number
|
|
86
|
+
/**
|
|
87
|
+
* Serve HTTPS with this certificate and key instead of plain HTTP. Both files
|
|
88
|
+
* are read once, before the listener binds: an unreadable or empty file,
|
|
89
|
+
* invalid PEM, or a key that does not match the certificate rejects
|
|
90
|
+
* initialization rather than falling back to HTTP. The material is never
|
|
91
|
+
* re-read, so replacing a certificate takes a reload. Omitted or null listens
|
|
92
|
+
* over plain HTTP.
|
|
93
|
+
*/
|
|
94
|
+
tls?: TlsConfig
|
|
95
|
+
/** Response compression for socket-backed HTTP requests. @default 'none' */
|
|
96
|
+
compression?: 'none' | 'gzip'
|
|
97
|
+
/** Gzip DEFLATE level from 0 through 9. @default 1 */
|
|
98
|
+
compressionLevel?: number
|
|
99
|
+
/** Minimum known response length eligible for gzip; unknown-length streams are eligible. @default 1024 */
|
|
100
|
+
compressionThresholdBytes?: number
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```ts type-equiv
|
|
105
|
+
/**
|
|
106
|
+
* TLS material for the HTTPS listener: one certificate chain file and the
|
|
107
|
+
* private key file it pairs with. Both hold PEM text and both resolve against
|
|
108
|
+
* the process working directory.
|
|
109
|
+
*/
|
|
110
|
+
interface TlsConfig {
|
|
111
|
+
/** Certificate chain file, leaf certificate first, PEM, no passphrase. */
|
|
112
|
+
certFile: string
|
|
113
|
+
/** Private key file for the chain's leaf certificate; unencrypted PEM. */
|
|
114
|
+
keyFile: string
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
No composition can bind every interface at once: the unspecified address is rejected at load. The exported `isWildcardHost` and `isLoopbackHost` classify a bind address from its parsed value, and an IPv6 `%zone` is kept for `listen` while classification reads the address alone. The carrier enforces route auth declarations; Connection owns source checks and ConnectionAuthentication owns credential verification. It serves plain HTTP unless `tls` supplies a certificate and key. `compression` defaults to `none`; the shipped Web bundle selects gzip level 1 with a 1024-byte threshold. The shipped `dsh web` command selects loopback by default and accepts one concrete `--host` address, warning at startup when a non-loopback bind serves plain HTTP; its Connection plugin checks Host/Origin on matched anonymous and authenticated routes and verifies credentials where authentication is required, and the bind address plus `--trusted-host` govern which browser Host is accepted; `--public-url` changes only the advertised URL. Other compositions own their bind and route-authentication policy. The dist location is an assembly fact of the frontend plugin that claims the seat.
|
|
119
|
+
|
|
120
|
+
## The service
|
|
121
|
+
|
|
122
|
+
The nested `connection.authentication` service selects a Peer through registered Providers; Connection applies source policy and WebServer passes the selected Peer to each call. The [Token plugin](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/authentication-token/README.md) contributes its signed login URL; WebApp owns startup printing and browser opening. [Desktop](https://github.com/deepseek-ai/deepseek-harness/blob/master/apps/desktop/README.md#application-overview) registers a separate Provider using a credential delivered over its private parent–Host IPC channel; its ready message carries the ordinary Host address and startup injections.
|
|
123
|
+
|
|
124
|
+
`WebServer` (`ctx.webServer`) listens immediately on activation; a listen failure (EADDRINUSE…) rejects initialization, and the boot process reports the failed fiber. The `tls` pair is read once before the listener binds, and an unreadable, empty, or mismatched pair rejects initialization the same way instead of falling back to HTTP. `register(route)` adds one named route and returns its disposer; a duplicate `(kind, path)` throws because route patterns are a composition-level contract and a collision is a misconfiguration. Gzip wraps eligible socket-backed responses inside the server, so handlers keep direct `ServerResponse` ownership, and a resource hands the service a `Response` to write back. Existing content encodings, `Cache-Control: no-transform`, ranges, SSE, ZIP, and the packaged `.gz` Worker image remain identity responses. `collectIndexInjections(peer)` gathers structured `IndexInjection` rows over one `webserver/index-inject` emit that passes the Peer the page speaks for, and `renderIndex(html, peer)` renders them into successful root and configured index responses before applying the raw `tapIndex(transform)` escape-hatch transforms in registration order; [dsh-client-modules](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/client/modules) answers the event with the boot manifest rows. `port` reads the listening port, including the port assigned by the OS when `config.port` is 0, and `protocol` reports the scheme the listener serves (`http:` or `https:`).
|
|
125
|
+
|
|
126
|
+
A request whose handling throws (a malformed %-escape hitting `decodeURIComponent`, a client dropping mid-body) is logged as a warning and answered 400 — or the socket destroyed when headers are already out — never a process exit. Disposal pairs `close()` with `closeAllConnections()` because a handler may hold its response open (SSE) and such connections never end on their own; without the force-close, teardown would hang. A TLS socket counts as a connection only after its handshake, so the server tracks raw TLS sockets beside upgraded ones and destroys both at disposal. WebApp owns entry-URL printing and browser opening; this server owns HTTP delivery. Per-package operational detail, including the dev-mode bundle watch pipeline, stays in the [README](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/README.md).
|
|
127
|
+
|
|
128
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
129
|
+
|
|
130
|
+
<a id="cordis-surface"></a>
|
|
131
|
+
|
|
132
|
+
## Cordis API
|
|
133
|
+
|
|
134
|
+
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
|
|
135
|
+
|
|
136
|
+
<a id="ctxconnection--hostconnectionhandle"></a>
|
|
137
|
+
|
|
138
|
+
### `ctx.connection` — `HostConnectionHandle`
|
|
139
|
+
|
|
140
|
+
Host `ctx.connection` members consumed by transport-independent adapters.
|
|
141
|
+
|
|
142
|
+
```ts cordis-catalog
|
|
143
|
+
/**
|
|
144
|
+
* Compose exact Fetch routes and the shared-channel RPC interceptor.
|
|
145
|
+
* @param channel - shared channel mounted by Connection.
|
|
146
|
+
* @returns Fetch handler for trusted, authenticated requests.
|
|
147
|
+
*/
|
|
148
|
+
createSharedFetchHandler(channel: '/api'): ConnectionFetchHandler
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Apply Host/Origin checks and admit the first live Peer returned by a registered credential verifier.
|
|
152
|
+
* @param request - request headers from the HTTP or upgrade request.
|
|
153
|
+
* @returns the credential's Peer, or the rejection status.
|
|
154
|
+
*/
|
|
155
|
+
admit(request: ConnectionTrustRequest): PeerAdmission
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Create an independent in-process Peer, disposed with the Context that read `ctx.connection`.
|
|
159
|
+
* @param options - fixed principal and interaction participation (default answer).
|
|
160
|
+
* @returns a new Peer distinct from every other Peer.
|
|
161
|
+
*/
|
|
162
|
+
createPeer(options: { readonly principal: Principal; readonly interactions?: 'answer' | 'none' }): PeerScope
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Types: [Principal](./typert.md)
|
|
166
|
+
|
|
167
|
+
Source: [`packages/client/connection/src/rpc.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/connection/src/rpc.ts)
|
|
168
|
+
|
|
169
|
+
<a id="ctxconnectionauthentication--connectionauthentication"></a>
|
|
170
|
+
|
|
171
|
+
### `ctx.connection.authentication` — `ConnectionAuthentication`
|
|
172
|
+
|
|
173
|
+
Credential verifier registry whose registrations belong to the calling plugin.
|
|
174
|
+
|
|
175
|
+
```ts cordis-catalog
|
|
176
|
+
/**
|
|
177
|
+
* Add a credential verifier after the existing registrations.
|
|
178
|
+
* @param provider - verifier owning its credential and Peer selection.
|
|
179
|
+
* @returns disposer withdrawing this registration; the calling scope also withdraws it on unload.
|
|
180
|
+
*/
|
|
181
|
+
register(provider: AuthenticationProvider): () => Promise<void>
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Verify credentials without applying an HTTP response or source policy.
|
|
185
|
+
* @param request - current carrier headers and cancellation facts.
|
|
186
|
+
* @returns the first live Peer, 401 if no provider accepts, or 503 when verification failed without success.
|
|
187
|
+
*/
|
|
188
|
+
authenticate(request: ConnectionTrustRequest): PeerAdmission
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Types: [AuthenticationProvider](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/connection/README.md#browser-authentication-and-request-trust)
|
|
192
|
+
|
|
193
|
+
Source: [`packages/client/connection/src/authentication.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/connection/src/authentication.ts)
|
|
194
|
+
|
|
195
|
+
<a id="ctxwebapp--webapp"></a>
|
|
196
|
+
|
|
197
|
+
### `ctx.webApp` — `WebApp`
|
|
198
|
+
|
|
199
|
+
The Web GUI this process serves, provided by the `web-runtime` row.
|
|
200
|
+
|
|
201
|
+
```ts cordis-catalog
|
|
202
|
+
/**
|
|
203
|
+
* The URL this GUI advertises, also used for `DSH_WEB_URL` and the startup URL line.
|
|
204
|
+
* @returns the configured `publicUrl`, otherwise the listener origin.
|
|
205
|
+
*/
|
|
206
|
+
getAdvertisedUrl(): string
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Source: [`packages/bundle/web-app/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/bundle/web-app/src/index.ts)
|
|
210
|
+
|
|
211
|
+
<a id="ctxwebserver--webserver"></a>
|
|
212
|
+
|
|
213
|
+
### `ctx.webServer` — `WebServer`
|
|
214
|
+
|
|
215
|
+
The browser HTTP carrier service. Activation loads any configured TLS material, then listens immediately; a material or listen failure rejects initialization, and the boot process reports the failed fiber. Route registration order does not affect requests because configured named routes must be distinct, and a request no named route matches is answered 404 until the fallback owner registers. HTTP and upgrade admission refusals carry `Cache-Control: no-store`.
|
|
216
|
+
|
|
217
|
+
```ts cordis-catalog
|
|
218
|
+
/**
|
|
219
|
+
* The root URL local clients use to reach the bound listener: the protocol,
|
|
220
|
+
* the {@link bindUrlHost} form of the bind address, and the listening port.
|
|
221
|
+
* @returns the origin, for example `http://127.0.0.1:3080`.
|
|
222
|
+
* @throws before `listen` binds a port, or when the bind address has no URL form.
|
|
223
|
+
*/
|
|
224
|
+
getOrigin(): string
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Register a named route. Duplicate (kind, path) throws — route patterns are
|
|
228
|
+
* a composition-level contract, so a collision is a misconfiguration.
|
|
229
|
+
* @param route - kind, path, and the owning handler or resource.
|
|
230
|
+
* @returns the disposer removing the route.
|
|
231
|
+
*/
|
|
232
|
+
register(route: WebRoute | WebResourceRoute): () => void
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Register an exact-path HTTP upgrade route. Duplicate paths throw because
|
|
236
|
+
* one socket can have only one protocol owner.
|
|
237
|
+
* @param route - pathname and handler owning negotiation plus socket use.
|
|
238
|
+
* @returns the disposer removing the route.
|
|
239
|
+
*/
|
|
240
|
+
registerUpgrade(route: WebUpgradeRoute): () => void
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Claim the fallback seat: the handler or resource answering every request
|
|
244
|
+
* no named route matches (the SPA dist server in the shipped Web
|
|
245
|
+
* composition). One owner only — a second registration throws, because two
|
|
246
|
+
* fallbacks cannot compose.
|
|
247
|
+
* @param fallback - a handler owning the full response lifecycle of
|
|
248
|
+
* unmatched requests, or an object declaring `handler` or `resource` and auth.
|
|
249
|
+
* @returns the disposer releasing the seat.
|
|
250
|
+
*/
|
|
251
|
+
registerFallback(fallback: WebRoute['handler'] | WebFallback): () => void
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Read the response an HTTP request for the same URL would receive, as the
|
|
255
|
+
* resource computes it for `peer`, without an HTTP exchange. The request
|
|
256
|
+
* path picks the responder by the HTTP match order — exact, longest prefix,
|
|
257
|
+
* then the fallback — and only a resource answers. This method checks no
|
|
258
|
+
* cookie, Host, or Origin: the caller admits the reader before reading.
|
|
259
|
+
* A resolved deny policy returns 403 even for an explicitly admitted Peer.
|
|
260
|
+
* @param request - the read; its URL path selects the responder.
|
|
261
|
+
* @param peer - the Peer the read speaks for, passed to the resource.
|
|
262
|
+
* @returns the resource's response, without a body for HEAD as over HTTP;
|
|
263
|
+
* 405 with `Allow: GET, HEAD` for any other method, checked before matching,
|
|
264
|
+
* where over HTTP a handler route or an unmatched path answers such a
|
|
265
|
+
* method itself; 404 when the path matches a handler route, or reaches the
|
|
266
|
+
* fallback seat while it is unclaimed or holds a handler. A resource that
|
|
267
|
+
* throws rejects the read, where an HTTP request would receive 400.
|
|
268
|
+
*/
|
|
269
|
+
async readResource(request: Request, peer: PeerScope): Promise<Response>
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Register a raw-HTML index transform, the escape hatch for markup no
|
|
273
|
+
* {@link IndexInjection} row expresses: {@link renderIndex} applies taps in
|
|
274
|
+
* registration order after rendering the structured rows.
|
|
275
|
+
* @param transform - pure html-to-html function.
|
|
276
|
+
* @returns the disposer removing the transform.
|
|
277
|
+
*/
|
|
278
|
+
tapIndex(transform: (html: string) => string): () => void
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Run an index.html body through the registered taps in registration order
|
|
282
|
+
* — called by the fallback owner on every index response it renders.
|
|
283
|
+
* @param html - the raw index.html body.
|
|
284
|
+
* @returns the transformed body.
|
|
285
|
+
*/
|
|
286
|
+
applyIndexTaps(html: string): string
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Gather the structured injection table for one Peer: one
|
|
290
|
+
* `webserver/index-inject` emit, every subscriber pushes its current rows.
|
|
291
|
+
* Fresh per call, so subscribers read live state (module graph, theme
|
|
292
|
+
* preference, the Peer's access) at emit time.
|
|
293
|
+
* @param peer - the Peer the page speaks for.
|
|
294
|
+
* @returns rows in subscriber activation order.
|
|
295
|
+
*/
|
|
296
|
+
collectIndexInjections(peer: PeerScope): IndexInjection[]
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Render one index.html body for one Peer: the structured injection table
|
|
300
|
+
* first, then the raw `tapIndex` transforms over the result.
|
|
301
|
+
* @param html - the raw index.html body.
|
|
302
|
+
* @param peer - the Peer the page speaks for.
|
|
303
|
+
* @returns the transformed body.
|
|
304
|
+
*/
|
|
305
|
+
renderIndex(html: string, peer: PeerScope): string
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Source: [`packages/host/webserver/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/src/index.ts)
|
|
309
|
+
|
|
310
|
+
<a id="connection-events"></a>
|
|
311
|
+
|
|
312
|
+
### `connection/*` events
|
|
313
|
+
|
|
314
|
+
<a id="connectionrequest--waterfall"></a>
|
|
315
|
+
|
|
316
|
+
#### `connection/request` — waterfall
|
|
317
|
+
|
|
318
|
+
Admit or wrap an authenticated shared API request, including body transfer. Existing requests continue when a listener refuses subsequent requests.
|
|
319
|
+
|
|
320
|
+
```ts cordis-catalog
|
|
321
|
+
/**
|
|
322
|
+
* Admit or wrap an authenticated shared API request, including body transfer.
|
|
323
|
+
* Existing requests continue when a listener refuses subsequent requests.
|
|
324
|
+
* @param request - Authenticated incoming HTTP request.
|
|
325
|
+
* @param response - Response owned until the delegated bridge settles.
|
|
326
|
+
* @param next - Delegate to the next listener or the shared API bridge.
|
|
327
|
+
* @mode waterfall
|
|
328
|
+
*/
|
|
329
|
+
'connection/request'(request: IncomingMessage, response: ServerResponse, next: () => Promise<void>): Promise<void>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Source: [`packages/client/connection/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/connection/src/index.ts)
|
|
333
|
+
|
|
334
|
+
<a id="webserver-events"></a>
|
|
335
|
+
|
|
336
|
+
### `webserver/*` events
|
|
337
|
+
|
|
338
|
+
<a id="webserverauthorize--bail"></a>
|
|
339
|
+
|
|
340
|
+
#### `webserver/authorize` — bail
|
|
341
|
+
|
|
342
|
+
Admit a matched request synchronously; the first decision wins.
|
|
343
|
+
|
|
344
|
+
```ts cordis-catalog
|
|
345
|
+
/**
|
|
346
|
+
* Admit a matched request synchronously; the first decision wins.
|
|
347
|
+
* @param request - headers, target, transport, and available cancellation state.
|
|
348
|
+
* @param policy - resolved route policy; deny never emits this event.
|
|
349
|
+
* @mode bail
|
|
350
|
+
*/
|
|
351
|
+
'webserver/authorize'(request: WebAuthRequest, policy: WebAuthPolicy): WebAdmission | undefined
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Source: [`packages/host/webserver/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/src/index.ts)
|
|
355
|
+
|
|
356
|
+
<a id="webserverentry-url--emit"></a>
|
|
357
|
+
|
|
358
|
+
#### `webserver/entry-url` — emit
|
|
359
|
+
|
|
360
|
+
Collect complete entry URLs for an advertised server address.
|
|
361
|
+
|
|
362
|
+
```ts cordis-catalog
|
|
363
|
+
/**
|
|
364
|
+
* Collect complete entry URLs for an advertised server address.
|
|
365
|
+
* @param baseUrl - advertised server base URL without provider credentials.
|
|
366
|
+
* @param entries - entries appended synchronously in listener order.
|
|
367
|
+
* @mode emit
|
|
368
|
+
*/
|
|
369
|
+
'webserver/entry-url'(baseUrl: string, entries: WebEntryUrl[]): void
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Source: [`packages/host/webserver/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/src/index.ts)
|
|
373
|
+
|
|
374
|
+
<a id="webserverindex-inject--emit"></a>
|
|
375
|
+
|
|
376
|
+
#### `webserver/index-inject` — emit
|
|
377
|
+
|
|
378
|
+
Collect the structured index injection table for the page `peer` speaks for. Emitted on every index render and every worker boot-payload request; listeners push their current rows, so a row's data is read fresh at emit time.
|
|
379
|
+
|
|
380
|
+
```ts cordis-catalog
|
|
381
|
+
/**
|
|
382
|
+
* Collect the structured index injection table for the page `peer` speaks
|
|
383
|
+
* for. Emitted on every index render and every worker boot-payload
|
|
384
|
+
* request; listeners push their current rows, so a row's data is read
|
|
385
|
+
* fresh at emit time.
|
|
386
|
+
* @param table - Mutable row table; listeners append in activation order.
|
|
387
|
+
* @param peer - The Peer the rendered page speaks for.
|
|
388
|
+
* @mode emit
|
|
389
|
+
*/
|
|
390
|
+
'webserver/index-inject'(table: IndexInjection[], peer: PeerScope): void
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Source: [`packages/host/webserver/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/src/index.ts)
|
|
394
|
+
|
|
395
|
+
<a id="webserverrequest--waterfall"></a>
|
|
396
|
+
|
|
397
|
+
#### `webserver/request` — waterfall
|
|
398
|
+
|
|
399
|
+
Handle an HTTP request before named-route and fallback dispatch.
|
|
400
|
+
|
|
401
|
+
```ts cordis-catalog
|
|
402
|
+
/**
|
|
403
|
+
* Handle an HTTP request before named-route and fallback dispatch.
|
|
404
|
+
* @param request - original incoming HTTP request.
|
|
405
|
+
* @param response - response owned by the listener or its delegated handler.
|
|
406
|
+
* @param next - dispatch to the next listener or the matching route.
|
|
407
|
+
* @mode waterfall
|
|
408
|
+
*/
|
|
409
|
+
'webserver/request'(request: IncomingMessage, response: ServerResponse, next: () => Promise<void>): Promise<void>
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Source: [`packages/host/webserver/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/src/index.ts)
|
|
413
|
+
|
|
414
|
+
<a id="webserverupgrade--waterfall"></a>
|
|
415
|
+
|
|
416
|
+
#### `webserver/upgrade` — waterfall
|
|
417
|
+
|
|
418
|
+
Handle an admitted upgrade before its registered protocol handler.
|
|
419
|
+
|
|
420
|
+
```ts cordis-catalog
|
|
421
|
+
/**
|
|
422
|
+
* Handle an admitted upgrade before its registered protocol handler.
|
|
423
|
+
* @param request - original upgrade request.
|
|
424
|
+
* @param socket - transport owned by the upgrade.
|
|
425
|
+
* @param head - bytes received after the HTTP headers.
|
|
426
|
+
* @param peer - authenticated identity, absent for anonymous admission.
|
|
427
|
+
* @param next - delegate to the next listener or protocol handler.
|
|
428
|
+
* @mode waterfall
|
|
429
|
+
*/
|
|
430
|
+
'webserver/upgrade'( request: IncomingMessage, socket: Duplex, head: Buffer, peer: PeerScope | undefined, next: () => Promise<void>, ): Promise<void>
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Source: [`packages/host/webserver/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/webserver/src/index.ts)
|
|
434
|
+
<!-- END GENERATED cordis-surface -->
|