@lincyaw/dsh 0.2.0-rc.5 → 0.2.0-rc.50
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/build/client.mjs +0 -2
- package/build/dist/client.js +298 -297
- package/build/dist/client.json +53 -36
- package/cordis.patch.yml +1 -0
- package/package.json +8 -8
- package/src/client/agent-requests.ts +47 -0
- package/src/client/contract.ts +0 -6
- package/src/client/dsh.d.ts +12 -0
- package/src/client/index.tsx +2 -3
- package/src/client/messages.ts +2 -10
- package/src/client/styles.css +0 -42
- package/src/client/workspace-events.ts +9 -7
- package/src/node/bindings.ts +90 -6
- package/src/node/context.ts +16 -26
- package/src/node/dsh-types.ts +31 -1
- package/src/node/launch.ts +10 -5
- package/src/node/policy.ts +12 -3
- package/src/node/routes.ts +7 -1
- package/src/node/service.ts +7 -1
- package/src/node/tools.ts +61 -5
- package/src/node/turns.ts +12 -8
- package/src/node/workspace-events.ts +6 -4
- package/src/workspace-events.ts +2 -1
- package/src/client/mascot.tsx +0 -37
package/build/dist/client.json
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"inputs": [
|
|
3
|
-
"../design/src/assets/mascot/cat.png",
|
|
4
|
-
"../design/src/assets/mascot/cat-light.png",
|
|
5
|
-
"../design/src/assets/mascot/sheet.ts",
|
|
6
|
-
"../design/src/assets/mascot.ts",
|
|
7
|
-
"../design/src/icons.ts",
|
|
8
|
-
"../design/src/tokens.ts",
|
|
9
|
-
"../design/src/assets/brand.ts",
|
|
10
|
-
"../design/src/index.ts",
|
|
11
|
-
"../workbench/src/base-controls.tsx",
|
|
12
|
-
"../workbench/src/mascot-preference.ts",
|
|
13
|
-
"../workbench/src/sortable-list.tsx",
|
|
14
|
-
"../workbench/src/components.tsx",
|
|
15
3
|
"../kernel/src/contracts/service.ts",
|
|
16
4
|
"../kernel/src/contracts/agent.ts",
|
|
17
5
|
"../kernel/src/contracts/authoring.ts",
|
|
6
|
+
"../kernel/src/contracts/capture.ts",
|
|
18
7
|
"../kernel/src/contracts/document-reads.ts",
|
|
19
8
|
"../kernel/src/contracts/anchors.ts",
|
|
20
9
|
"../kernel/src/contracts/checks.ts",
|
|
@@ -37,6 +26,9 @@
|
|
|
37
26
|
"../kernel/src/contracts/server.ts",
|
|
38
27
|
"../kernel/src/contracts/speech.ts",
|
|
39
28
|
"../kernel/src/contracts/speech-settings.ts",
|
|
29
|
+
"../kernel/src/contracts/workspace-review.ts",
|
|
30
|
+
"../kernel/src/contracts/workspace-source.ts",
|
|
31
|
+
"../kernel/src/contracts/workspace-changes.ts",
|
|
40
32
|
"../kernel/src/contracts/transcription.ts",
|
|
41
33
|
"../kernel/src/contracts/transcription-adoption.ts",
|
|
42
34
|
"../kernel/src/contracts/voice.ts",
|
|
@@ -46,20 +38,25 @@
|
|
|
46
38
|
"../kernel/src/contracts/authoring-actions.ts",
|
|
47
39
|
"../kernel/src/contracts/document-history.ts",
|
|
48
40
|
"../kernel/src/contracts/authoring-clients.ts",
|
|
41
|
+
"../kernel/src/contracts/authoring-windows.ts",
|
|
49
42
|
"../kernel/src/contracts/projects.ts",
|
|
50
43
|
"../kernel/src/contracts/document-image.ts",
|
|
51
44
|
"../kernel/src/contracts.ts",
|
|
45
|
+
"../kernel/src/random-uuid.ts",
|
|
46
|
+
"../kernel/src/access.ts",
|
|
47
|
+
"../kernel/src/document-places.ts",
|
|
48
|
+
"../kernel/src/document-comments.ts",
|
|
52
49
|
"../kernel/src/document-operations.ts",
|
|
53
50
|
"../kernel/src/document-schema.ts",
|
|
51
|
+
"../kernel/src/document-narrations.ts",
|
|
54
52
|
"../kernel/src/authoring.ts",
|
|
55
53
|
"../kernel/src/document-pages.ts",
|
|
56
54
|
"../kernel/src/fingerprint.ts",
|
|
57
55
|
"../kernel/src/document-reads.ts",
|
|
58
56
|
"../kernel/src/document-voices.ts",
|
|
59
57
|
"../kernel/src/document-colors.ts",
|
|
60
|
-
"../kernel/src/access.ts",
|
|
61
|
-
"../kernel/src/document-comments.ts",
|
|
62
58
|
"../kernel/src/document-caption-timings.ts",
|
|
59
|
+
"../kernel/src/document-caption-scale.ts",
|
|
63
60
|
"../kernel/src/parameters.ts",
|
|
64
61
|
"../kernel/src/document.ts",
|
|
65
62
|
"../kernel/src/document-components.ts",
|
|
@@ -74,6 +71,7 @@
|
|
|
74
71
|
"../kernel/src/events.ts",
|
|
75
72
|
"../kernel/src/execution.ts",
|
|
76
73
|
"../kernel/src/git.ts",
|
|
74
|
+
"../kernel/src/escape-html.ts",
|
|
77
75
|
"../kernel/src/html.ts",
|
|
78
76
|
"../kernel/src/requests.ts",
|
|
79
77
|
"../kernel/src/step-keys.ts",
|
|
@@ -83,9 +81,13 @@
|
|
|
83
81
|
"../kernel/src/kernel.ts",
|
|
84
82
|
"../kernel/src/locale.ts",
|
|
85
83
|
"../kernel/src/lock.ts",
|
|
84
|
+
"../kernel/src/myst-marks.ts",
|
|
86
85
|
"../kernel/src/lower-myst.ts",
|
|
87
|
-
"../kernel/src/keyboard.ts",
|
|
88
86
|
"../kernel/src/preview-frame.ts",
|
|
87
|
+
"../kernel/src/keyboard.ts",
|
|
88
|
+
"../kernel/src/preview-frame-connect.ts",
|
|
89
|
+
"../kernel/src/stale-module.ts",
|
|
90
|
+
"../kernel/src/embed.ts",
|
|
89
91
|
"../kernel/src/preview-edit.ts",
|
|
90
92
|
"../kernel/src/props.ts",
|
|
91
93
|
"../kernel/src/reading.ts",
|
|
@@ -108,44 +110,56 @@
|
|
|
108
110
|
"../kernel/src/jupyter-kernel.ts",
|
|
109
111
|
"../kernel/src/preview-events.ts",
|
|
110
112
|
"../kernel/src/index.ts",
|
|
113
|
+
"../workbench/src/workbench-state.ts",
|
|
114
|
+
"../workbench/src/document-return-point.ts",
|
|
115
|
+
"../workbench/src/document-editor/table-identities.ts",
|
|
116
|
+
"../workbench/src/document-editor/selection.ts",
|
|
117
|
+
"../workbench/src/shortcuts.ts",
|
|
118
|
+
"../workbench/src/messages.ts",
|
|
119
|
+
"../workbench/src/document-editing.ts",
|
|
120
|
+
"../workbench/src/workspace-client.ts",
|
|
121
|
+
"../workbench/src/sha256.ts",
|
|
122
|
+
"../workbench/src/recording-adoption.ts",
|
|
123
|
+
"../workbench/src/document-voices.ts",
|
|
124
|
+
"../workbench/src/component-properties.ts",
|
|
125
|
+
"../workbench/src/caption-timing.ts",
|
|
126
|
+
"../workbench/src/step-production.ts",
|
|
127
|
+
"../workbench/src/document-timing-drafts.ts",
|
|
128
|
+
"../workbench/src/caption-timing-drafts.ts",
|
|
129
|
+
"../workbench/src/document-production.ts",
|
|
130
|
+
"../design/src/icons.ts",
|
|
131
|
+
"../design/src/tokens.ts",
|
|
132
|
+
"../design/src/assets/brand.ts",
|
|
133
|
+
"../design/src/index.ts",
|
|
134
|
+
"../workbench/src/base-controls.tsx",
|
|
135
|
+
"../workbench/src/sortable-list.tsx",
|
|
136
|
+
"../workbench/src/components.tsx",
|
|
111
137
|
"../workbench/src/schema-form/context.ts",
|
|
112
138
|
"../workbench/src/schema-form/fields.tsx",
|
|
113
139
|
"../workbench/src/schema-form/templates.tsx",
|
|
114
140
|
"../workbench/src/schema-form/widgets.tsx",
|
|
115
141
|
"../workbench/src/schema-form/validator.ts",
|
|
116
142
|
"../workbench/src/schema-form/PmSchemaForm.tsx",
|
|
117
|
-
"../workbench/src/step-production.ts",
|
|
118
143
|
"../workbench/src/StepProductionEditor.tsx",
|
|
119
144
|
"../workbench/src/media-messages.ts",
|
|
120
145
|
"../workbench/src/media-time.ts",
|
|
121
146
|
"../workbench/src/MediaClipEditor.tsx",
|
|
122
|
-
"../workbench/src/shortcuts.ts",
|
|
123
|
-
"../workbench/src/messages.ts",
|
|
124
147
|
"../workbench/src/context.tsx",
|
|
125
148
|
"../workbench/src/places.ts",
|
|
126
149
|
"../workbench/src/preview.ts",
|
|
127
|
-
"../workbench/src/caption-timing.ts",
|
|
128
150
|
"../workbench/src/document-draft-store.ts",
|
|
129
151
|
"../workbench/src/document-editor/comment-drafts.ts",
|
|
130
152
|
"../workbench/src/component-property-drafts.ts",
|
|
131
|
-
"../workbench/src/component-properties.ts",
|
|
132
153
|
"../workbench/src/authoring-draft-fragment.ts",
|
|
133
154
|
"../workbench/src/document-editor/comment-draft-inspection.ts",
|
|
134
155
|
"../workbench/src/document-editor/comment-draft-actions.ts",
|
|
156
|
+
"../workbench/src/body-draft-actions.ts",
|
|
135
157
|
"../workbench/src/component-draft-inspection.ts",
|
|
136
158
|
"../workbench/src/component-draft-actions.ts",
|
|
137
|
-
"../workbench/src/workspace-client.ts",
|
|
138
159
|
"../workbench/src/document-drafts.ts",
|
|
139
160
|
"../workbench/src/document-session.ts",
|
|
140
|
-
"../workbench/src/recording-adoption.ts",
|
|
141
161
|
"../workbench/src/transcription-session.ts",
|
|
142
162
|
"../workbench/src/audio-recording.ts",
|
|
143
|
-
"../workbench/src/document-return-point.ts",
|
|
144
|
-
"../workbench/src/document-editor/table-identities.ts",
|
|
145
|
-
"../workbench/src/document-editor/selection.ts",
|
|
146
|
-
"../workbench/src/document-voices.ts",
|
|
147
|
-
"../workbench/src/document-timing-drafts.ts",
|
|
148
|
-
"../workbench/src/caption-timing-drafts.ts",
|
|
149
163
|
"../workbench/src/document-preview.ts",
|
|
150
164
|
"../workbench/src/diagnostics.ts",
|
|
151
165
|
"../workbench/src/history.ts",
|
|
@@ -159,10 +173,6 @@
|
|
|
159
173
|
"../workbench/src/panels/ExportPanel.tsx",
|
|
160
174
|
"../workbench/src/panels/HistoryPanel.tsx",
|
|
161
175
|
"../workbench/src/preview-pool.ts",
|
|
162
|
-
"../workbench/src/document-editor/inline.ts",
|
|
163
|
-
"../workbench/src/document-editor/rich-text.ts",
|
|
164
|
-
"../workbench/src/document-editor/projection.ts",
|
|
165
|
-
"../workbench/src/panels/ChangeTrail.tsx",
|
|
166
176
|
"../workbench/src/panels/PreviewPanel.tsx",
|
|
167
177
|
"../workbench/src/document-editor/blocknote-messages.ts",
|
|
168
178
|
"../workbench/src/document-editor/colors.ts",
|
|
@@ -172,15 +182,19 @@
|
|
|
172
182
|
"../workbench/src/document-editor/schema.tsx",
|
|
173
183
|
"../workbench/src/document-editor/file-input.ts",
|
|
174
184
|
"../workbench/src/document-editor/clipboard.ts",
|
|
185
|
+
"../workbench/src/document-editor/page-body.ts",
|
|
175
186
|
"../workbench/src/document-editor/authoring.tsx",
|
|
187
|
+
"../workbench/src/document-editor/inline.ts",
|
|
188
|
+
"../workbench/src/document-editor/rich-text.ts",
|
|
176
189
|
"../workbench/src/document-editor/comments.ts",
|
|
190
|
+
"../workbench/src/document-editor/component-label.ts",
|
|
177
191
|
"../workbench/src/document-editor/DocumentComments.tsx",
|
|
178
192
|
"../workbench/src/document-editor/NewCommentDrafts.tsx",
|
|
179
193
|
"../workbench/src/document-editor/BlockNoteSurface.tsx",
|
|
180
|
-
"../workbench/src/document-editor/focus.ts",
|
|
181
|
-
"../workbench/src/document-editor/narration.ts",
|
|
182
194
|
"../workbench/src/document-editor/narration-schema.tsx",
|
|
183
195
|
"../workbench/src/document-editor/NarrationEditor.tsx",
|
|
196
|
+
"../workbench/src/document-editor/focus.ts",
|
|
197
|
+
"../workbench/src/document-editor/narration.ts",
|
|
184
198
|
"../workbench/src/document-editor/DocumentStepNarration.tsx",
|
|
185
199
|
"../workbench/src/production-messages.ts",
|
|
186
200
|
"../workbench/src/voice-drafts.ts",
|
|
@@ -196,6 +210,7 @@
|
|
|
196
210
|
"../workbench/src/panels/DocumentVoiceDialog.tsx",
|
|
197
211
|
"../workbench/src/panels/DocumentVoiceField.tsx",
|
|
198
212
|
"../workbench/src/panels/VoiceoverDialog.tsx",
|
|
213
|
+
"../workbench/src/panels/ProductionCaptionSize.tsx",
|
|
199
214
|
"../workbench/src/caption-timing-messages.ts",
|
|
200
215
|
"../workbench/src/panels/ProductionCaptionTiming.tsx",
|
|
201
216
|
"../workbench/src/audio-waveform.ts",
|
|
@@ -212,6 +227,8 @@
|
|
|
212
227
|
"../workbench/src/panels/ProductionPanel.tsx",
|
|
213
228
|
"../workbench/src/panels/PageRenameDialog.tsx",
|
|
214
229
|
"../workbench/src/panels/PageDeleteDialog.tsx",
|
|
230
|
+
"../workbench/src/document-editor/projection.ts",
|
|
231
|
+
"../workbench/src/document-editor/insertion-place.ts",
|
|
215
232
|
"../workbench/src/document-editor/DocumentEditor.tsx",
|
|
216
233
|
"../workbench/src/document-editor/block-preview-messages.ts",
|
|
217
234
|
"../workbench/src/document-editor/DocumentBlockFallback.tsx",
|
|
@@ -219,16 +236,17 @@
|
|
|
219
236
|
"../workbench/src/component-property-messages.ts",
|
|
220
237
|
"../workbench/src/document-editor/ComponentMaterials.tsx",
|
|
221
238
|
"../workbench/src/document-editor/ComponentPropertiesDialog.tsx",
|
|
239
|
+
"../workbench/src/document-editor/PlaceComment.tsx",
|
|
222
240
|
"../workbench/src/document-editor/DocumentBlockPreview.tsx",
|
|
223
241
|
"../workbench/src/panels/SourceDocumentPanel.tsx",
|
|
224
242
|
"../workbench/src/panels/DocumentNarrationPanel.tsx",
|
|
225
243
|
"../workbench/src/panels/DocumentView.tsx",
|
|
226
244
|
"../workbench/src/panels/HomePanel.tsx",
|
|
227
245
|
"../workbench/src/approvals.tsx",
|
|
228
|
-
"../workbench/src/assistant-mascot.ts",
|
|
229
246
|
"../workbench/src/speech-settings-messages.ts",
|
|
230
247
|
"../workbench/src/panels/SpeechSettingsPanel.tsx",
|
|
231
248
|
"../workbench/src/authoring-client.ts",
|
|
249
|
+
"../workbench/src/authoring-window.ts",
|
|
232
250
|
"../workbench/src/index.ts",
|
|
233
251
|
"src/workspace-events.ts",
|
|
234
252
|
"src/client/workspace-events.ts",
|
|
@@ -238,7 +256,6 @@
|
|
|
238
256
|
"src/client/settings-opener.ts",
|
|
239
257
|
"src/client/messages.ts",
|
|
240
258
|
"src/client/brand.tsx",
|
|
241
|
-
"src/client/mascot.tsx",
|
|
242
259
|
"src/client/document-context.ts",
|
|
243
260
|
"src/client/observable.ts",
|
|
244
261
|
"src/client/runtime-diagnostics.tsx",
|
package/cordis.patch.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincyaw/dsh",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.50",
|
|
4
4
|
"description": "Presmium's bundle for DeepSeek Harness: the workbench of presmium studio, its host side (Presmium's tools, approvals, document context, skills and routes) and its client side (the root layout and the workbench's panels, precompiled) (experimental)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -73,7 +73,6 @@
|
|
|
73
73
|
"skills": [
|
|
74
74
|
"presmium-animate",
|
|
75
75
|
"presmium-author",
|
|
76
|
-
"presmium-present",
|
|
77
76
|
"presmium-develop"
|
|
78
77
|
],
|
|
79
78
|
"generated": [
|
|
@@ -83,12 +82,13 @@
|
|
|
83
82
|
"dependencies": {
|
|
84
83
|
"eventsource": "3.0.7",
|
|
85
84
|
"jiti": "^2.7.0",
|
|
85
|
+
"node-addon-require-builtin": "0.1.9",
|
|
86
86
|
"ws": "8.22.0",
|
|
87
87
|
"zod": "4.4.3",
|
|
88
|
-
"@lincyaw/kernel": "1.0.0-rc.
|
|
89
|
-
"@lincyaw/
|
|
90
|
-
"@lincyaw/
|
|
91
|
-
"@lincyaw/
|
|
88
|
+
"@lincyaw/kernel": "1.0.0-rc.51",
|
|
89
|
+
"@lincyaw/cli": "1.0.0-rc.51",
|
|
90
|
+
"@lincyaw/mcp": "1.0.0-rc.51",
|
|
91
|
+
"@lincyaw/skills": "1.0.0-rc.51"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"@deepseek-ai/dsh": "0.2.1-alpha.4"
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"react": "18.3.1",
|
|
105
105
|
"react-dom": "18.3.1",
|
|
106
106
|
"react-resizable-panels": "^4.14.5",
|
|
107
|
-
"@lincyaw/
|
|
108
|
-
"@lincyaw/
|
|
107
|
+
"@lincyaw/design": "1.0.0-rc.51",
|
|
108
|
+
"@lincyaw/workbench": "0.2.0-rc.51"
|
|
109
109
|
},
|
|
110
110
|
"scripts": {}
|
|
111
111
|
}
|
|
@@ -9,6 +9,9 @@ import { CLIENT_MESSAGES } from './messages.ts'
|
|
|
9
9
|
* the repair of the selected document's diagnostics. Each is prompted on the session after its document context is
|
|
10
10
|
* set, and the conversation is shown. Without a usable model nothing is sent: the conversation is shown, where the
|
|
11
11
|
* composer offers to set one up, and the request answers with that in the author's terms.
|
|
12
|
+
*
|
|
13
|
+
* Drafts (the slash menu's animation request) go into the session's composer instead, for the author to finish and
|
|
14
|
+
* send. Without a model the composer's takeover shows over the draft, which waits beneath it.
|
|
12
15
|
*/
|
|
13
16
|
export function registerAgentRequests(ctx: DshClientContext, workbench: Workbench, setup: AssistantSetup): void {
|
|
14
17
|
ctx.inject(['sessions', 'layout'], inner => inner.effect(() => {
|
|
@@ -61,4 +64,48 @@ export function registerAgentRequests(ctx: DshClientContext, workbench: Workbenc
|
|
|
61
64
|
update()
|
|
62
65
|
return () => { off(); offRequests?.() }
|
|
63
66
|
}, 'presmium: hand the author\'s requests to the current session'))
|
|
67
|
+
|
|
68
|
+
ctx.inject(['sessions', 'layout', 'conversation'], inner => inner.effect(() => {
|
|
69
|
+
let offDrafts: (() => void) | undefined
|
|
70
|
+
let active: DshSessionBinding | undefined
|
|
71
|
+
const update = () => {
|
|
72
|
+
const row = mainViewAgentSession(inner.sessions.list.getSnapshot().byId)
|
|
73
|
+
const binding = row && inner.sessions.binding(row.id)
|
|
74
|
+
if (binding === active) return
|
|
75
|
+
offDrafts?.()
|
|
76
|
+
offDrafts = undefined
|
|
77
|
+
active = binding
|
|
78
|
+
if (!row || !binding) return
|
|
79
|
+
// Whatever the author wrote stays above the draft; a draft put here and not changed since is replaced by the next.
|
|
80
|
+
let last: { kept: string, text: string } | undefined
|
|
81
|
+
offDrafts = workbench.onAgentDraft(draft => {
|
|
82
|
+
if (active !== binding || inner.sessions.binding(row.id) !== binding) throw new Error('no-conversation')
|
|
83
|
+
const input = inner.conversation.input.for(binding.ctx)
|
|
84
|
+
const { draft: current, phase } = input.state.getSnapshot()
|
|
85
|
+
if (phase !== 'plain') throw new Error('no-conversation')
|
|
86
|
+
const kept = last && current.trim() === (last.kept + last.text).trim() ? last.kept : current.trim() ? `${current.trimEnd()}\n` : ''
|
|
87
|
+
const text = kept + draft.text
|
|
88
|
+
last = { kept, text: draft.text }
|
|
89
|
+
input.setDraft(text)
|
|
90
|
+
inner.layout.selectPanel(null)
|
|
91
|
+
// The composer takes the keyboard once the conversation is shown (under the takeover it stays where it was).
|
|
92
|
+
// Focus brings back the caret the composer last held, which the draft does not move: the browser's selection
|
|
93
|
+
// goes to the end of the focused editor, and the composer's editor follows it.
|
|
94
|
+
const frame = (then: () => void) => requestAnimationFrame(() => requestAnimationFrame(then))
|
|
95
|
+
if (setup.readiness.getSnapshot() !== 'missing') frame(() => {
|
|
96
|
+
input.focus()
|
|
97
|
+
frame(() => {
|
|
98
|
+
const editor = document.activeElement
|
|
99
|
+
if (!(editor instanceof HTMLElement) || !editor.isContentEditable || input.state.getSnapshot().draft !== text) return
|
|
100
|
+
const selection = getSelection()
|
|
101
|
+
selection?.selectAllChildren(editor)
|
|
102
|
+
selection?.collapseToEnd()
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
const off = inner.sessions.list.subscribe(update)
|
|
108
|
+
update()
|
|
109
|
+
return () => { off(); offDrafts?.() }
|
|
110
|
+
}, 'presmium: put the author\'s drafts in the current session\'s composer'))
|
|
64
111
|
}
|
package/src/client/contract.ts
CHANGED
|
@@ -23,12 +23,6 @@ export const ONBOARDING = { slot: 'settings.onboarding', steps: ['welcome-notice
|
|
|
23
23
|
*/
|
|
24
24
|
export const ASSISTANT_SLOTS = ['conversation.composer', { name: 'conversation.chat.node', key: 'turn-error' }] as const
|
|
25
25
|
|
|
26
|
-
/** Where the kitten sits beside the conversation: an added entry (its own id) among the session header's actions. */
|
|
27
|
-
export const MASCOT_SLOT = { name: 'conversation.session.header.actions', id: 'presmium-mascot' } as const
|
|
28
|
-
|
|
29
|
-
/** Where the author turns the kitten on or off: an added row (its own id) in Settings → General. */
|
|
30
|
-
export const MASCOT_SETTING = { name: 'settings.general.item', id: 'presmium-mascot' } as const
|
|
31
|
-
|
|
32
26
|
/**
|
|
33
27
|
* Settings → Models, and when the model catalog is read again: on the Host's events that change what can be routed,
|
|
34
28
|
* whenever the window regains focus, and on a slow poll while no model is usable (Settings is a modal over this page,
|
package/src/client/dsh.d.ts
CHANGED
|
@@ -125,6 +125,17 @@ interface DshSessionBinding {
|
|
|
125
125
|
beginSubmission(input: { mode: 'queue', text: string, attachments: [] }): { requestId: string, abandon(): void }
|
|
126
126
|
prompt(content: { type: 'text', text: string }[], mode: 'queue', signal: AbortSignal | undefined, requestId: string): Promise<{ ok: true, value: { accepted: true } } | { ok: false, error: { code: string, message: string } }>
|
|
127
127
|
}
|
|
128
|
+
/** The session's scope, which addresses its composer through `conversation.input`. */
|
|
129
|
+
ctx: unknown
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** A session's composer (`SessionInput` of `@deepseek-ai/dsh-client-ui-conversation`), as far as it is used here. */
|
|
133
|
+
interface DshSessionInput {
|
|
134
|
+
/** Replaces the whole draft with plain text; the caret lands at its end. */
|
|
135
|
+
setDraft(text: string): void
|
|
136
|
+
/** Gives the keyboard back to the composer, with the caret it last held. */
|
|
137
|
+
focus(): void
|
|
138
|
+
readonly state: DshObservable<{ draft: string, phase: 'plain' | 'adjudicating' | 'claimed' | 'submitting' }>
|
|
128
139
|
}
|
|
129
140
|
|
|
130
141
|
interface DshClientContext {
|
|
@@ -141,6 +152,7 @@ interface DshClientContext {
|
|
|
141
152
|
sidebarRight: { active(): { id: string, kind: string, contentId: string } | undefined, close(id: string): void, isExpanded(): boolean, toggleExpanded(): void }
|
|
142
153
|
layout: { selectPanel(id: string | null): void }
|
|
143
154
|
sessions: { list: DshObservable<{ byId: Record<string, { id: string, cwd?: string, retainedBy: { mainView?: number } }> }>, binding(id: string): DshSessionBinding | undefined }
|
|
155
|
+
conversation: { input: { for(scope: unknown): DshSessionInput } }
|
|
144
156
|
uiWorkspace: { openWorkspace(id: string, beforeOpen?: (sessionId: string) => void): Promise<void>, startSession(id?: string): void }
|
|
145
157
|
workspaces: { list: DshObservable<{ items: readonly { workspaceId: string, path: string }[] }> }
|
|
146
158
|
configForms: {
|
package/src/client/index.tsx
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { connectAuthoringClient, localeOf, Workbench, workspaceClient } from '@lincyaw/workbench'
|
|
1
|
+
import { connectAuthoringClient, connectAuthoringWindow, localeOf, Workbench, workspaceClient } from '@lincyaw/workbench'
|
|
2
2
|
import type { Locale } from '@lincyaw/workbench'
|
|
3
3
|
import { workspaceSubscriptions } from './workspace-events.ts'
|
|
4
4
|
import { registerAuthorSettings } from './author-settings.ts'
|
|
5
5
|
import { registerSpeechSettings } from './speech-settings.tsx'
|
|
6
6
|
import { openSpeechSettings } from './settings-opener.ts'
|
|
7
7
|
import { registerBrand } from './brand.tsx'
|
|
8
|
-
import { registerMascot } from './mascot.tsx'
|
|
9
8
|
import { CLIENT_ID, isBootEntryLoaded, ROOT_CHILDREN, UI_LAYOUT, UI_SIDEBAR } from './contract.ts'
|
|
10
9
|
import { syncDocumentContext } from './document-context.ts'
|
|
11
10
|
import { FALLBACK_PANEL, registerFallbackLayout } from './fallback.tsx'
|
|
@@ -56,6 +55,7 @@ export function apply(ctx: DshClientContext): void {
|
|
|
56
55
|
const workbench = new Workbench({ client: workspaceClient('api/presmium/', workspaceSubscriptions(ctx)), locale: workbenchLocale(ctx.locale.getLocale().active) })
|
|
57
56
|
workbench.client.openSpeechSettings = openSpeechSettings
|
|
58
57
|
ctx.effect(() => connectAuthoringClient(workbench), 'presmium: authoring client control')
|
|
58
|
+
ctx.effect(() => connectAuthoringWindow(workbench), 'presmium: authoring window control')
|
|
59
59
|
ctx.effect(() => runtimeDiagnostics(workbench).start(), 'presmium: runtime diagnostics')
|
|
60
60
|
let showEditor = (layout: DshClientContext['layout']) => layout.selectPanel(FALLBACK_PANEL)
|
|
61
61
|
registerSourceLinks(ctx, workbench, layout => showEditor(layout))
|
|
@@ -148,7 +148,6 @@ export function apply(ctx: DshClientContext): void {
|
|
|
148
148
|
}, 'presmium: the root layout and ctx.layout')
|
|
149
149
|
}
|
|
150
150
|
registerBrand(ctx, workbench)
|
|
151
|
-
registerMascot(ctx, workbench)
|
|
152
151
|
registerAuthorSettings(ctx)
|
|
153
152
|
registerSpeechSettings(ctx, workbench)
|
|
154
153
|
ctx.inject(['layout'], inner => inner.effect(() => connectLaunchTarget(workbench,
|
package/src/client/messages.ts
CHANGED
|
@@ -18,10 +18,6 @@ const zh = {
|
|
|
18
18
|
history: '版本历史',
|
|
19
19
|
settings: '设置',
|
|
20
20
|
help: '帮助',
|
|
21
|
-
mascot: '小猫',
|
|
22
|
-
mascotHint: 'AI 助手工作时,对话和文稿旁的小猫会演示它在做什么:思考、阅读、修改或等你确认。',
|
|
23
|
-
mascotShow: '显示',
|
|
24
|
-
mascotHide: '隐藏',
|
|
25
21
|
close: '关闭',
|
|
26
22
|
toggleSide: '显示或隐藏对话记录',
|
|
27
23
|
keys: {
|
|
@@ -41,7 +37,7 @@ const zh = {
|
|
|
41
37
|
models: '设置模型',
|
|
42
38
|
helpItems: [
|
|
43
39
|
'直接在文稿中输入即可修改。修改自动保存,文稿上方显示“已保存”。',
|
|
44
|
-
'
|
|
40
|
+
'选中文字会出现格式工具栏:段落样式、加粗、对齐、颜色、“插入链接”与“新建批注”。“新建批注”在选中的文字上留下批注,“批注”窗格列出全部批注。动画、图表的预览工具栏里有“本步批注”,可以对整个内容块或其中一步批注。',
|
|
45
41
|
'鼠标移到一段内容上,旁边的“插入内容块”可插入标题、列表、表格、图片等内容,“打开内容块菜单”可删除这一段或修改它的颜色。',
|
|
46
42
|
'“导航窗格”列出全部页面:“新建页面”添加一页,页面旁的“更多”可以重命名、复制、上移、下移或删除这一页。',
|
|
47
43
|
'“撤消”({undo})与“恢复”({redo})逐步撤消或恢复修改。“版本历史”列出保存过的每次修改,“撤消此更改”单独撤消其中一次。',
|
|
@@ -94,10 +90,6 @@ const en: ClientMessages = {
|
|
|
94
90
|
history: 'Version History',
|
|
95
91
|
settings: 'Settings',
|
|
96
92
|
help: 'Help',
|
|
97
|
-
mascot: 'Kitten',
|
|
98
|
-
mascotHint: 'While the AI Assistant works, a kitten beside the chat and the document acts out what it is doing: thinking, reading, changing the document, or waiting for you.',
|
|
99
|
-
mascotShow: 'Show',
|
|
100
|
-
mascotHide: 'Hide',
|
|
101
93
|
close: 'Close',
|
|
102
94
|
toggleSide: 'Show or Hide Chat History',
|
|
103
95
|
keys: {
|
|
@@ -117,7 +109,7 @@ const en: ClientMessages = {
|
|
|
117
109
|
models: 'Set Up a Model',
|
|
118
110
|
helpItems: [
|
|
119
111
|
'Type directly in the document to change it. Changes save automatically, and the top of the document shows Saved.',
|
|
120
|
-
'Select text to show the formatting toolbar: paragraph style, Bold, alignment, Colors, Insert Link, and New Comment. New Comment leaves a comment on the selected text; the Comments pane lists them all.',
|
|
112
|
+
'Select text to show the formatting toolbar: paragraph style, Bold, alignment, Colors, Insert Link, and New Comment. New Comment leaves a comment on the selected text; the Comments pane lists them all. An animation or chart preview also has Comment on step, for the whole content block or one step.',
|
|
121
113
|
'Point at a paragraph: Insert Block, beside it, inserts a heading, list, table, picture, and more; Open Block Menu deletes the paragraph or changes its colors.',
|
|
122
114
|
'The Navigation Pane lists the pages: New Page adds one, and More beside a page renames, duplicates, moves, or deletes it.',
|
|
123
115
|
'Undo ({undo}) and Redo ({redo}) step back and forth through your changes. Version History lists every saved change; Undo This Change reverses one of them.',
|
package/src/client/styles.css
CHANGED
|
@@ -1,45 +1,3 @@
|
|
|
1
1
|
@import '@lincyaw/design/design.css';
|
|
2
2
|
@import '@lincyaw/workbench/styles.css';
|
|
3
3
|
@import './frame.css';
|
|
4
|
-
|
|
5
|
-
/* The kitten among the conversation header's actions. */
|
|
6
|
-
.pmw-conversation-mascot {
|
|
7
|
-
display: inline-flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/* The kitten's row in Settings → General, laid out as Harness's own rows: its name and note, then its choice. */
|
|
12
|
-
.pmw-mascot-setting {
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: space-between;
|
|
16
|
-
gap: var(--pm-space-4);
|
|
17
|
-
padding-block: var(--pm-space-4);
|
|
18
|
-
border-top: var(--pm-size-hairline) solid var(--pm-color-line);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.pmw-mascot-setting__copy {
|
|
22
|
-
display: grid;
|
|
23
|
-
gap: var(--pm-space-1);
|
|
24
|
-
min-width: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.pmw-mascot-setting__title {
|
|
28
|
-
margin: 0;
|
|
29
|
-
color: var(--pm-color-ink);
|
|
30
|
-
font-size: var(--pm-text-sm);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.pmw-mascot-setting__hint {
|
|
34
|
-
margin: 0;
|
|
35
|
-
color: var(--pm-color-muted);
|
|
36
|
-
font-size: var(--pm-text-xs);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.pmw-mascot-setting .pm-ui-segmented {
|
|
40
|
-
flex: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@media (max-width: 767px) {
|
|
44
|
-
.pmw-mascot-setting { flex-wrap: wrap; }
|
|
45
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WebSocket } from 'partysocket'
|
|
2
2
|
import type { WorkspaceSubscription } from '@lincyaw/workbench'
|
|
3
|
-
import type {
|
|
3
|
+
import type { AuthoringClientEvent, AuthoringWindowEvent } from '@lincyaw/kernel'
|
|
4
4
|
import { AUTHORING_CLIENT_REQUEST_TIMEOUT_MS } from '@lincyaw/kernel'
|
|
5
5
|
import { WORKSPACE_EVENTS_PATH, workspaceEventMessage } from '../workspace-events.ts'
|
|
6
6
|
import type { WorkspaceEventTopic, WorkspaceEventCommand } from '../workspace-events.ts'
|
|
@@ -89,7 +89,7 @@ export function workspaceSubscriptions(ctx: Pick<DshClientContext, 'effect'>): W
|
|
|
89
89
|
const topic = TOPICS[name]
|
|
90
90
|
const query = new URL(address).searchParams
|
|
91
91
|
const document = query.get('document')
|
|
92
|
-
if (!topic || topic === 'authoring-client' || document === null) throw new Error('Invalid workspace event subscription.')
|
|
92
|
+
if (!topic || topic === 'authoring-client' || topic === 'authoring-window' || document === null) throw new Error('Invalid workspace event subscription.')
|
|
93
93
|
const request: Subscription['request'] = topic === 'viewer-site'
|
|
94
94
|
? { type: 'subscribe', id: '', topic, document, app: query.get('app') ?? '', lang: query.get('lang') ?? '', form: query.get('form') === 'slides' ? 'slides' : 'web' }
|
|
95
95
|
: topic === 'viewer-control' ? { type: 'subscribe', id: '', topic, document, window: query.get('window') ?? '' }
|
|
@@ -97,18 +97,20 @@ export function workspaceSubscriptions(ctx: Pick<DshClientContext, 'effect'>): W
|
|
|
97
97
|
const reader: Subscription = { request, received, failed, ready }
|
|
98
98
|
return add(reader)
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
const reader: Subscription = { request
|
|
102
|
-
received(raw) { let event:
|
|
100
|
+
const openControl = <Event extends { type: string }>(request: Subscription['request'], received: (event: Event) => void, failed: () => void) => {
|
|
101
|
+
const reader: Subscription = { request, pending: new Map(), failed,
|
|
102
|
+
received(raw) { let event: Event; try { event = JSON.parse(raw) } catch { return }; if (event.type === 'connected') rejectPublications(reader); received(event) } }
|
|
103
103
|
const close = add(reader)
|
|
104
|
-
const publish = (kind: 'state' | 'ack', connectionId: string, report:
|
|
104
|
+
const publish = (kind: 'state' | 'ack', connectionId: string, report: { sequence: number }) => new Promise<void>((resolve, reject) => {
|
|
105
105
|
if (closed || !readers.has(reader) || !reader.id || socket.readyState !== WebSocket.OPEN || reader.pending!.has(report.sequence)) { reject(new Error('client-transport-disconnected')); return }
|
|
106
106
|
// A lost publication receipt must release the queue without authorizing a repeated action.
|
|
107
107
|
const timer = setTimeout(() => { reader.pending!.delete(report.sequence); reject(new Error('client-publication-timeout')) }, AUTHORING_CLIENT_REQUEST_TIMEOUT_MS / 2)
|
|
108
108
|
reader.pending!.set(report.sequence, { resolve, reject, timer })
|
|
109
109
|
socket.send(JSON.stringify({ type: 'authoring-client-publish', id: reader.id, connectionId, sequence: report.sequence, kind, value: report }))
|
|
110
110
|
})
|
|
111
|
-
return { close, publish: (connectionId, report) => publish('state', connectionId, report), acknowledge: (connectionId, report) => publish('ack', connectionId, report) }
|
|
111
|
+
return { close, publish: (connectionId: string, report: { sequence: number }) => publish('state', connectionId, report), acknowledge: (connectionId: string, report: { sequence: number }) => publish('ack', connectionId, report) }
|
|
112
112
|
}
|
|
113
|
+
subscription.openAuthoringClient = (document, open, received, failed) => openControl<AuthoringClientEvent>({ type: 'subscribe', id: '', topic: 'authoring-client', document, ...open }, received, failed)
|
|
114
|
+
subscription.openAuthoringWindow = (open, received, failed) => openControl<AuthoringWindowEvent>({ type: 'subscribe', id: '', topic: 'authoring-window', ...open }, received, failed)
|
|
113
115
|
return subscription
|
|
114
116
|
}
|