dsh-plugin-dev-kb 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.
Files changed (234) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -0
  3. package/cordis.patch.yml +12 -0
  4. package/kb/INDEX.md +210 -0
  5. package/kb/README.md +69 -0
  6. package/kb/extra/AGENTS.md +75 -0
  7. package/kb/extra/api-gateway.md +164 -0
  8. package/kb/extra/api-gateway.zh.md +164 -0
  9. package/kb/extra/cookbook/adding-a-vendored-package.md +59 -0
  10. package/kb/extra/cookbook/adding-a-vendored-package.zh.md +59 -0
  11. package/kb/extra/cookbook/maintaining-dsh-code-review.md +64 -0
  12. package/kb/extra/cookbook/maintaining-dsh-code-review.zh.md +64 -0
  13. package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.md +32 -0
  14. package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.zh.md +32 -0
  15. package/kb/extra/defensive-patterns.md +33 -0
  16. package/kb/extra/defensive-patterns.zh.md +33 -0
  17. package/kb/extra/development.md +171 -0
  18. package/kb/extra/development.zh.md +171 -0
  19. package/kb/extra/event-producer-consumer.md +76 -0
  20. package/kb/extra/event-producer-consumer.zh.md +78 -0
  21. package/kb/extra/glossary.md +45 -0
  22. package/kb/extra/glossary.zh.md +45 -0
  23. package/kb/extra/graph-atlas.md +24 -0
  24. package/kb/extra/graph-atlas.zh.md +26 -0
  25. package/kb/extra/i18n/README.md +60 -0
  26. package/kb/extra/i18n/README.zh.md +60 -0
  27. package/kb/extra/i18n/style-samples.md +87 -0
  28. package/kb/extra/i18n/terminology.md +214 -0
  29. package/kb/extra/i18n/translation-prompt.md +263 -0
  30. package/kb/extra/i18n/translation-rules.md +69 -0
  31. package/kb/extra/i18n/translation-rules.zh.md +69 -0
  32. package/kb/extra/module-graph.md +1641 -0
  33. package/kb/extra/module-graph.zh.md +1643 -0
  34. package/kb/extra/postmortem/0001-acp-default-export-drops-inject.md +113 -0
  35. package/kb/extra/postmortem/0001-acp-default-export-drops-inject.zh.md +113 -0
  36. package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.md +47 -0
  37. package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +47 -0
  38. package/kb/extra/postmortem/0003-web-agent-gui-feedback-loop.md +53 -0
  39. package/kb/extra/postmortem/0003-web-agent-gui-feedback-loop.zh.md +53 -0
  40. package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +55 -0
  41. package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +55 -0
  42. package/kb/extra/postmortem/README.md +18 -0
  43. package/kb/extra/postmortem/README.zh.md +18 -0
  44. package/kb/extra/rescope.md +53 -0
  45. package/kb/extra/rescope.zh.md +53 -0
  46. package/kb/extra/subsystems/attachment.md +125 -0
  47. package/kb/extra/subsystems/attachment.zh.md +125 -0
  48. package/kb/extra/subsystems/extensions.md +364 -0
  49. package/kb/extra/subsystems/extensions.zh.md +364 -0
  50. package/kb/extra/subsystems/feedback.md +266 -0
  51. package/kb/extra/subsystems/feedback.zh.md +266 -0
  52. package/kb/extra/testing.md +49 -0
  53. package/kb/extra/testing.zh.md +49 -0
  54. package/kb/extra/web-styling.md +25 -0
  55. package/kb/extra/web-styling.zh.md +25 -0
  56. package/kb/meta/search-index.json +1328 -0
  57. package/kb/meta/site-pages.txt +168 -0
  58. package/kb/meta/source.json +13 -0
  59. package/kb/meta/topics.md +75 -0
  60. package/kb/site/develop/basic/config.md +108 -0
  61. package/kb/site/develop/basic/index.md +146 -0
  62. package/kb/site/develop/basic/publish.md +185 -0
  63. package/kb/site/develop/basic/tool.md +54 -0
  64. package/kb/site/develop/cordis-tutorial/01-first-plugin.md +95 -0
  65. package/kb/site/develop/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
  66. package/kb/site/develop/cordis-tutorial/03-services.md +98 -0
  67. package/kb/site/develop/cordis-tutorial/04-events.md +144 -0
  68. package/kb/site/develop/cordis-tutorial/05-config.md +84 -0
  69. package/kb/site/develop/cordis-tutorial/06-composition-and-hmr.md +113 -0
  70. package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +107 -0
  71. package/kb/site/develop/cordis-tutorial/index.md +62 -0
  72. package/kb/site/develop/framework/events.md +145 -0
  73. package/kb/site/develop/framework/index.md +139 -0
  74. package/kb/site/develop/framework/service.md +152 -0
  75. package/kb/site/develop/practice/index.md +157 -0
  76. package/kb/site/develop/practice/llm-adapter.md +190 -0
  77. package/kb/site/en/develop/basic/config.md +108 -0
  78. package/kb/site/en/develop/basic/index.md +146 -0
  79. package/kb/site/en/develop/basic/publish.md +185 -0
  80. package/kb/site/en/develop/basic/tool.md +54 -0
  81. package/kb/site/en/develop/cordis-tutorial/01-first-plugin.md +95 -0
  82. package/kb/site/en/develop/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
  83. package/kb/site/en/develop/cordis-tutorial/03-services.md +98 -0
  84. package/kb/site/en/develop/cordis-tutorial/04-events.md +144 -0
  85. package/kb/site/en/develop/cordis-tutorial/05-config.md +84 -0
  86. package/kb/site/en/develop/cordis-tutorial/06-composition-and-hmr.md +113 -0
  87. package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +107 -0
  88. package/kb/site/en/develop/cordis-tutorial/index.md +60 -0
  89. package/kb/site/en/develop/framework/events.md +145 -0
  90. package/kb/site/en/develop/framework/index.md +139 -0
  91. package/kb/site/en/develop/framework/service.md +150 -0
  92. package/kb/site/en/develop/practice/index.md +157 -0
  93. package/kb/site/en/develop/practice/llm-adapter.md +190 -0
  94. package/kb/site/en/guide/providers-custom-form.png +0 -0
  95. package/kb/site/en/guide/providers-models-page.png +0 -0
  96. package/kb/site/en/guide/providers.md +100 -0
  97. package/kb/site/en/guide/python-sdk.md +106 -0
  98. package/kb/site/en/guide/quickstart.md +32 -0
  99. package/kb/site/en/index.md +8 -0
  100. package/kb/site/en/reference/agent-lifecycle.md +86 -0
  101. package/kb/site/en/reference/capability-seams.md +475 -0
  102. package/kb/site/en/reference/config-catalog.md +3155 -0
  103. package/kb/site/en/reference/cookbook/adding-a-conversation-node.md +235 -0
  104. package/kb/site/en/reference/cookbook/adding-a-package.md +120 -0
  105. package/kb/site/en/reference/cookbook/adding-a-settings-card.md +102 -0
  106. package/kb/site/en/reference/cookbook/adding-a-tool.md +96 -0
  107. package/kb/site/en/reference/cookbook/adding-an-llm-adapter.md +45 -0
  108. package/kb/site/en/reference/cookbook/extension-cookbook.md +131 -0
  109. package/kb/site/en/reference/cordis-api/context.md +368 -0
  110. package/kb/site/en/reference/cordis-api/events.md +211 -0
  111. package/kb/site/en/reference/cordis-api/fiber.md +379 -0
  112. package/kb/site/en/reference/cordis-api/inherited.md +43 -0
  113. package/kb/site/en/reference/cordis-api/registry.md +156 -0
  114. package/kb/site/en/reference/cordis-api/service.md +106 -0
  115. package/kb/site/en/reference/cordis-primer.md +46 -0
  116. package/kb/site/en/reference/index.md +131 -0
  117. package/kb/site/en/reference/persistence-catalog.md +949 -0
  118. package/kb/site/en/reference/subsystems/approval.md +173 -0
  119. package/kb/site/en/reference/subsystems/client-modules.md +121 -0
  120. package/kb/site/en/reference/subsystems/code-runtime.md +194 -0
  121. package/kb/site/en/reference/subsystems/commands.md +190 -0
  122. package/kb/site/en/reference/subsystems/compaction.md +241 -0
  123. package/kb/site/en/reference/subsystems/core.md +1073 -0
  124. package/kb/site/en/reference/subsystems/credentials.md +136 -0
  125. package/kb/site/en/reference/subsystems/filesystem.md +498 -0
  126. package/kb/site/en/reference/subsystems/goal.md +280 -0
  127. package/kb/site/en/reference/subsystems/index.md +58 -0
  128. package/kb/site/en/reference/subsystems/invariants.md +91 -0
  129. package/kb/site/en/reference/subsystems/jobs.md +293 -0
  130. package/kb/site/en/reference/subsystems/llm-streaming.md +920 -0
  131. package/kb/site/en/reference/subsystems/lsp.md +205 -0
  132. package/kb/site/en/reference/subsystems/permission-presets.md +134 -0
  133. package/kb/site/en/reference/subsystems/persistence.md +388 -0
  134. package/kb/site/en/reference/subsystems/plan.md +90 -0
  135. package/kb/site/en/reference/subsystems/sandbox.md +221 -0
  136. package/kb/site/en/reference/subsystems/schedule.md +189 -0
  137. package/kb/site/en/reference/subsystems/scope.md +62 -0
  138. package/kb/site/en/reference/subsystems/session-projection.md +265 -0
  139. package/kb/site/en/reference/subsystems/session-query.md +498 -0
  140. package/kb/site/en/reference/subsystems/session-reference.md +111 -0
  141. package/kb/site/en/reference/subsystems/session-telemetry.md +197 -0
  142. package/kb/site/en/reference/subsystems/session-title.md +207 -0
  143. package/kb/site/en/reference/subsystems/session.md +852 -0
  144. package/kb/site/en/reference/subsystems/settings.md +313 -0
  145. package/kb/site/en/reference/subsystems/shell.md +306 -0
  146. package/kb/site/en/reference/subsystems/skills.md +334 -0
  147. package/kb/site/en/reference/subsystems/spill.md +120 -0
  148. package/kb/site/en/reference/subsystems/storage.md +232 -0
  149. package/kb/site/en/reference/subsystems/subagent.md +737 -0
  150. package/kb/site/en/reference/subsystems/subprocess.md +327 -0
  151. package/kb/site/en/reference/subsystems/system-prompt.md +210 -0
  152. package/kb/site/en/reference/subsystems/terminal.md +187 -0
  153. package/kb/site/en/reference/subsystems/token-meter.md +93 -0
  154. package/kb/site/en/reference/subsystems/tools.md +723 -0
  155. package/kb/site/en/reference/subsystems/typert.md +339 -0
  156. package/kb/site/en/reference/subsystems/user-questions.md +181 -0
  157. package/kb/site/en/reference/subsystems/web-server.md +111 -0
  158. package/kb/site/en/reference/subsystems/web.md +202 -0
  159. package/kb/site/en/reference/subsystems/workflow.md +281 -0
  160. package/kb/site/en/reference/subsystems/workspace.md +231 -0
  161. package/kb/site/en/reference/tool-catalog.md +1877 -0
  162. package/kb/site/en/reference/tool-execution-pipeline.md +66 -0
  163. package/kb/site/guide/providers-custom-form.zh.png +0 -0
  164. package/kb/site/guide/providers-models-page.zh.png +0 -0
  165. package/kb/site/guide/providers.md +100 -0
  166. package/kb/site/guide/python-sdk.md +106 -0
  167. package/kb/site/guide/quickstart.md +32 -0
  168. package/kb/site/index.md +8 -0
  169. package/kb/site/reference/agent-lifecycle.md +86 -0
  170. package/kb/site/reference/capability-seams.md +475 -0
  171. package/kb/site/reference/config-catalog.md +3154 -0
  172. package/kb/site/reference/cookbook/adding-a-conversation-node.md +235 -0
  173. package/kb/site/reference/cookbook/adding-a-package.md +120 -0
  174. package/kb/site/reference/cookbook/adding-a-settings-card.md +102 -0
  175. package/kb/site/reference/cookbook/adding-a-tool.md +98 -0
  176. package/kb/site/reference/cookbook/adding-an-llm-adapter.md +45 -0
  177. package/kb/site/reference/cookbook/extension-cookbook.md +133 -0
  178. package/kb/site/reference/cordis-api/context.md +368 -0
  179. package/kb/site/reference/cordis-api/events.md +211 -0
  180. package/kb/site/reference/cordis-api/fiber.md +379 -0
  181. package/kb/site/reference/cordis-api/inherited.md +43 -0
  182. package/kb/site/reference/cordis-api/registry.md +156 -0
  183. package/kb/site/reference/cordis-api/service.md +106 -0
  184. package/kb/site/reference/cordis-primer.md +52 -0
  185. package/kb/site/reference/index.md +135 -0
  186. package/kb/site/reference/persistence-catalog.md +949 -0
  187. package/kb/site/reference/subsystems/approval.md +173 -0
  188. package/kb/site/reference/subsystems/client-modules.md +121 -0
  189. package/kb/site/reference/subsystems/code-runtime.md +194 -0
  190. package/kb/site/reference/subsystems/commands.md +190 -0
  191. package/kb/site/reference/subsystems/compaction.md +241 -0
  192. package/kb/site/reference/subsystems/core.md +1081 -0
  193. package/kb/site/reference/subsystems/credentials.md +136 -0
  194. package/kb/site/reference/subsystems/filesystem.md +498 -0
  195. package/kb/site/reference/subsystems/goal.md +280 -0
  196. package/kb/site/reference/subsystems/index.md +58 -0
  197. package/kb/site/reference/subsystems/invariants.md +91 -0
  198. package/kb/site/reference/subsystems/jobs.md +293 -0
  199. package/kb/site/reference/subsystems/llm-streaming.md +926 -0
  200. package/kb/site/reference/subsystems/lsp.md +205 -0
  201. package/kb/site/reference/subsystems/permission-presets.md +134 -0
  202. package/kb/site/reference/subsystems/persistence.md +388 -0
  203. package/kb/site/reference/subsystems/plan.md +90 -0
  204. package/kb/site/reference/subsystems/sandbox.md +221 -0
  205. package/kb/site/reference/subsystems/schedule.md +189 -0
  206. package/kb/site/reference/subsystems/scope.md +62 -0
  207. package/kb/site/reference/subsystems/session-projection.md +265 -0
  208. package/kb/site/reference/subsystems/session-query.md +498 -0
  209. package/kb/site/reference/subsystems/session-reference.md +111 -0
  210. package/kb/site/reference/subsystems/session-telemetry.md +197 -0
  211. package/kb/site/reference/subsystems/session-title.md +207 -0
  212. package/kb/site/reference/subsystems/session.md +854 -0
  213. package/kb/site/reference/subsystems/settings.md +313 -0
  214. package/kb/site/reference/subsystems/shell.md +306 -0
  215. package/kb/site/reference/subsystems/skills.md +334 -0
  216. package/kb/site/reference/subsystems/spill.md +120 -0
  217. package/kb/site/reference/subsystems/storage.md +232 -0
  218. package/kb/site/reference/subsystems/subagent.md +739 -0
  219. package/kb/site/reference/subsystems/subprocess.md +327 -0
  220. package/kb/site/reference/subsystems/system-prompt.md +210 -0
  221. package/kb/site/reference/subsystems/terminal.md +187 -0
  222. package/kb/site/reference/subsystems/token-meter.md +93 -0
  223. package/kb/site/reference/subsystems/tools.md +723 -0
  224. package/kb/site/reference/subsystems/typert.md +339 -0
  225. package/kb/site/reference/subsystems/user-questions.md +181 -0
  226. package/kb/site/reference/subsystems/web-server.md +111 -0
  227. package/kb/site/reference/subsystems/web.md +202 -0
  228. package/kb/site/reference/subsystems/workflow.md +281 -0
  229. package/kb/site/reference/subsystems/workspace.md +231 -0
  230. package/kb/site/reference/tool-catalog.md +1880 -0
  231. package/kb/site/reference/tool-execution-pipeline.md +66 -0
  232. package/package.json +40 -0
  233. package/scripts/rebuild-index.mjs +88 -0
  234. package/skills/dsh-plugin-dev-kb.md +66 -0
@@ -0,0 +1,156 @@
1
+ ---
2
+ editSource: "docs/cordis-api/registry.md"
3
+ ---
4
+
5
+ <!-- Generated by scripts/gen-cordis-catalog.ts — do not edit by hand.
6
+ Run `pnpm run gen-cordis-catalog` to regenerate. -->
7
+
8
+ # Registry
9
+
10
+ Plugin loading and dependency injection.
11
+
12
+ ### ctx.inject(deps, callback)
13
+
14
+ ```ts cordis-catalog
15
+ /**
16
+ * Run a callback once the requested services are available.
17
+ *
18
+ * Shorthand for `ctx.plugin({ inject, apply: callback })`: the callback
19
+ * is unloaded and re-run whenever a required service changes.
20
+ *
21
+ * @param deps — required services, as an array or a name → config map.
22
+ * @param callback — plugin body called with `(ctx, config)`.
23
+ * @returns the fiber; awaiting it settles once loading finished.
24
+ */
25
+ inject(deps: Inject, callback: Plugin.Function<void>): Fiber & PromiseLike<Fiber>
26
+ ```
27
+
28
+ Run a callback once the requested services are available.
29
+
30
+ Shorthand for `ctx.plugin({ inject, apply: callback })`: the callback is unloaded and re-run whenever a required service changes.
31
+
32
+ - `deps` — required services, as an array or a name → config map.
33
+ - `callback` — plugin body called with `(ctx, config)`.
34
+
35
+ **Returns** the fiber; awaiting it settles once loading finished.
36
+
37
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/registry.ts#L176)
38
+
39
+ ### ctx.plugin(plugin, ...args)
40
+
41
+ ```ts cordis-catalog
42
+ /**
43
+ * Load a plugin in the current context.
44
+ *
45
+ * @param plugin — a function, class, or `{ apply }` object plugin.
46
+ * @param args — the plugin config, validated against its `Config` schema.
47
+ * @returns the fiber; awaiting it settles once loading finished
48
+ * (rejecting on config or startup errors).
49
+ */
50
+ plugin<P extends Plugin>(plugin: P, ...args: Spread<GetPluginConfig<P>>): Fiber & PromiseLike<Fiber>
51
+ ```
52
+
53
+ Load a plugin in the current context.
54
+
55
+ - `plugin` — a function, class, or `{ apply }` object plugin.
56
+ - `args` — the plugin config, validated against its `Config` schema.
57
+
58
+ **Returns** the fiber; awaiting it settles once loading finished (rejecting on config or startup errors).
59
+
60
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/registry.ts#L185)
61
+
62
+ ## Plugin
63
+
64
+ Supported plugin entrypoint shapes.
65
+
66
+ ```ts cordis-catalog
67
+ /** Supported plugin entrypoint shapes. */
68
+ type Plugin<T = any> =
69
+ | Plugin.Function<T>
70
+ | Plugin.Constructor<T>
71
+ | Plugin.Object<T>
72
+
73
+ /** Types associated with plugin entrypoints and runtime records. */
74
+ namespace Plugin {
75
+ /** Shared metadata understood by the plugin registry and related tooling. */
76
+ export interface Base<T = any> {
77
+ /** Display name used for fiber diagnostics and logger names. */
78
+ name?: string
79
+ /** Standard-schema validator applied to config before the plugin starts. */
80
+ Config?: StandardSchemaV1<any, T>
81
+ /** Services the plugin requires; it only loads while all are available. */
82
+ inject?: Inject
83
+ /** Service name(s) the plugin provides (read by `Service` and by loaders). */
84
+ provide?: string | string[]
85
+ /** Service names whose intercept config the plugin declares it consumes. */
86
+ intercept?: Dict<boolean>
87
+ }
88
+
89
+ export interface Transform<S, T> {
90
+ /** Marks the transform object as a schema/config transform. */
91
+ schema?: true
92
+ /** Convert user-facing config to runtime config. */
93
+ Config: (config: S) => T
94
+ }
95
+
96
+ /** Function plugin called with `(ctx, config)`. */
97
+ export interface Function<T = any> extends Base<T> {
98
+ (ctx: Context, config: T): any
99
+ }
100
+
101
+ /** Class plugin constructed with `(ctx, config)`. */
102
+ export interface Constructor<T = any> extends Base<T> {
103
+ new (ctx: Context, config: T): any
104
+ }
105
+
106
+ /** Object plugin with an `apply(ctx, config)` method. */
107
+ export interface Object<T = any> extends Base<T> {
108
+ apply(ctx: Context, config: T): any
109
+ }
110
+
111
+ /** Mutable registry record shared by all fibers of one plugin callback. */
112
+ export interface Runtime {
113
+ /** Display name copied from the first registered plugin shape. */
114
+ name?: string
115
+ /** Every live fiber of this plugin (one per `ctx.plugin()` call). */
116
+ fibers: DisposableList<Fiber>
117
+ /** The executable entrypoint all fibers share (registry identity key). */
118
+ callback: globalThis.Function
119
+ /** Standard-schema validator applied to each fiber's config. */
120
+ Config?: StandardSchemaV1
121
+ }
122
+ }
123
+ ```
124
+
125
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/registry.ts#L92)
126
+
127
+ ## Inject
128
+
129
+ Service dependency declaration accepted by plugins and the `@Inject` decorator.
130
+
131
+ Array form requests services without intercept config. Object form maps each service name to optional intercept config for the plugin context.
132
+
133
+ ```ts cordis-catalog
134
+ /**
135
+ * Service dependency declaration accepted by plugins and the `@Inject`
136
+ * decorator.
137
+ *
138
+ * Array form requests services without intercept config. Object form maps each
139
+ * service name to optional intercept config for the plugin context.
140
+ */
141
+ type Inject<M = Dict> = (keyof M)[] | { [K in keyof M]?: M[K] }
142
+
143
+ /** Utilities for normalizing plugin dependency declarations. */
144
+ namespace Inject {
145
+ /**
146
+ * Convert array/object/class-inherited inject metadata into a plain map.
147
+ *
148
+ * @param inject — the declaration to normalize; `null`/`undefined` add nothing.
149
+ * @param result — the map to fill (service name → intercept config or `null`).
150
+ * @returns `result`.
151
+ */
152
+ export function resolve(inject: Inject | null | undefined, result: Dict = Object.create(null))
153
+ }
154
+ ```
155
+
156
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/registry.ts#L19)
@@ -0,0 +1,106 @@
1
+ ---
2
+ editSource: "docs/cordis-api/service.md"
3
+ ---
4
+
5
+ <!-- Generated by scripts/gen-cordis-catalog.ts — do not edit by hand.
6
+ Run `pnpm run gen-cordis-catalog` to regenerate. -->
7
+
8
+ # Service
9
+
10
+ The base class for context services. A subclass loaded as a plugin registers itself as `ctx.<name>`.
11
+
12
+ Base class for services that expose a named API on `ctx`.
13
+
14
+ Subclasses call `super(ctx, name)` from their constructor. The service is registered immediately and is automatically removed with the owning fiber.
15
+
16
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L11)
17
+
18
+ ### service.name
19
+
20
+ ```ts cordis-catalog
21
+ /** The service name this instance is registered under. */
22
+ public name!: string
23
+ ```
24
+
25
+ The service name this instance is registered under.
26
+
27
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L30)
28
+
29
+ ## Static members
30
+
31
+ ### Service.init
32
+
33
+ ```ts cordis-catalog
34
+ /** Symbol key of an instance method run after construction (class plugins). */
35
+ static readonly init: unique symbol
36
+ ```
37
+
38
+ Symbol key of an instance method run after construction (class plugins).
39
+
40
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L13)
41
+
42
+ ### Service.check
43
+
44
+ ```ts cordis-catalog
45
+ /** Symbol key of the availability predicate passed to `ctx.provide()`. */
46
+ static readonly check: unique symbol
47
+ ```
48
+
49
+ Symbol key of the availability predicate passed to `ctx.provide()`.
50
+
51
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L15)
52
+
53
+ ### Service.config
54
+
55
+ ```ts cordis-catalog
56
+ /** Symbol key of the phantom intercept-config type parameter. */
57
+ static readonly config: unique symbol
58
+ ```
59
+
60
+ Symbol key of the phantom intercept-config type parameter.
61
+
62
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L17)
63
+
64
+ ### Service.invoke
65
+
66
+ ```ts cordis-catalog
67
+ /** Symbol key of the call body making a service callable (e.g. `ctx.logger()`). */
68
+ static readonly invoke: unique symbol
69
+ ```
70
+
71
+ Symbol key of the call body making a service callable (e.g. `ctx.logger()`).
72
+
73
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L19)
74
+
75
+ ### Service.extend
76
+
77
+ ```ts cordis-catalog
78
+ /** Symbol key of the helper deriving an extended service instance. */
79
+ static readonly extend: unique symbol
80
+ ```
81
+
82
+ Symbol key of the helper deriving an extended service instance.
83
+
84
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L21)
85
+
86
+ ### Service.tracker
87
+
88
+ ```ts cordis-catalog
89
+ /** Symbol key of the tracker metadata used for context tracing. */
90
+ static readonly tracker: unique symbol
91
+ ```
92
+
93
+ Symbol key of the tracker metadata used for context tracing.
94
+
95
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L23)
96
+
97
+ ### Service.resolveConfig
98
+
99
+ ```ts cordis-catalog
100
+ /** Symbol key of the intercept-config resolution helper below. */
101
+ static readonly resolveConfig: unique symbol
102
+ ```
103
+
104
+ Symbol key of the intercept-config resolution helper below.
105
+
106
+ [Source](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/cordis/src/service.ts#L25)
@@ -0,0 +1,46 @@
1
+ ---
2
+ editSource: "docs/cordis-primer.md"
3
+ ---
4
+
5
+ # Cordis Primer
6
+
7
+ Cordis is the vendored plugin framework underneath DeepSeek Harness. This primer teaches the Cordis ideas a harness plugin author needs before reading the generated service/event reference on the [subsystem pages](./subsystems/core.md); the [Cordis tutorial](../develop/cordis-tutorial/index.md) walks the same ideas hands-on. The vendored source and sync procedure live in [vendor/README.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/vendor/README.md).
8
+
9
+ ## Cordis In Five Ideas
10
+
11
+ - **A plugin is a object that implements Service.** It can be a function with optional `inject` and `apply(ctx)` fields, or a `Service` subclass whose lifecycle Cordis mounts into the current context.
12
+ - **A context is a repository of services.** A service claims a stable `ctx.<key>` such as `ctx.tools`, `ctx.llm`, or `ctx.sessions` from a context; other plugins find services via key instead of importing a concrete implementation.
13
+ - **Declare service dependency via `inject`.** A plugin that names required services waits until those services exist, so load order is expressed through service requirements rather than manual boot sequencing.
14
+ - **Typed Events for communication.** Services declare event names through TypeScript declaration merging, then dispatch them as `emit`, `waterfall`, `parallel`, or `serial` depending on whether listeners observe, wrap, fan out, or run in order.
15
+ - **Registrations are reversible effects.** Prompt sections, tool schemas, adapters, providers, and listeners are installed through `ctx.effect()` or `ctx.on()` so reload and teardown unwind them predictably.
16
+
17
+ ## Dispatch Modes
18
+
19
+ Every event can have one of the following dispatch mode and can only be dispatched by these methods accordingly.
20
+
21
+ | Mode | Awaited? | Dispatch Order | Has Return Value? |
22
+ |---|---|---|---|
23
+ | `emit` | No | listeners observe in registration order | No |
24
+ | `waterfall` | No | listeners observe in registration order | Yes |
25
+ | `parallel` | Yes | all listeners observe the event in parallel | No |
26
+ | `serial` | Yes | listeners observe in registration order | Yes |
27
+
28
+ The dispatch mode is part of the event's public contract. New harness events document it with an `@mode` tag so the generated catalog can check declarations against dispatch sites.
29
+
30
+ ## Cordis Waterfall Semantics
31
+
32
+ `ctx.waterfall` is around-middleware. A listener receives `(...args, next)`. Call `next()` to delegate the possibly wrapped result to the next service; return without `next()` to short-circuit. Values propagate through `next()`'s return value.
33
+
34
+ Cooperative listeners usually mutate a shared request or decision object and then delegate. A listener can also choose to replace the result entirely and downstream listeners will only see the result after replacement. Use `prepend: true` only when the listener must run before ordinary registrations.
35
+
36
+ For single-decision events, short-circuiting is the design. A policy listener can return without `next()` when it owns the decision, while a listener that only annotates or observes must delegate.
37
+
38
+ ## Loader Configuration
39
+
40
+ `@deepseek-ai/cordis-plugin-include` parses `!!js` into expression nodes. Loader interpolates an entry's `config` (after declared injections activate, against that plugin context — `ctx.serviceName`) and its `disabled` field (at every mount decision, against the loader context); Include preserves nested row expressions until target activation. Other entry metadata stays literal. Use overlays when the environment selects plugins.
41
+
42
+ ## Practical Rules
43
+
44
+ Encapsulate behavior into plugins: a tool pipeline event belongs to `ctx.tools`, model streaming belongs to `ctx.llm`, and live agent coordination belongs to `ctx.agents`. Prefer events for interception and policy; prefer service methods for direct capability calls.
45
+
46
+ Every registration should have a disposer, either by returning one from `ctx.effect()` or using a Cordis helper that does it for you. If teardown order matters, keep the related work in one effect so disposal unwinds in the intended sequence.
@@ -0,0 +1,131 @@
1
+ ---
2
+ editSource: "docs/architecture.md"
3
+ ---
4
+
5
+ # DeepSeek Harness Architecture
6
+
7
+ Read this before changing anything under `packages/`. It assumes you know Cordis; if you do not, start with the [primer](./cordis-primer.md) or the [tutorial](../develop/cordis-tutorial/index.md).
8
+
9
+ We recommend using an agent to explore the codebase and understand its architecture.
10
+
11
+ ## Cordis
12
+
13
+ [Cordis](./cordis-primer.md) is the framework under dsh: plugins contribute services, typed events, and reversible effects to a shared context. Every part of the product is a plugin, including the model adapter, the tool registry, the session log, and the agent loop itself, so every part is replaceable from configuration.
14
+
15
+ There is no privileged core to patch: you extend dsh by mounting a plugin beside the others, and registrations are effects that unwind when their plugin unloads.
16
+
17
+ ## Profiles and bundles
18
+
19
+ A running `dsh` is a plugin tree composed at boot from ordered layers.
20
+
21
+ A **profile** is a named composition stored in the Harness home. It lists the bundles it stacks, holds any out-of-tree plugins it installs, and keeps the user's own `cordis.patch.yml`. `web` and `headless` ship as templates.
22
+
23
+ A **bundle** is a distribution format for Cordis config rows and the code they mount, so whatever it inserts stays patchable by the layers above it.
24
+
25
+ Each declares itself in its own `package.json` under a `dsh` field: `dsh.profile` lists a profile's bundles, and `dsh.bundle` points at a bundle's patch file.
26
+
27
+ [`dsh-base`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/bundle/base/README.md) is the first layer of every profile: model adapters, tools, persistence, sandbox and approval policy, settings, credentials, telemetry. [`dsh-web-app`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/bundle/web-app/README.md) adds the browser application; [`dsh-headless`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/bundle/headless/README.md) adds a one-shot runner with no server at all.
28
+
29
+ Layers apply to an empty entry list in this order: each bundle in the profile's listed order, then the profile's `cordis.patch.yml`, then the home-level one, then any `--patch` overlay. A patch targets a row by id and replaces its whole config, or inserts new rows.
30
+
31
+ To see the tree your machine actually boots:
32
+
33
+ ```sh
34
+ dsh --profile web --dump-config
35
+ ```
36
+
37
+ Any row it prints can be replaced by a patch of your own.
38
+
39
+ Composition mechanics are in [app-boot](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/boot/app-boot/README.md#profiles); config fields are in the generated [config catalog](./config-catalog.md).
40
+
41
+ ## Core packages
42
+
43
+ Here are some core packages that contribute to the Cordis tree.
44
+
45
+ | Package | Owns | `ctx` key |
46
+ |---|---|---|
47
+ | [`core/session`](./subsystems/session.md) | The append-only `SessionEvent` log and in-memory store | `ctx.sessions` |
48
+ | [`core/system-prompt`](./subsystems/system-prompt.md) | Prompt-section and tool-schema assembly | `ctx.systemPrompt` |
49
+ | [`core/tools`](./subsystems/tools.md) | The scoped tool registry and guarded execution pipeline | `ctx.tools` |
50
+ | [`core/agent`](./subsystems/core.md) | The `Agent` interface, live registry, and `agent/*` events | `ctx.agents` |
51
+ | [`core/agent-loop`](./subsystems/core.md) | The default driver implementing that interface | `ctx.agentLoop` |
52
+ | [`core/scope`](./subsystems/scope.md) | The per-agent scoped-registration primitive | library, no key |
53
+ | [`llm/llm`](./subsystems/llm-streaming.md) | Message and stream vocabulary plus the adapter seam | `ctx.llm` |
54
+
55
+ ## Events
56
+
57
+ Events are the extension points, and picking the right domain is the first decision in most changes.
58
+
59
+ - **Session events** are durable facts appended to the log and broadcast through `session/event`. Use one when the fact must survive a reload.
60
+ - **Agent events** (`agent/*`) carry a live `Agent`: inbox, step, status, request, validation, continuation. Use one to observe or intercept work in flight.
61
+ - **Capability events** attach policy and adapters to a seam (`fs/*`, `tools/*`, `telemetry/*`) without importing the loop.
62
+
63
+ The [event map](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/event-producer-consumer.md) lists every event's producers and consumers.
64
+
65
+ ## Turn flow
66
+
67
+ A **step** is one model request plus the tools it calls. A **turn** is zero or more steps: it opens before its first input is claimed and closes once nothing is owed.
68
+
69
+ ```text
70
+ turn/start
71
+ claim next-step input plus one queued message
72
+ assemble prompt sections + tool schemas
73
+ -> agent/pre-step reject | enter(messages)
74
+ reject, or a first enter rewritten empty -> close the turn with no step
75
+ step/start
76
+ append entered messages as user/message
77
+ derive model history from the log
78
+ agent/request -> llm/stream -> assistant/chunk* -> assistant/message
79
+ tool/call* -> tools/pre-execute -> tools/execute -> tools/post-execute -> tool/result*
80
+ step/end
81
+ tools owe another request, or next-step input arrived -> claim -> next step
82
+ -> agent/turn-stopping
83
+ turn/end
84
+ ```
85
+
86
+ `turn/*`, `step/*`, `user/message`, `assistant/*`, and `tool/*` are durable session events; the rest are live extension points across three domains. `agent/pre-step`, `agent/request`, `llm/stream`, and the three `tools/*` events are waterfalls, whose listeners must call `next()` to delegate; `agent/turn-stopping` is serial and has no `next()`.
87
+
88
+ Input reaches the driver through one inbox. Some messages wake it immediately; injected context waits in the inbox until another message does.
89
+
90
+ `agent/pre-step` decides what the model sees. Listeners may rewrite the claimed messages or reject them outright; a rejected or empty first claim still closes a durable turn that spent no step, so the log records the attempt. Each step reads the prompt sections and tool schemas that plugins registered.
91
+
92
+ Details: the [sequence diagram](./agent-lifecycle.md), the [tool pipeline](./tool-execution-pipeline.md), and [cancellation and error recovery](./subsystems/core.md#the-agent-handle).
93
+
94
+ ## Session log
95
+
96
+ The session log is the source of the context the model sees. `deriveMessages()` projects model history from it, and raw `assistant/chunk` events preserve replay and UI fidelity. Fork, resume, transcripts, telemetry, and persistence all derive from this stream.
97
+
98
+ **Model-visible means logged.** Anything that reaches a model request must be reconstructable from the log, and a runtime invariant asserts it. This is why a new model-visible input requires a new session event: extend `SessionEventMap` and render from the log.
99
+
100
+ ## Capability seams
101
+
102
+ A **seam** is a swappable capability with three roles: a **Service Definition** declaring the interface, a **Service Provider** implementing it, and a **Consumer** using it, commonly a model-facing tool. A package may combine roles, but one role alone is not a seam; adding a capability means designing all three ([capability graph](./capability-seams.md)).
103
+
104
+ Seams are why one provider swap changes the whole product. Filesystem and subprocess providers share one execution world, so pointing them at a remote sandbox moves Bash, PTY, and LSP with them, with no provider forks. [Subagent providers](./subsystems/subagent.md) vary just as widely behind one interface, from a fresh child agent to a delegated turn in another product.
105
+
106
+ ## Where new behavior goes
107
+
108
+ New behavior attaches to a documented extension point. Changing the loop itself updates this map.
109
+
110
+ | Goal | Mechanism |
111
+ |---|---|
112
+ | Add a model provider | register its adapter on `ctx.llm` |
113
+ | Add a model-facing capability | register on `ctx.tools`; its schema joins prompt assembly |
114
+ | Give one session a different capability set | compose an agent preset; a service row there needs an `isolate` realm |
115
+ | Add shell execution | register a `ctx.shell` backend; the local one spawns through `ctx.subprocess` |
116
+ | Add persistent terminal execution | register a `ctx.terminals` backend plus `dsh-tool-terminal` |
117
+ | Add a human command | register on `ctx.commands`; it dispatches without a model turn |
118
+ | Add background work | register on `ctx.jobs`; `job_*` tools collect or stop it |
119
+ | Add filesystem access or policy | register a `ctx.fs` provider or listen to `fs/*` events |
120
+ | Confine spawned processes | use a `ctx.sandbox` backend; consumers wrap argv before spawning |
121
+ | Intercept a request, tool, or turn | use its `agent/*` or `tools/*` event; `agent/turn-stopping` stops a turn |
122
+ | Add model-facing context | call `agent.inject()`; it lands in the next admitted request |
123
+ | Add UI or editor integration | drive `ctx.agents` and render from `session/event` |
124
+ | Add a Web Client Chat node | register a `ConversationNodeDefinition` + keyed renderer |
125
+ | Add durable session state | extend `SessionEventMap`; render and replay from the log |
126
+ | Generate session titles | register the sole `ctx.sessionTitle` provider |
127
+ | Manage a same-session objective | use `ctx.goals`; continue through `agent/*` |
128
+ | Fork a live session | `ctx.sessions.fork(source, boundary?, childSessionId?)` |
129
+ | Scope a registration to one agent | use that agent's `agent.ctx` |
130
+
131
+ The [extension cookbook](./cookbook/extension-cookbook.md) maps features to capabilities and indexes the step-by-step guides for [packages](./cookbook/adding-a-package.md), [tools](./cookbook/adding-a-tool.md), [LLM adapters](./cookbook/adding-an-llm-adapter.md), [Chat nodes](./cookbook/adding-a-conversation-node.md), and [settings cards](./cookbook/adding-a-settings-card.md).