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.
- package/LICENSE +21 -0
- package/README.md +56 -0
- package/cordis.patch.yml +12 -0
- package/kb/INDEX.md +210 -0
- package/kb/README.md +69 -0
- package/kb/extra/AGENTS.md +75 -0
- package/kb/extra/api-gateway.md +164 -0
- package/kb/extra/api-gateway.zh.md +164 -0
- package/kb/extra/cookbook/adding-a-vendored-package.md +59 -0
- package/kb/extra/cookbook/adding-a-vendored-package.zh.md +59 -0
- package/kb/extra/cookbook/maintaining-dsh-code-review.md +64 -0
- package/kb/extra/cookbook/maintaining-dsh-code-review.zh.md +64 -0
- package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.md +32 -0
- package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.zh.md +32 -0
- package/kb/extra/defensive-patterns.md +33 -0
- package/kb/extra/defensive-patterns.zh.md +33 -0
- package/kb/extra/development.md +171 -0
- package/kb/extra/development.zh.md +171 -0
- package/kb/extra/event-producer-consumer.md +76 -0
- package/kb/extra/event-producer-consumer.zh.md +78 -0
- package/kb/extra/glossary.md +45 -0
- package/kb/extra/glossary.zh.md +45 -0
- package/kb/extra/graph-atlas.md +24 -0
- package/kb/extra/graph-atlas.zh.md +26 -0
- package/kb/extra/i18n/README.md +60 -0
- package/kb/extra/i18n/README.zh.md +60 -0
- package/kb/extra/i18n/style-samples.md +87 -0
- package/kb/extra/i18n/terminology.md +214 -0
- package/kb/extra/i18n/translation-prompt.md +263 -0
- package/kb/extra/i18n/translation-rules.md +69 -0
- package/kb/extra/i18n/translation-rules.zh.md +69 -0
- package/kb/extra/module-graph.md +1641 -0
- package/kb/extra/module-graph.zh.md +1643 -0
- package/kb/extra/postmortem/0001-acp-default-export-drops-inject.md +113 -0
- package/kb/extra/postmortem/0001-acp-default-export-drops-inject.zh.md +113 -0
- package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.md +47 -0
- package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +47 -0
- package/kb/extra/postmortem/0003-web-agent-gui-feedback-loop.md +53 -0
- package/kb/extra/postmortem/0003-web-agent-gui-feedback-loop.zh.md +53 -0
- package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +55 -0
- package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +55 -0
- package/kb/extra/postmortem/README.md +18 -0
- package/kb/extra/postmortem/README.zh.md +18 -0
- package/kb/extra/rescope.md +53 -0
- package/kb/extra/rescope.zh.md +53 -0
- package/kb/extra/subsystems/attachment.md +125 -0
- package/kb/extra/subsystems/attachment.zh.md +125 -0
- package/kb/extra/subsystems/extensions.md +364 -0
- package/kb/extra/subsystems/extensions.zh.md +364 -0
- package/kb/extra/subsystems/feedback.md +266 -0
- package/kb/extra/subsystems/feedback.zh.md +266 -0
- package/kb/extra/testing.md +49 -0
- package/kb/extra/testing.zh.md +49 -0
- package/kb/extra/web-styling.md +25 -0
- package/kb/extra/web-styling.zh.md +25 -0
- package/kb/meta/search-index.json +1328 -0
- package/kb/meta/site-pages.txt +168 -0
- package/kb/meta/source.json +13 -0
- package/kb/meta/topics.md +75 -0
- package/kb/site/develop/basic/config.md +108 -0
- package/kb/site/develop/basic/index.md +146 -0
- package/kb/site/develop/basic/publish.md +185 -0
- package/kb/site/develop/basic/tool.md +54 -0
- package/kb/site/develop/cordis-tutorial/01-first-plugin.md +95 -0
- package/kb/site/develop/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
- package/kb/site/develop/cordis-tutorial/03-services.md +98 -0
- package/kb/site/develop/cordis-tutorial/04-events.md +144 -0
- package/kb/site/develop/cordis-tutorial/05-config.md +84 -0
- package/kb/site/develop/cordis-tutorial/06-composition-and-hmr.md +113 -0
- package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +107 -0
- package/kb/site/develop/cordis-tutorial/index.md +62 -0
- package/kb/site/develop/framework/events.md +145 -0
- package/kb/site/develop/framework/index.md +139 -0
- package/kb/site/develop/framework/service.md +152 -0
- package/kb/site/develop/practice/index.md +157 -0
- package/kb/site/develop/practice/llm-adapter.md +190 -0
- package/kb/site/en/develop/basic/config.md +108 -0
- package/kb/site/en/develop/basic/index.md +146 -0
- package/kb/site/en/develop/basic/publish.md +185 -0
- package/kb/site/en/develop/basic/tool.md +54 -0
- package/kb/site/en/develop/cordis-tutorial/01-first-plugin.md +95 -0
- package/kb/site/en/develop/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
- package/kb/site/en/develop/cordis-tutorial/03-services.md +98 -0
- package/kb/site/en/develop/cordis-tutorial/04-events.md +144 -0
- package/kb/site/en/develop/cordis-tutorial/05-config.md +84 -0
- package/kb/site/en/develop/cordis-tutorial/06-composition-and-hmr.md +113 -0
- package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +107 -0
- package/kb/site/en/develop/cordis-tutorial/index.md +60 -0
- package/kb/site/en/develop/framework/events.md +145 -0
- package/kb/site/en/develop/framework/index.md +139 -0
- package/kb/site/en/develop/framework/service.md +150 -0
- package/kb/site/en/develop/practice/index.md +157 -0
- package/kb/site/en/develop/practice/llm-adapter.md +190 -0
- package/kb/site/en/guide/providers-custom-form.png +0 -0
- package/kb/site/en/guide/providers-models-page.png +0 -0
- package/kb/site/en/guide/providers.md +100 -0
- package/kb/site/en/guide/python-sdk.md +106 -0
- package/kb/site/en/guide/quickstart.md +32 -0
- package/kb/site/en/index.md +8 -0
- package/kb/site/en/reference/agent-lifecycle.md +86 -0
- package/kb/site/en/reference/capability-seams.md +475 -0
- package/kb/site/en/reference/config-catalog.md +3155 -0
- package/kb/site/en/reference/cookbook/adding-a-conversation-node.md +235 -0
- package/kb/site/en/reference/cookbook/adding-a-package.md +120 -0
- package/kb/site/en/reference/cookbook/adding-a-settings-card.md +102 -0
- package/kb/site/en/reference/cookbook/adding-a-tool.md +96 -0
- package/kb/site/en/reference/cookbook/adding-an-llm-adapter.md +45 -0
- package/kb/site/en/reference/cookbook/extension-cookbook.md +131 -0
- package/kb/site/en/reference/cordis-api/context.md +368 -0
- package/kb/site/en/reference/cordis-api/events.md +211 -0
- package/kb/site/en/reference/cordis-api/fiber.md +379 -0
- package/kb/site/en/reference/cordis-api/inherited.md +43 -0
- package/kb/site/en/reference/cordis-api/registry.md +156 -0
- package/kb/site/en/reference/cordis-api/service.md +106 -0
- package/kb/site/en/reference/cordis-primer.md +46 -0
- package/kb/site/en/reference/index.md +131 -0
- package/kb/site/en/reference/persistence-catalog.md +949 -0
- package/kb/site/en/reference/subsystems/approval.md +173 -0
- package/kb/site/en/reference/subsystems/client-modules.md +121 -0
- package/kb/site/en/reference/subsystems/code-runtime.md +194 -0
- package/kb/site/en/reference/subsystems/commands.md +190 -0
- package/kb/site/en/reference/subsystems/compaction.md +241 -0
- package/kb/site/en/reference/subsystems/core.md +1073 -0
- package/kb/site/en/reference/subsystems/credentials.md +136 -0
- package/kb/site/en/reference/subsystems/filesystem.md +498 -0
- package/kb/site/en/reference/subsystems/goal.md +280 -0
- package/kb/site/en/reference/subsystems/index.md +58 -0
- package/kb/site/en/reference/subsystems/invariants.md +91 -0
- package/kb/site/en/reference/subsystems/jobs.md +293 -0
- package/kb/site/en/reference/subsystems/llm-streaming.md +920 -0
- package/kb/site/en/reference/subsystems/lsp.md +205 -0
- package/kb/site/en/reference/subsystems/permission-presets.md +134 -0
- package/kb/site/en/reference/subsystems/persistence.md +388 -0
- package/kb/site/en/reference/subsystems/plan.md +90 -0
- package/kb/site/en/reference/subsystems/sandbox.md +221 -0
- package/kb/site/en/reference/subsystems/schedule.md +189 -0
- package/kb/site/en/reference/subsystems/scope.md +62 -0
- package/kb/site/en/reference/subsystems/session-projection.md +265 -0
- package/kb/site/en/reference/subsystems/session-query.md +498 -0
- package/kb/site/en/reference/subsystems/session-reference.md +111 -0
- package/kb/site/en/reference/subsystems/session-telemetry.md +197 -0
- package/kb/site/en/reference/subsystems/session-title.md +207 -0
- package/kb/site/en/reference/subsystems/session.md +852 -0
- package/kb/site/en/reference/subsystems/settings.md +313 -0
- package/kb/site/en/reference/subsystems/shell.md +306 -0
- package/kb/site/en/reference/subsystems/skills.md +334 -0
- package/kb/site/en/reference/subsystems/spill.md +120 -0
- package/kb/site/en/reference/subsystems/storage.md +232 -0
- package/kb/site/en/reference/subsystems/subagent.md +737 -0
- package/kb/site/en/reference/subsystems/subprocess.md +327 -0
- package/kb/site/en/reference/subsystems/system-prompt.md +210 -0
- package/kb/site/en/reference/subsystems/terminal.md +187 -0
- package/kb/site/en/reference/subsystems/token-meter.md +93 -0
- package/kb/site/en/reference/subsystems/tools.md +723 -0
- package/kb/site/en/reference/subsystems/typert.md +339 -0
- package/kb/site/en/reference/subsystems/user-questions.md +181 -0
- package/kb/site/en/reference/subsystems/web-server.md +111 -0
- package/kb/site/en/reference/subsystems/web.md +202 -0
- package/kb/site/en/reference/subsystems/workflow.md +281 -0
- package/kb/site/en/reference/subsystems/workspace.md +231 -0
- package/kb/site/en/reference/tool-catalog.md +1877 -0
- package/kb/site/en/reference/tool-execution-pipeline.md +66 -0
- package/kb/site/guide/providers-custom-form.zh.png +0 -0
- package/kb/site/guide/providers-models-page.zh.png +0 -0
- package/kb/site/guide/providers.md +100 -0
- package/kb/site/guide/python-sdk.md +106 -0
- package/kb/site/guide/quickstart.md +32 -0
- package/kb/site/index.md +8 -0
- package/kb/site/reference/agent-lifecycle.md +86 -0
- package/kb/site/reference/capability-seams.md +475 -0
- package/kb/site/reference/config-catalog.md +3154 -0
- package/kb/site/reference/cookbook/adding-a-conversation-node.md +235 -0
- package/kb/site/reference/cookbook/adding-a-package.md +120 -0
- package/kb/site/reference/cookbook/adding-a-settings-card.md +102 -0
- package/kb/site/reference/cookbook/adding-a-tool.md +98 -0
- package/kb/site/reference/cookbook/adding-an-llm-adapter.md +45 -0
- package/kb/site/reference/cookbook/extension-cookbook.md +133 -0
- package/kb/site/reference/cordis-api/context.md +368 -0
- package/kb/site/reference/cordis-api/events.md +211 -0
- package/kb/site/reference/cordis-api/fiber.md +379 -0
- package/kb/site/reference/cordis-api/inherited.md +43 -0
- package/kb/site/reference/cordis-api/registry.md +156 -0
- package/kb/site/reference/cordis-api/service.md +106 -0
- package/kb/site/reference/cordis-primer.md +52 -0
- package/kb/site/reference/index.md +135 -0
- package/kb/site/reference/persistence-catalog.md +949 -0
- package/kb/site/reference/subsystems/approval.md +173 -0
- package/kb/site/reference/subsystems/client-modules.md +121 -0
- package/kb/site/reference/subsystems/code-runtime.md +194 -0
- package/kb/site/reference/subsystems/commands.md +190 -0
- package/kb/site/reference/subsystems/compaction.md +241 -0
- package/kb/site/reference/subsystems/core.md +1081 -0
- package/kb/site/reference/subsystems/credentials.md +136 -0
- package/kb/site/reference/subsystems/filesystem.md +498 -0
- package/kb/site/reference/subsystems/goal.md +280 -0
- package/kb/site/reference/subsystems/index.md +58 -0
- package/kb/site/reference/subsystems/invariants.md +91 -0
- package/kb/site/reference/subsystems/jobs.md +293 -0
- package/kb/site/reference/subsystems/llm-streaming.md +926 -0
- package/kb/site/reference/subsystems/lsp.md +205 -0
- package/kb/site/reference/subsystems/permission-presets.md +134 -0
- package/kb/site/reference/subsystems/persistence.md +388 -0
- package/kb/site/reference/subsystems/plan.md +90 -0
- package/kb/site/reference/subsystems/sandbox.md +221 -0
- package/kb/site/reference/subsystems/schedule.md +189 -0
- package/kb/site/reference/subsystems/scope.md +62 -0
- package/kb/site/reference/subsystems/session-projection.md +265 -0
- package/kb/site/reference/subsystems/session-query.md +498 -0
- package/kb/site/reference/subsystems/session-reference.md +111 -0
- package/kb/site/reference/subsystems/session-telemetry.md +197 -0
- package/kb/site/reference/subsystems/session-title.md +207 -0
- package/kb/site/reference/subsystems/session.md +854 -0
- package/kb/site/reference/subsystems/settings.md +313 -0
- package/kb/site/reference/subsystems/shell.md +306 -0
- package/kb/site/reference/subsystems/skills.md +334 -0
- package/kb/site/reference/subsystems/spill.md +120 -0
- package/kb/site/reference/subsystems/storage.md +232 -0
- package/kb/site/reference/subsystems/subagent.md +739 -0
- package/kb/site/reference/subsystems/subprocess.md +327 -0
- package/kb/site/reference/subsystems/system-prompt.md +210 -0
- package/kb/site/reference/subsystems/terminal.md +187 -0
- package/kb/site/reference/subsystems/token-meter.md +93 -0
- package/kb/site/reference/subsystems/tools.md +723 -0
- package/kb/site/reference/subsystems/typert.md +339 -0
- package/kb/site/reference/subsystems/user-questions.md +181 -0
- package/kb/site/reference/subsystems/web-server.md +111 -0
- package/kb/site/reference/subsystems/web.md +202 -0
- package/kb/site/reference/subsystems/workflow.md +281 -0
- package/kb/site/reference/subsystems/workspace.md +231 -0
- package/kb/site/reference/tool-catalog.md +1880 -0
- package/kb/site/reference/tool-execution-pipeline.md +66 -0
- package/package.json +40 -0
- package/scripts/rebuild-index.mjs +88 -0
- package/skills/dsh-plugin-dev-kb.md +66 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# 扩展
|
|
2
|
+
|
|
3
|
+
[English](extensions.md) | 中文
|
|
4
|
+
|
|
5
|
+
extensions 子系统允许 agent(智能体)定义带版本的 Cordis 包、运行其 host 与浏览器两半,并在编写代码前查询获准公开的运行时元数据。包生命周期与沙箱行为由 [`packages/extensions`](../../packages/extensions/README.md) 包组说明。
|
|
6
|
+
|
|
7
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
8
|
+
|
|
9
|
+
<a id="cordis-surface"></a>
|
|
10
|
+
|
|
11
|
+
## Cordis API
|
|
12
|
+
|
|
13
|
+
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`) — this section is byte-identical in both language sides of the page. 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).
|
|
14
|
+
|
|
15
|
+
<a id="ctxcordisinspect--cordisinspectregistryservice"></a>
|
|
16
|
+
|
|
17
|
+
### `ctx.cordisInspect` — `CordisInspectRegistryService`
|
|
18
|
+
|
|
19
|
+
Registry and cross-page router behind the two model-facing inspect tools.
|
|
20
|
+
|
|
21
|
+
```ts cordis-catalog
|
|
22
|
+
/**
|
|
23
|
+
* Register one Host provider.
|
|
24
|
+
* @param registration - manifest and local query handler.
|
|
25
|
+
* @returns idempotent disposer.
|
|
26
|
+
*/
|
|
27
|
+
register(registration: HostCordisInspectProviderRegistration): () => void
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Replace the mirrored Client provider directory.
|
|
31
|
+
* @param providers - complete Client manifest snapshot.
|
|
32
|
+
*/
|
|
33
|
+
syncClientManifest(providers: readonly CordisInspectProviderManifest[]): void
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Return the complete known Host and Client provider directory.
|
|
37
|
+
* @returns Host providers followed by the Client providers.
|
|
38
|
+
*/
|
|
39
|
+
list(): CordisInspectProviderView[]
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Execute one provider query on its owning platform.
|
|
43
|
+
* @param platform - Host or Client runtime.
|
|
44
|
+
* @param providerId - provider selected from {@link list}.
|
|
45
|
+
* @param methodName - declared method name.
|
|
46
|
+
* @param input - optional lossless JSON input.
|
|
47
|
+
* @param agent - requesting Agent and scope.
|
|
48
|
+
* @param signal - tool-call cancellation.
|
|
49
|
+
* @returns provider JSON data.
|
|
50
|
+
*/
|
|
51
|
+
async query( platform: CordisInspectPlatform, providerId: string, methodName: string, input: JsonValue | undefined, agent: Agent, signal: AbortSignal, ): Promise<JsonValue>
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Accept the first valid Client response for a pending query.
|
|
55
|
+
* @param agent - Agent whose Session owns the query.
|
|
56
|
+
* @param requestId - Pending Client query identity.
|
|
57
|
+
* @param resolution - Client provider result or failure.
|
|
58
|
+
* @returns whether this response settled the still-pending query.
|
|
59
|
+
*/
|
|
60
|
+
resolveClientQuery( agent: Agent, requestId: CordisInspectRequestId, resolution: CordisInspectQueryResolution, ): CordisInspectResolveAck
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Types: [Agent](core.md)
|
|
64
|
+
|
|
65
|
+
Source: [`packages/extensions/cordis-host-runner/src/inspect-registry.ts:46`](../../packages/extensions/cordis-host-runner/src/inspect-registry.ts)
|
|
66
|
+
|
|
67
|
+
<a id="ctxdynamiccordisrunner--dynamiccordisrunnerservice"></a>
|
|
68
|
+
|
|
69
|
+
### `ctx.dynamicCordisRunner` — `DynamicCordisRunnerService`
|
|
70
|
+
|
|
71
|
+
Dynamic Plugin registry and Host-half lifecycle.
|
|
72
|
+
|
|
73
|
+
```ts cordis-catalog
|
|
74
|
+
/**
|
|
75
|
+
* Define a new Plugin's first Package or append a Package to an existing Plugin.
|
|
76
|
+
* @param request - Session ownership, Plugin selection, metadata, and source code.
|
|
77
|
+
* @returns Host-minted Plugin and Package identities with declared-half metadata.
|
|
78
|
+
*/
|
|
79
|
+
define(request: DynamicCordisDefineRequest): DynamicCordisDefineReceipt
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Remove a Plugin, its active run, and all immutable Packages.
|
|
83
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
84
|
+
* @param pluginId - Stable Plugin identity to remove.
|
|
85
|
+
* @returns Whether removal succeeded and whether it stopped an active run.
|
|
86
|
+
*/
|
|
87
|
+
async undefine(agent: Agent, pluginId: CordisDynamicPluginId): Promise<DynamicCordisUndefineReceipt>
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Remove a Plugin from the user panel and queue the resulting state change for the model's next step.
|
|
91
|
+
* @param agent - Agent whose Session owns the Plugin and receives the context.
|
|
92
|
+
* @param pluginId - Stable Plugin identity to remove.
|
|
93
|
+
* @returns Whether removal succeeded and whether it stopped an active run.
|
|
94
|
+
*/
|
|
95
|
+
@Remote('undefineFromPanel') async undefineFromPanel(agent: Agent, pluginId: CordisDynamicPluginId): Promise<DynamicCordisUndefineReceipt>
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Start or update one Package for a model tool call. An unauthorized Client
|
|
99
|
+
* Package waits for approval; Plugin-wide authorization covers later versions.
|
|
100
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
101
|
+
* @param pluginId - Stable Plugin identity to activate.
|
|
102
|
+
* @param packageId - Immutable Package version to activate.
|
|
103
|
+
* @param mode - Whether to run the current version or switch versions.
|
|
104
|
+
* @param signal - Tool-call cancellation signal while the activation request is being created.
|
|
105
|
+
* @returns The successful activation identity or an actionable refusal.
|
|
106
|
+
*/
|
|
107
|
+
async run( agent: Agent, pluginId: CordisDynamicPluginId, packageId: CordisDynamicPackageId, mode: CordisDynamicRunMode, signal?: AbortSignal, ): Promise<DynamicCordisRunResponse>
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Start Host code for an approved request or a direct panel gesture.
|
|
111
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
112
|
+
* @param pluginId - Stable Plugin identity to activate.
|
|
113
|
+
* @param packageId - Immutable Package version to activate.
|
|
114
|
+
* @param mode - Whether to run the current version or switch versions.
|
|
115
|
+
* @param requestId - Model-driven request identity, or null for a direct user gesture.
|
|
116
|
+
* @param approveFutureVersions - Whether this approval covers later Packages of the same Plugin.
|
|
117
|
+
* @returns The exact Host activation or a failure message.
|
|
118
|
+
*/
|
|
119
|
+
@Remote('runHostHalf') async runHostHalf( agent: Agent, pluginId: CordisDynamicPluginId, packageId: CordisDynamicPackageId, mode: CordisDynamicRunMode, requestId: ApprovalRequestId | null, approveFutureVersions: boolean, ): Promise<DynamicCordisHostHalfResult>
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Fetch Client code for the exact active run.
|
|
123
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
124
|
+
* @param pluginId - Stable Plugin identity to read.
|
|
125
|
+
* @param pluginRunId - Exact active run authorized to receive source.
|
|
126
|
+
* @returns Client source and its Plugin, Package, and run identities.
|
|
127
|
+
*/
|
|
128
|
+
@Remote('getClientCode') getClientCode( agent: Agent, pluginId: CordisDynamicPluginId, pluginRunId: CordisDynamicPluginRunId, ): DynamicCordisClientSource
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Resolve one model-driven Client activation request.
|
|
132
|
+
* @param requestId - Request identity to settle once.
|
|
133
|
+
* @param resolution - Browser refusal or exact Client activation result.
|
|
134
|
+
* @returns Whether the still-pending request accepted this resolution.
|
|
135
|
+
*/
|
|
136
|
+
@Remote('resolveRequestRun') async resolveRequestRun( requestId: ApprovalRequestId, resolution: DynamicCordisRunResolution, ): Promise<DynamicCordisResolveAck>
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Settle a direct panel run after this page loaded or failed its Client half.
|
|
140
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
141
|
+
* @param pluginId - Stable Plugin identity being settled.
|
|
142
|
+
* @param resolution - Exact Client activation result from the acting page.
|
|
143
|
+
* @returns The committed activation or its failure.
|
|
144
|
+
*/
|
|
145
|
+
@Remote('settleUserRun') async settleUserRun( agent: Agent, pluginId: CordisDynamicPluginId, resolution: DynamicCordisRunResolution, ): Promise<DynamicCordisRunResponse>
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Stop the active run while retaining every Package version.
|
|
149
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
150
|
+
* @param pluginId - Stable Plugin identity to stop.
|
|
151
|
+
* @returns Success or the reason no run was stopped.
|
|
152
|
+
*/
|
|
153
|
+
async stop(agent: Agent, pluginId: CordisDynamicPluginId): Promise<DynamicCordisStopResponse>
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Stop a Plugin from the user panel and queue the resulting state change for the model's next step.
|
|
157
|
+
* @param agent - Agent whose Session owns the Plugin and receives the context.
|
|
158
|
+
* @param pluginId - Stable Plugin identity to stop.
|
|
159
|
+
* @returns Success or the reason no run was stopped.
|
|
160
|
+
*/
|
|
161
|
+
@Remote('stopFromPanel') async stopFromPanel(agent: Agent, pluginId: CordisDynamicPluginId): Promise<DynamicCordisStopResponse>
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Replace the Host mirror of the Client inspect provider directory.
|
|
165
|
+
* @param providers - complete Client provider manifest.
|
|
166
|
+
* @returns null after accepting the manifest.
|
|
167
|
+
*/
|
|
168
|
+
@Remote('syncInspectManifest') syncInspectManifest(providers: readonly CordisInspectProviderManifest[]): null
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Claim one pending Client inspect query with its live result.
|
|
172
|
+
* @param agent - Session that owns the query.
|
|
173
|
+
* @param requestId - exact pending query identity.
|
|
174
|
+
* @param resolution - provider result or structured refusal.
|
|
175
|
+
* @returns whether this answer won the query.
|
|
176
|
+
*/
|
|
177
|
+
@Remote('resolveInspectQuery') resolveInspectQuery( agent: Agent, requestId: CordisInspectRequestId, resolution: CordisInspectQueryResolution, ): CordisInspectResolveAck
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Frame-wide inventory, grouped as one row per stable Plugin.
|
|
181
|
+
* @returns Source-free metadata for every process-local Plugin.
|
|
182
|
+
*/
|
|
183
|
+
@Remote('inventory') inventory(): DynamicCordisInventoryRow[]
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Read one Session's Host-rich state for inspection and result rendering.
|
|
187
|
+
* @param agent - Agent whose Session selects visible Plugins.
|
|
188
|
+
* @returns Plugin versions, active runs, Host fibers, and render failures.
|
|
189
|
+
*/
|
|
190
|
+
snapshot(agent: Agent): DynamicCordisSnapshotRow[]
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Read source-free context for an explicit `@pluginId` user gesture.
|
|
194
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
195
|
+
* @param pluginId - Stable Plugin identity referenced by the user.
|
|
196
|
+
* @returns The preferred modification base, or undefined when unavailable.
|
|
197
|
+
*/
|
|
198
|
+
reference(agent: Agent, pluginId: CordisDynamicPluginId): DynamicCordisReference | undefined
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* List source-free Plugin summaries owned by one Session.
|
|
202
|
+
* @param agent - Agent whose Session selects visible Plugins.
|
|
203
|
+
* @returns one summary per Plugin in creation order.
|
|
204
|
+
*/
|
|
205
|
+
listPlugins(agent: Agent): DynamicCordisPluginInspection[]
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Inspect one Plugin without returning Package source.
|
|
209
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
210
|
+
* @param pluginId - stable Plugin identity.
|
|
211
|
+
* @returns version pointers, latest run, and all Package summaries.
|
|
212
|
+
*/
|
|
213
|
+
inspectPlugin(agent: Agent, pluginId: CordisDynamicPluginId): DynamicCordisPluginInspection
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Read one exact immutable Package and its Host and Client source.
|
|
217
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
218
|
+
* @param pluginId - Stable Plugin identity that owns the Package.
|
|
219
|
+
* @param packageId - Exact immutable Package identity to inspect.
|
|
220
|
+
* @returns Package metadata, source, and the Plugin's lifecycle pointers.
|
|
221
|
+
*/
|
|
222
|
+
inspectPackage( agent: Agent, pluginId: CordisDynamicPluginId, packageId: CordisDynamicPackageId, ): DynamicCordisPackageInspection
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Record a post-load render failure for the exact active run.
|
|
226
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
227
|
+
* @param pluginId - Stable Plugin identity that rendered.
|
|
228
|
+
* @param pluginRunId - Exact active run that produced the failure.
|
|
229
|
+
* @param failure - Slot, message, and entry-retirement result.
|
|
230
|
+
* @returns Null after recording or ignoring a stale report.
|
|
231
|
+
*/
|
|
232
|
+
@Remote('reportRenderFailure') async reportRenderFailure( agent: Agent, pluginId: CordisDynamicPluginId, pluginRunId: CordisDynamicPluginRunId, failure: DynamicCordisRenderFailure, ): Promise<null>
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Report a Client guard rejection that happened after the Package completed activation.
|
|
236
|
+
* @param agent - Agent whose Session must own the Plugin.
|
|
237
|
+
* @param pluginId - Stable Plugin identity whose Client code was rejected.
|
|
238
|
+
* @param pluginRunId - Exact active run that produced the rejection.
|
|
239
|
+
* @param failure - Original guard message and stack.
|
|
240
|
+
* @returns Null after reporting or ignoring a stale/startup failure.
|
|
241
|
+
*/
|
|
242
|
+
@Remote('reportClientGuardFailure') async reportClientGuardFailure( agent: Agent, pluginId: CordisDynamicPluginId, pluginRunId: CordisDynamicPluginRunId, failure: CordisErrorDetails, ): Promise<null>
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Invoke an active Host method while rejecting stale Client runs.
|
|
246
|
+
* @param pluginId - Stable Plugin identity that owns the method.
|
|
247
|
+
* @param pluginRunId - Exact active run authorizing the call.
|
|
248
|
+
* @param method - Registered Host handler name.
|
|
249
|
+
* @param args - JSON argument delivered to the handler.
|
|
250
|
+
* @returns The JSON result or a typed invocation failure.
|
|
251
|
+
*/
|
|
252
|
+
@Remote('invoke') async invoke( pluginId: CordisDynamicPluginId, pluginRunId: CordisDynamicPluginRunId, method: string, args: JsonValue, ): Promise<DynamicCordisInvokeResult>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Types: [Agent](core.md)
|
|
256
|
+
|
|
257
|
+
Source: [`packages/extensions/cordis-host-runner/src/index.ts:124`](../../packages/extensions/cordis-host-runner/src/index.ts)
|
|
258
|
+
|
|
259
|
+
<a id="cordis-events"></a>
|
|
260
|
+
|
|
261
|
+
### `cordis/*` events
|
|
262
|
+
|
|
263
|
+
<a id="cordisdynamic-package--emit"></a>
|
|
264
|
+
|
|
265
|
+
#### `cordis/dynamic-package` — emit
|
|
266
|
+
|
|
267
|
+
One exact Plugin/Package activation is now live in the Host.
|
|
268
|
+
|
|
269
|
+
```ts cordis-catalog
|
|
270
|
+
/**
|
|
271
|
+
* One exact Plugin/Package activation is now live in the Host.
|
|
272
|
+
* @param pkg - stable plugin, immutable package, run identity, and label.
|
|
273
|
+
* @mode emit
|
|
274
|
+
*/
|
|
275
|
+
'cordis/dynamic-package'(pkg: DynamicCordisPackage): void
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Source: [`packages/extensions/cordis-host-runner/src/types.ts:379`](../../packages/extensions/cordis-host-runner/src/types.ts)
|
|
279
|
+
|
|
280
|
+
<a id="cordisdynamic-retract--emit"></a>
|
|
281
|
+
|
|
282
|
+
#### `cordis/dynamic-retract` — emit
|
|
283
|
+
|
|
284
|
+
One exact activation was withdrawn.
|
|
285
|
+
|
|
286
|
+
```ts cordis-catalog
|
|
287
|
+
/**
|
|
288
|
+
* One exact activation was withdrawn.
|
|
289
|
+
* @param retracted - plugin, package, and run identity.
|
|
290
|
+
* @mode emit
|
|
291
|
+
*/
|
|
292
|
+
'cordis/dynamic-retract'(retracted: DynamicCordisRetracted): void
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Source: [`packages/extensions/cordis-host-runner/src/types.ts:385`](../../packages/extensions/cordis-host-runner/src/types.ts)
|
|
296
|
+
|
|
297
|
+
<a id="cordisinspect-query--emit"></a>
|
|
298
|
+
|
|
299
|
+
#### `cordis/inspect-query` — emit
|
|
300
|
+
|
|
301
|
+
Request a live read-only query from the Client inspect registry.
|
|
302
|
+
|
|
303
|
+
```ts cordis-catalog
|
|
304
|
+
/**
|
|
305
|
+
* Request a live read-only query from the Client inspect registry.
|
|
306
|
+
* @param request - correlation, Session, provider, method, and JSON input.
|
|
307
|
+
* @mode emit
|
|
308
|
+
*/
|
|
309
|
+
'cordis/inspect-query'(request: CordisInspectQueryRequest): void
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Source: [`packages/extensions/cordis-host-runner/src/types.ts:391`](../../packages/extensions/cordis-host-runner/src/types.ts)
|
|
313
|
+
|
|
314
|
+
<a id="cordisinspect-query-resolved--emit"></a>
|
|
315
|
+
|
|
316
|
+
#### `cordis/inspect-query-resolved` — emit
|
|
317
|
+
|
|
318
|
+
Notify every Client that an inspect query has settled or been cancelled.
|
|
319
|
+
|
|
320
|
+
```ts cordis-catalog
|
|
321
|
+
/**
|
|
322
|
+
* Notify every Client that an inspect query has settled or been cancelled.
|
|
323
|
+
* @param resolved - exact query identity that is no longer answerable.
|
|
324
|
+
* @mode emit
|
|
325
|
+
*/
|
|
326
|
+
'cordis/inspect-query-resolved'(resolved: CordisInspectQueryResolved): void
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Source: [`packages/extensions/cordis-host-runner/src/types.ts:397`](../../packages/extensions/cordis-host-runner/src/types.ts)
|
|
330
|
+
|
|
331
|
+
<a id="cordisrequest-run--emit"></a>
|
|
332
|
+
|
|
333
|
+
#### `cordis/request-run` — emit
|
|
334
|
+
|
|
335
|
+
A Client-bearing activation needs a browser page, and may require a user decision.
|
|
336
|
+
|
|
337
|
+
```ts cordis-catalog
|
|
338
|
+
/**
|
|
339
|
+
* A Client-bearing activation needs a browser page, and may require a user decision.
|
|
340
|
+
* @param request - correlation identity, owner, target version, mode, and approval requirement.
|
|
341
|
+
* @mode emit
|
|
342
|
+
*/
|
|
343
|
+
'cordis/request-run'(request: DynamicCordisRunRequest): void
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Source: [`packages/extensions/cordis-host-runner/src/types.ts:367`](../../packages/extensions/cordis-host-runner/src/types.ts)
|
|
347
|
+
|
|
348
|
+
<a id="cordisrequest-run-resolved--emit"></a>
|
|
349
|
+
|
|
350
|
+
#### `cordis/request-run-resolved` — emit
|
|
351
|
+
|
|
352
|
+
A pending Client activation request left the answerable state.
|
|
353
|
+
|
|
354
|
+
```ts cordis-catalog
|
|
355
|
+
/**
|
|
356
|
+
* A pending Client activation request left the answerable state.
|
|
357
|
+
* @param resolved - request identity and outcome.
|
|
358
|
+
* @mode emit
|
|
359
|
+
*/
|
|
360
|
+
'cordis/request-run-resolved'(resolved: DynamicCordisRequestResolved): void
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Source: [`packages/extensions/cordis-host-runner/src/types.ts:373`](../../packages/extensions/cordis-host-runner/src/types.ts)
|
|
364
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Message Feedback
|
|
2
|
+
|
|
3
|
+
English | [中文](feedback.zh.md)
|
|
4
|
+
|
|
5
|
+
[`@deepseek-ai/dsh-message-feedback`](../../packages/feedback/message-feedback) owns editable feedback for individual assistant messages. It is deliberately separate from the immutable Session-level `feedback/record` event: message feedback is a local storage-domain sidecar, not Session-log content or a projection, and it performs no telemetry handoff.
|
|
6
|
+
|
|
7
|
+
Source: [`packages/feedback/message-feedback/src/types.ts`](../../packages/feedback/message-feedback/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## Public types
|
|
10
|
+
|
|
11
|
+
```ts type-equiv
|
|
12
|
+
/** Opaque compare-and-set token for one exact feedback item revision. */
|
|
13
|
+
type MessageFeedbackVersion = Branded<'MessageFeedbackVersion'>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```ts type-equiv
|
|
17
|
+
/** The human's overall judgment of one assistant message. */
|
|
18
|
+
type MessageFeedbackRating = 'positive' | 'negative'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```ts type-equiv
|
|
22
|
+
/** One current feedback value and its opaque mutation token. */
|
|
23
|
+
interface MessageFeedbackItem {
|
|
24
|
+
/** Stable identity of the assistant message inside the owning Session. */
|
|
25
|
+
readonly messageId: MessageId
|
|
26
|
+
/** Overall positive or negative judgment. */
|
|
27
|
+
readonly rating: MessageFeedbackRating
|
|
28
|
+
/** Optional explanation, preserved verbatim after validation. */
|
|
29
|
+
readonly note?: string
|
|
30
|
+
/** Equality-only token replaced by every material create or update. */
|
|
31
|
+
readonly version: MessageFeedbackVersion
|
|
32
|
+
/** Host-assigned creation time in Unix epoch milliseconds. */
|
|
33
|
+
readonly createdAt: number
|
|
34
|
+
/** Host-assigned time of the most recent material update. */
|
|
35
|
+
readonly updatedAt: number
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```ts type-equiv
|
|
40
|
+
/** Read all message feedback belonging to one persisted Session lifecycle. */
|
|
41
|
+
interface MessageFeedbackListRequest {
|
|
42
|
+
/** Persisted Session whose sidecar should be read. */
|
|
43
|
+
readonly sessionId: SessionId
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```ts type-equiv
|
|
48
|
+
/** Current feedback values for one Session, in first-creation order. */
|
|
49
|
+
interface MessageFeedbackListValue {
|
|
50
|
+
/** Fresh immutable item snapshots. */
|
|
51
|
+
readonly items: readonly MessageFeedbackItem[]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```ts type-equiv
|
|
56
|
+
/** Create or replace feedback for one assistant message. */
|
|
57
|
+
interface MessageFeedbackPutRequest {
|
|
58
|
+
/** Persisted Session that owns the target message. */
|
|
59
|
+
readonly sessionId: SessionId
|
|
60
|
+
/** Target assistant-message identity. */
|
|
61
|
+
readonly messageId: MessageId
|
|
62
|
+
/** Desired overall judgment. */
|
|
63
|
+
readonly rating: MessageFeedbackRating
|
|
64
|
+
/** Optional non-blank explanation. */
|
|
65
|
+
readonly note?: string
|
|
66
|
+
/** Observed item version, or `null` to require that no item exists. */
|
|
67
|
+
readonly ifVersion: MessageFeedbackVersion | null
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```ts type-equiv
|
|
72
|
+
/** Delete feedback for one message after observing its current version. */
|
|
73
|
+
interface MessageFeedbackDeleteRequest {
|
|
74
|
+
/** Persisted Session that owns the sidecar. */
|
|
75
|
+
readonly sessionId: SessionId
|
|
76
|
+
/** Message whose feedback should be absent after this operation. */
|
|
77
|
+
readonly messageId: MessageId
|
|
78
|
+
/** Observed item version; ignored when the item is already absent. */
|
|
79
|
+
readonly ifVersion: MessageFeedbackVersion
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```ts type-equiv
|
|
84
|
+
/** Idempotent deletion acknowledgement. */
|
|
85
|
+
interface MessageFeedbackDeleteValue {
|
|
86
|
+
/** Stable postcondition shared by the first deletion and every retry. */
|
|
87
|
+
readonly absent: true
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```ts type-equiv
|
|
92
|
+
/** No persisted Session header exists for the requested id. */
|
|
93
|
+
interface MessageFeedbackSessionNotFound {
|
|
94
|
+
readonly code: 'session-not-found'
|
|
95
|
+
readonly sessionId: SessionId
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```ts type-equiv
|
|
100
|
+
/** The id does not name a derived, append-origin assistant message. */
|
|
101
|
+
interface MessageFeedbackTargetNotFound {
|
|
102
|
+
readonly code: 'target-not-found'
|
|
103
|
+
readonly sessionId: SessionId
|
|
104
|
+
readonly messageId: MessageId
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```ts type-equiv
|
|
109
|
+
/** A material mutation did not match the addressed item's current version. */
|
|
110
|
+
interface MessageFeedbackVersionConflict {
|
|
111
|
+
readonly code: 'version-conflict'
|
|
112
|
+
/** Authoritative current item, or `null` when it does not exist. */
|
|
113
|
+
readonly current: MessageFeedbackItem | null
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```ts type-equiv
|
|
118
|
+
/** A supplied note contains no non-whitespace character. */
|
|
119
|
+
interface MessageFeedbackNoteBlank {
|
|
120
|
+
readonly code: 'note-blank'
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```ts type-equiv
|
|
125
|
+
/** A supplied note exceeds the configured UTF-8 byte limit. */
|
|
126
|
+
interface MessageFeedbackNoteTooLarge {
|
|
127
|
+
readonly code: 'note-too-large'
|
|
128
|
+
readonly maxBytes: number
|
|
129
|
+
readonly actualBytes: number
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```ts type-equiv
|
|
134
|
+
/** Failures shared by the public message-feedback operations. */
|
|
135
|
+
type MessageFeedbackFailure =
|
|
136
|
+
| MessageFeedbackSessionNotFound
|
|
137
|
+
| MessageFeedbackTargetNotFound
|
|
138
|
+
| MessageFeedbackVersionConflict
|
|
139
|
+
| MessageFeedbackNoteBlank
|
|
140
|
+
| MessageFeedbackNoteTooLarge
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```ts type-equiv
|
|
144
|
+
/** Successful public operation result. */
|
|
145
|
+
interface MessageFeedbackSuccess<T> {
|
|
146
|
+
readonly ok: true
|
|
147
|
+
readonly value: T
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```ts type-equiv
|
|
152
|
+
/** Rejected public operation result with a stable business failure. */
|
|
153
|
+
interface MessageFeedbackRejected<E extends MessageFeedbackFailure> {
|
|
154
|
+
readonly ok: false
|
|
155
|
+
readonly error: E
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
```ts type-equiv
|
|
160
|
+
/** Result returned by the message-feedback `list` operation. */
|
|
161
|
+
type MessageFeedbackListResult =
|
|
162
|
+
| MessageFeedbackSuccess<MessageFeedbackListValue>
|
|
163
|
+
| MessageFeedbackRejected<MessageFeedbackSessionNotFound>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
```ts type-equiv
|
|
167
|
+
/** Result returned by the message-feedback `put` operation. */
|
|
168
|
+
type MessageFeedbackPutResult =
|
|
169
|
+
| MessageFeedbackSuccess<MessageFeedbackItem>
|
|
170
|
+
| MessageFeedbackRejected<
|
|
171
|
+
| MessageFeedbackSessionNotFound
|
|
172
|
+
| MessageFeedbackTargetNotFound
|
|
173
|
+
| MessageFeedbackVersionConflict
|
|
174
|
+
| MessageFeedbackNoteBlank
|
|
175
|
+
| MessageFeedbackNoteTooLarge
|
|
176
|
+
>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```ts type-equiv
|
|
180
|
+
/** Result returned by the message-feedback `delete` operation. */
|
|
181
|
+
type MessageFeedbackDeleteResult =
|
|
182
|
+
| MessageFeedbackSuccess<MessageFeedbackDeleteValue>
|
|
183
|
+
| MessageFeedbackRejected<MessageFeedbackSessionNotFound | MessageFeedbackVersionConflict>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Data and concurrency
|
|
187
|
+
|
|
188
|
+
One Session sidecar row contains its header identity `{createdAt, cwd}` and feedback items keyed by `MessageId`. Each item carries a positive or negative rating, an optional note, Host-assigned `createdAt`/`updatedAt` timestamps, and its own opaque version. Versions are compared only for equality and only against the addressed message; callers do not order or synthesize them.
|
|
189
|
+
|
|
190
|
+
`put` uses strict optimistic concurrency: every request for an existing item must match its current `ifVersion`, including a no-op. A conflict returns the authoritative current item (or `null`), so a caller can reconcile a lost response or a concurrent edit without another read. Deleting an already absent item succeeds. A per-Session queue encloses inspection, read, conflict evaluation, and whole-row write, so these guarantees cover concurrent calls in one Host process.
|
|
191
|
+
|
|
192
|
+
## Target and lifecycle authority
|
|
193
|
+
|
|
194
|
+
`SessionPersistence.inspect()` supplies the target Session observation without publishing or resuming an Agent and without committing cold repair. A cold `listSnapshots()` preflight classifies definite absence; inspection failure for a catalogued Session propagates as infrastructure failure. `put` accepts only a non-empty, append-origin `assistant/message` with the requested `MessageId`; replacement-origin, usage-only empty, and non-assistant records are not feedback targets.
|
|
195
|
+
|
|
196
|
+
The stored `{createdAt, cwd}` identity must match the inspected header. A mismatch is treated as absence: `list` returns no items, while `put` may replace the stale row with one bound to the current header identity. Forks use a new Session identity and receive no sidecar copy even when their seed contains the same messages.
|
|
197
|
+
|
|
198
|
+
## Persistence and Remote contract
|
|
199
|
+
|
|
200
|
+
The service stores whole Session rows in the `message_feedback` storage domain through `ctx.storageDomain`. Before `put` commits a row that references a target message, a matching live target passes through the canonical `ctx.sessions.flush` checkpoint; both live and cold paths are then physically read from sequence zero through `SessionPersistence.readFrom`. The resulting observation is revalidated before the sidecar write, so the durable target log always precedes its sidecar commit. `maxNoteBytes` is required and bounds note text by UTF-8 bytes; the Web Host composition sets `8192`. The package publishes the Host `messageFeedback.list`, `messageFeedback.put`, and `messageFeedback.delete` unary Remote contract through `TypertRemoteService` and `@Remote`; the generated Cordis API below is the method-level authority.
|
|
201
|
+
|
|
202
|
+
Plugin disposal closes mutation admission, drains accepted per-Session queue work, and then closes the storage domain.
|
|
203
|
+
|
|
204
|
+
## Web surface
|
|
205
|
+
|
|
206
|
+
[`@deepseek-ai/dsh-client-ui-message-feedback`](../../packages/client/ui-message-feedback) is the browser consumer. `@deepseek-ai/dsh-api-remotes` mounts the generated `messageFeedback` contribution, so the plugin calls `ctx.remote.messageFeedback` and never touches the transport.
|
|
207
|
+
|
|
208
|
+
The controls are the `feedback` entry (order 10) of the `conversation.chat.assistant-actions` list slot, which `ui-conversation` declares and renders inside the finalized assistant message's IconActions row. Reaching that render site required one plumbing change: `AssistantMessageNode` now carries the optional `messageId` from the `assistant/message` event. The field is absent on interruption-frozen partials, and the render site skips the slot when it is absent. The strip renders once per turn, on the closing assistant message: the Host accepts every append-origin step message as a target, but earlier steps of a multi-step turn render tool rows rather than a rateable body, so the UI exposes a narrower set than the Host contract allows.
|
|
209
|
+
|
|
210
|
+
One `MessageFeedbackController` per Session backs every message control in that Session: a single `list` read seeds the whole transcript, deferred to first hover or focus rather than fired on mount. Each mutation sends the version that controller last observed as `ifVersion`; a `version-conflict` reply carries the authoritative item, so the controller reconciles from the reply instead of refetching. Mutations serialize per Session so a queued operation compares against the committed version. A `connection/reset` refreshes only Sessions already read.
|
|
211
|
+
|
|
212
|
+
## Boundaries and limitations
|
|
213
|
+
|
|
214
|
+
- The mutation queue is process-local. Storage-domain has no cross-process conditional write, so multiple Host writers to one storage root have no compare-and-swap or lost-update guarantee.
|
|
215
|
+
- Session persistence has no durable deletion API. The service does not treat `session/disposed` or `host/session-removed` as deletion and therefore performs no fake cascade; orphan sidecar rows may remain after out-of-band log removal.
|
|
216
|
+
- A request in the narrow interval after live detach but before the persistence catalog materializes the header can receive `session-not-found`; callers retry after retirement materialization.
|
|
217
|
+
- Cold requests scan the complete Session snapshot catalog because persistence has no lookup-by-id metadata operation. One Session row also has no item-count or aggregate-byte cap; `maxNoteBytes` bounds only each note until a concrete consumer owns a row policy.
|
|
218
|
+
- Header identity detects a reused id only when `{createdAt, cwd}` differs; a cloned log retaining the same header identity is indistinguishable by this contract.
|
|
219
|
+
- The Host contract records no authenticated actor or audit identity and therefore assumes a trusted caller boundary.
|
|
220
|
+
- The Web controls appear in the chat view only. The trajectory and waterfall views render no feedback entry even though their assistant nodes carry the same `messageId`.
|
|
221
|
+
- The sidecar publishes no live frames, so a second tab's rating becomes visible on reconnect or on the next conflict reply rather than immediately.
|
|
222
|
+
- The note editor does not pre-check `maxNoteBytes`; an oversized note fails on save with `note-too-large` rather than while typing.
|
|
223
|
+
|
|
224
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
225
|
+
|
|
226
|
+
<a id="cordis-surface"></a>
|
|
227
|
+
|
|
228
|
+
## Cordis API
|
|
229
|
+
|
|
230
|
+
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`) — this section is byte-identical in both language sides of the page. 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).
|
|
231
|
+
|
|
232
|
+
<a id="ctxmessagefeedback--messagefeedbackservice"></a>
|
|
233
|
+
|
|
234
|
+
### `ctx.messageFeedback` — `MessageFeedbackService`
|
|
235
|
+
|
|
236
|
+
Storage-domain sidecar service. It inspects persisted Session history and never creates or resumes an Agent or Session.
|
|
237
|
+
|
|
238
|
+
```ts cordis-catalog
|
|
239
|
+
/**
|
|
240
|
+
* Read feedback belonging to the current persisted Session lifecycle.
|
|
241
|
+
* A stale row from a reused Session id is invisible.
|
|
242
|
+
* @param request - Session identity to inspect and list.
|
|
243
|
+
* @returns current immutable items or `session-not-found`.
|
|
244
|
+
*/
|
|
245
|
+
@Remote('list') async list(request: MessageFeedbackListRequest): Promise<MessageFeedbackListResult>
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Create or replace feedback for one derived append-origin assistant
|
|
249
|
+
* message. Every request must match the addressed item's current version;
|
|
250
|
+
* a matching no-op returns the stored item without changing its revision.
|
|
251
|
+
* @param request - target, desired value, and observed item version.
|
|
252
|
+
* @returns the committed item or an explicit business failure.
|
|
253
|
+
*/
|
|
254
|
+
@Remote('put') put(request: MessageFeedbackPutRequest): Promise<MessageFeedbackPutResult>
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Delete one feedback item. Absence is successful regardless of the
|
|
258
|
+
* supplied version; an existing item requires an exact version match.
|
|
259
|
+
* @param request - Session, message, and observed item version.
|
|
260
|
+
* @returns the stable absent postcondition, or an explicit failure.
|
|
261
|
+
*/
|
|
262
|
+
@Remote('delete') delete(request: MessageFeedbackDeleteRequest): Promise<MessageFeedbackDeleteResult>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Source: [`packages/feedback/message-feedback/src/index.ts:150`](../../packages/feedback/message-feedback/src/index.ts)
|
|
266
|
+
<!-- END GENERATED cordis-surface -->
|