@khorsheed/dsh-client-message-tools 0.1.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 (72) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +21 -0
  3. package/README.en.md +82 -0
  4. package/README.i18n.yaml +6 -0
  5. package/README.md +82 -0
  6. package/cordis.patch.yml +6 -0
  7. package/lib/client.js +5824 -0
  8. package/lib/client.js.map +1 -0
  9. package/lib/index.js +644 -0
  10. package/lib/invariant.js +27 -0
  11. package/lib/tsconfig.client.tsbuildinfo +1 -0
  12. package/lib/tsconfig.host.tsbuildinfo +1 -0
  13. package/lib/typert.host.d.ts +3 -0
  14. package/lib/typert.host.js +250 -0
  15. package/lib/typert.remote-client.d.ts +26 -0
  16. package/lib/typert.remote-client.d.ts.map +1 -0
  17. package/lib/typert.remote-client.js +154 -0
  18. package/lib/types/client/ModelChip.d.ts +29 -0
  19. package/lib/types/client/ModelChip.d.ts.map +1 -0
  20. package/lib/types/client/ModelChip.js +86 -0
  21. package/lib/types/client/RestoredMessageView.d.ts +17 -0
  22. package/lib/types/client/RestoredMessageView.d.ts.map +1 -0
  23. package/lib/types/client/RestoredMessageView.js +9 -0
  24. package/lib/types/client/UserMessageView.d.ts +16 -0
  25. package/lib/types/client/UserMessageView.d.ts.map +1 -0
  26. package/lib/types/client/UserMessageView.js +172 -0
  27. package/lib/types/client/WithdrawnDividerView.d.ts +17 -0
  28. package/lib/types/client/WithdrawnDividerView.d.ts.map +1 -0
  29. package/lib/types/client/WithdrawnDividerView.js +59 -0
  30. package/lib/types/client/backfill.d.ts +19 -0
  31. package/lib/types/client/backfill.d.ts.map +1 -0
  32. package/lib/types/client/backfill.js +20 -0
  33. package/lib/types/client/dom-hider.d.ts +61 -0
  34. package/lib/types/client/dom-hider.d.ts.map +1 -0
  35. package/lib/types/client/dom-hider.js +195 -0
  36. package/lib/types/client/edit-in-place.d.ts +107 -0
  37. package/lib/types/client/edit-in-place.d.ts.map +1 -0
  38. package/lib/types/client/edit-in-place.js +97 -0
  39. package/lib/types/client/icons.d.ts +23 -0
  40. package/lib/types/client/icons.d.ts.map +1 -0
  41. package/lib/types/client/icons.js +11 -0
  42. package/lib/types/client/index.d.ts +39 -0
  43. package/lib/types/client/index.d.ts.map +1 -0
  44. package/lib/types/client/index.js +187 -0
  45. package/lib/types/client/locales.d.ts +74 -0
  46. package/lib/types/client/locales.d.ts.map +1 -0
  47. package/lib/types/client/locales.js +65 -0
  48. package/lib/types/client/slots.d.ts +44 -0
  49. package/lib/types/client/slots.d.ts.map +1 -0
  50. package/lib/types/client/slots.js +1 -0
  51. package/lib/types/client/withdraw-backfill.d.ts +25 -0
  52. package/lib/types/client/withdraw-backfill.d.ts.map +1 -0
  53. package/lib/types/client/withdraw-backfill.js +21 -0
  54. package/lib/types/client/withdrawn-node.d.ts +163 -0
  55. package/lib/types/client/withdrawn-node.d.ts.map +1 -0
  56. package/lib/types/client/withdrawn-node.js +297 -0
  57. package/lib/types/index.d.ts +69 -0
  58. package/lib/types/index.d.ts.map +1 -0
  59. package/lib/types/index.js +175 -0
  60. package/lib/types/invariant.d.ts +16 -0
  61. package/lib/types/invariant.d.ts.map +1 -0
  62. package/lib/types/invariant.js +25 -0
  63. package/lib/types/marker.d.ts +94 -0
  64. package/lib/types/marker.d.ts.map +1 -0
  65. package/lib/types/marker.js +131 -0
  66. package/lib/types/types.d.ts +116 -0
  67. package/lib/types/types.d.ts.map +1 -0
  68. package/lib/types/types.js +1 -0
  69. package/lib/types/withdraw.d.ts +112 -0
  70. package/lib/types/withdraw.d.ts.map +1 -0
  71. package/lib/types/withdraw.js +279 -0
  72. package/package.json +108 -0
@@ -0,0 +1,250 @@
1
+ /* Generated by @deepseek-ai/dsh-typert-generator from FaceModel — do not edit. */
2
+ import { z } from 'zod'
3
+
4
+ const _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema = z.object({
5
+ 'sessionId': z.intersection(z.string(), z.unknown()).readonly(),
6
+ 'targetSeq': z.number().readonly(),
7
+ 'text': z.string().readonly(),
8
+ })
9
+ const _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema = z.union([z.object({
10
+ 'ok': z.literal(true).readonly(),
11
+ 'value': z.object({
12
+ 'replacementSeq': z.number().readonly(),
13
+ 'triggered': z.boolean().readonly(),
14
+ }).readonly(),
15
+ }), z.object({
16
+ 'ok': z.literal(false).readonly(),
17
+ 'error': z.union([z.object({
18
+ 'code': z.literal("session-not-found").readonly(),
19
+ }), z.object({
20
+ 'code': z.literal("target-not-found").readonly(),
21
+ }), z.object({
22
+ 'code': z.literal("not-a-user-message").readonly(),
23
+ }), z.object({
24
+ 'code': z.literal("already-withdrawn").readonly(),
25
+ }), z.object({
26
+ 'code': z.literal("empty-text").readonly(),
27
+ })]).readonly(),
28
+ })])
29
+ const _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema = z.object({
30
+ 'sessionId': z.intersection(z.string(), z.unknown()).readonly(),
31
+ 'targetSeq': z.number().readonly(),
32
+ })
33
+ const _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema = z.union([z.object({
34
+ 'ok': z.literal(true).readonly(),
35
+ 'value': z.object({
36
+ 'restoredSeq': z.number().readonly(),
37
+ }).readonly(),
38
+ }), z.object({
39
+ 'ok': z.literal(false).readonly(),
40
+ 'error': z.union([z.object({
41
+ 'code': z.literal("session-not-found").readonly(),
42
+ }), z.object({
43
+ 'code': z.literal("target-not-found").readonly(),
44
+ }), z.object({
45
+ 'code': z.literal("not-a-user-message").readonly(),
46
+ }), z.object({
47
+ 'code': z.literal("not-withdrawn").readonly(),
48
+ })]).readonly(),
49
+ })])
50
+ const _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema = z.object({
51
+ 'sessionId': z.intersection(z.string(), z.unknown()).readonly(),
52
+ 'targetSeq': z.number().readonly(),
53
+ })
54
+ const _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema = z.union([z.object({
55
+ 'ok': z.literal(true).readonly(),
56
+ 'value': z.object({
57
+ 'replacementSeq': z.number().readonly(),
58
+ 'shadowedCount': z.number().readonly(),
59
+ }).readonly(),
60
+ }), z.object({
61
+ 'ok': z.literal(false).readonly(),
62
+ 'error': z.union([z.object({
63
+ 'code': z.literal("session-not-found").readonly(),
64
+ }), z.object({
65
+ 'code': z.literal("target-not-found").readonly(),
66
+ }), z.object({
67
+ 'code': z.literal("not-a-user-message").readonly(),
68
+ }), z.object({
69
+ 'code': z.literal("already-withdrawn").readonly(),
70
+ })]).readonly(),
71
+ })])
72
+
73
+ export const TYPERT = {
74
+ package: '@khorsheed/dsh-client-message-tools',
75
+ face: 'host',
76
+ schemas: [
77
+ ],
78
+ invocations: [
79
+ {
80
+ id: '@khorsheed/dsh-client-message-tools#messageTools/edit',
81
+ service: 'messageTools',
82
+ namespace: 'messageTools',
83
+ method: 'edit',
84
+ invocation: { kind: 'direct' },
85
+ parameters: [
86
+ {
87
+ name: 'request',
88
+ wire: 'request',
89
+ source: 'json',
90
+ codec: {
91
+ mode: 'strict',
92
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsEditRequest',
93
+ schema: _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema,
94
+ },
95
+ },
96
+ ],
97
+ result: {
98
+ mode: 'strict',
99
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsEditResult',
100
+ schema: _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema,
101
+ },
102
+ sourceLocation: {"file":"packages/message-tools/src/index.ts","line":133,"column":9},
103
+ },
104
+ {
105
+ id: '@khorsheed/dsh-client-message-tools#messageTools/restore',
106
+ service: 'messageTools',
107
+ namespace: 'messageTools',
108
+ method: 'restore',
109
+ invocation: { kind: 'direct' },
110
+ parameters: [
111
+ {
112
+ name: 'request',
113
+ wire: 'request',
114
+ source: 'json',
115
+ codec: {
116
+ mode: 'strict',
117
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsRestoreRequest',
118
+ schema: _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema,
119
+ },
120
+ },
121
+ ],
122
+ result: {
123
+ mode: 'strict',
124
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsRestoreResult',
125
+ schema: _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema,
126
+ },
127
+ sourceLocation: {"file":"packages/message-tools/src/index.ts","line":95,"column":9},
128
+ },
129
+ {
130
+ id: '@khorsheed/dsh-client-message-tools#messageTools/withdraw',
131
+ service: 'messageTools',
132
+ namespace: 'messageTools',
133
+ method: 'withdraw',
134
+ invocation: { kind: 'direct' },
135
+ parameters: [
136
+ {
137
+ name: 'request',
138
+ wire: 'request',
139
+ source: 'json',
140
+ codec: {
141
+ mode: 'strict',
142
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsWithdrawRequest',
143
+ schema: _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema,
144
+ },
145
+ },
146
+ ],
147
+ result: {
148
+ mode: 'strict',
149
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsWithdrawResult',
150
+ schema: _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema,
151
+ },
152
+ sourceLocation: {"file":"packages/message-tools/src/index.ts","line":61,"column":9},
153
+ },
154
+ ],
155
+ model: {
156
+ "services": [
157
+ {
158
+ "description": "messageTools Remote service: appends the withdrawal replacement to the owning Session and flushes it durable. The replacement event's plugin-tagged source is the audit trail; no new session event type is introduced, so session reload stays safe for harnesses without this plugin.",
159
+ "summary": "messageTools Remote service: appends the withdrawal replacement to the owning Session and flushes it durable.",
160
+ "tags": [],
161
+ "jsDoc": "/**\n * messageTools Remote service: appends the withdrawal replacement to the\n * owning Session and flushes it durable. The replacement event's\n * plugin-tagged source is the audit trail; no new session event type is\n * introduced, so session reload stays safe for harnesses without this plugin.\n */",
162
+ "key": "messageTools",
163
+ "exportName": "MessageToolsService",
164
+ "members": [
165
+ {
166
+ "kind": "method",
167
+ "name": "withdraw",
168
+ "signature": "@Remote('withdraw') async withdraw(request: MessageToolsWithdrawRequest): Promise<MessageToolsWithdrawResult>",
169
+ "summary": "Withdraw a user message: replace it and every surface node after it with a minimal plugin-sourced placeholder, hiding the span from the model.",
170
+ "jsDoc": "/**\n * Withdraw a user message: replace it and every surface node after it with\n * a minimal plugin-sourced placeholder, hiding the span from the model.\n * @param request - session identity and target message seq.\n * @returns the replacement receipt, or a rejection from the closed failure union.\n */"
171
+ },
172
+ {
173
+ "kind": "method",
174
+ "name": "restore",
175
+ "signature": "@Remote('restore') async restore(request: MessageToolsRestoreRequest): Promise<MessageToolsRestoreResult>",
176
+ "summary": "Restore a withdrawn span: replay every replayable entry of it (user messages verbatim — including the last edit's new text — and framed assistant text; tool calls/results never replay) as fresh plugin-tagged `user/message` appends at the conversation tail, in original order, each citing its original event in `sourceEventSeqs`.",
177
+ "jsDoc": "/**\n * Restore a withdrawn span: replay every replayable entry of it (user\n * messages verbatim — including the last edit's new text — and framed\n * assistant text; tool calls/results never replay) as fresh plugin-tagged\n * `user/message` appends at the conversation tail, in original order, each\n * citing its original event in `sourceEventSeqs`. The surface replace model\n * is positional — a replaced span folds into one node — so the span cannot\n * be restored in place; the replayed entries are simply the newest messages\n * the model sees. Assistant text replays as framed user-role messages:\n * `assistant/message` cannot carry a plugin source and the turn/step trace\n * forbids assistant appends outside a step.\n * @param request - session identity and withdrawn message seq.\n * @returns the restore receipt, or a rejection from the closed failure union.\n */"
178
+ },
179
+ {
180
+ "kind": "method",
181
+ "name": "edit",
182
+ "signature": "@Remote('edit') async edit(request: MessageToolsEditRequest): Promise<MessageToolsEditResult>",
183
+ "summary": "Edit a user message in place: replace it and every surface node after it with the edited text itself (no placeholder, no tail duplicate — the edited text appears exactly once, in the replacement event), then start a regeneration turn.",
184
+ "jsDoc": "/**\n * Edit a user message in place: replace it and every surface node after it\n * with the edited text itself (no placeholder, no tail duplicate — the\n * edited text appears exactly once, in the replacement event), then start a\n * regeneration turn. The harness has no wake-without-append path, so the\n * turn is started by `agent.followup` carrying a minimal plugin-sourced\n * trigger message (the ankh-guard/schedule pattern); the trigger is not the\n * edited text and lands once, as itself.\n * @param request - session identity, target seq, edited text.\n * @returns the replacement receipt and whether the turn was triggered, or a rejection.\n */"
185
+ }
186
+ ],
187
+ "types": [
188
+ {
189
+ "name": "Branded",
190
+ "declaration": "export type Branded<B extends string> = string & { readonly [BRAND]: B; };"
191
+ },
192
+ {
193
+ "name": "MessageToolsEdit",
194
+ "declaration": "export interface MessageToolsEdit {\n readonly replacementSeq: number;\n readonly triggered: boolean;\n}"
195
+ },
196
+ {
197
+ "name": "MessageToolsEditFailure",
198
+ "declaration": "export type MessageToolsEditFailure = { readonly code: 'session-not-found'; } | { readonly code: 'target-not-found'; } | { readonly code: 'not-a-user-message'; } | { readonly code: 'already-withdrawn'; } | { readonly code: 'empty-text'; };"
199
+ },
200
+ {
201
+ "name": "MessageToolsEditRequest",
202
+ "declaration": "export interface MessageToolsEditRequest {\n readonly sessionId: SessionId;\n readonly targetSeq: number;\n readonly text: string;\n}"
203
+ },
204
+ {
205
+ "name": "MessageToolsEditResult",
206
+ "declaration": "export type MessageToolsEditResult = { readonly ok: true; readonly value: MessageToolsEdit; } | { readonly ok: false; readonly error: MessageToolsEditFailure; };"
207
+ },
208
+ {
209
+ "name": "MessageToolsRestoration",
210
+ "declaration": "export interface MessageToolsRestoration {\n readonly restoredSeq: number;\n}"
211
+ },
212
+ {
213
+ "name": "MessageToolsRestoreFailure",
214
+ "declaration": "export type MessageToolsRestoreFailure = { readonly code: 'session-not-found'; } | { readonly code: 'target-not-found'; } | { readonly code: 'not-a-user-message'; } | { readonly code: 'not-withdrawn'; };"
215
+ },
216
+ {
217
+ "name": "MessageToolsRestoreRequest",
218
+ "declaration": "export interface MessageToolsRestoreRequest {\n readonly sessionId: SessionId;\n readonly targetSeq: number;\n}"
219
+ },
220
+ {
221
+ "name": "MessageToolsRestoreResult",
222
+ "declaration": "export type MessageToolsRestoreResult = { readonly ok: true; readonly value: MessageToolsRestoration; } | { readonly ok: false; readonly error: MessageToolsRestoreFailure; };"
223
+ },
224
+ {
225
+ "name": "MessageToolsWithdrawal",
226
+ "declaration": "export interface MessageToolsWithdrawal {\n readonly replacementSeq: number;\n readonly shadowedCount: number;\n}"
227
+ },
228
+ {
229
+ "name": "MessageToolsWithdrawFailure",
230
+ "declaration": "export type MessageToolsWithdrawFailure = { readonly code: 'session-not-found'; } | { readonly code: 'target-not-found'; } | { readonly code: 'not-a-user-message'; } | { readonly code: 'already-withdrawn'; };"
231
+ },
232
+ {
233
+ "name": "MessageToolsWithdrawRequest",
234
+ "declaration": "export interface MessageToolsWithdrawRequest {\n readonly sessionId: SessionId;\n readonly targetSeq: number;\n}"
235
+ },
236
+ {
237
+ "name": "MessageToolsWithdrawResult",
238
+ "declaration": "export type MessageToolsWithdrawResult = { readonly ok: true; readonly value: MessageToolsWithdrawal; } | { readonly ok: false; readonly error: MessageToolsWithdrawFailure; };"
239
+ },
240
+ {
241
+ "name": "SessionId",
242
+ "declaration": "export type SessionId = Branded<'SessionId'>;"
243
+ }
244
+ ]
245
+ }
246
+ ],
247
+ "events": [],
248
+ "objects": []
249
+ },
250
+ }
@@ -0,0 +1,26 @@
1
+ /* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
2
+ import type {
3
+ RemoteResult,
4
+ TypertRemoteContribution,
5
+ } from '@deepseek-ai/dsh-typert-protocol'
6
+ import type { MessageToolsEditRequest, MessageToolsEditResult, MessageToolsRestoreRequest, MessageToolsRestoreResult, MessageToolsWithdrawRequest, MessageToolsWithdrawResult } from '@khorsheed/dsh-client-message-tools/types'
7
+
8
+ declare module '@deepseek-ai/dsh-typert-protocol' {
9
+ interface TypertRemoteNamespace$6d657373616765546f6f6c73 {
10
+ edit: (request: MessageToolsEditRequest) => Promise<RemoteResult<MessageToolsEditResult>>
11
+ restore: (request: MessageToolsRestoreRequest) => Promise<RemoteResult<MessageToolsRestoreResult>>
12
+ withdraw: (request: MessageToolsWithdrawRequest) => Promise<RemoteResult<MessageToolsWithdrawResult>>
13
+ }
14
+ interface TypertRemoteMap {
15
+ 'messageTools/edit': (request: MessageToolsEditRequest) => Promise<RemoteResult<MessageToolsEditResult>>
16
+ 'messageTools/restore': (request: MessageToolsRestoreRequest) => Promise<RemoteResult<MessageToolsRestoreResult>>
17
+ 'messageTools/withdraw': (request: MessageToolsWithdrawRequest) => Promise<RemoteResult<MessageToolsWithdrawResult>>
18
+ }
19
+ interface TypertRemoteNamespaceMap {
20
+ 'messageTools': TypertRemoteNamespace$6d657373616765546f6f6c73
21
+ }
22
+ }
23
+
24
+ export declare const TYPERT_REMOTE: TypertRemoteContribution
25
+ export default TYPERT_REMOTE
26
+ //# sourceMappingURL=typert.remote-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typert.remote-client.d.ts","names":["edit","restore","withdraw"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;IAoIQA,I;IAtCAC,O;IAlCAC,Q;;;IAwEAF,mB;IAtCAC,sB;IAlCAC,uB","ignoreList":[]}
@@ -0,0 +1,154 @@
1
+ /* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
2
+ import { z } from 'zod'
3
+
4
+ const _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema = z.object({
5
+ 'sessionId': z.intersection(z.string(), z.unknown()).readonly(),
6
+ 'targetSeq': z.number().readonly(),
7
+ 'text': z.string().readonly(),
8
+ })
9
+ const _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema = z.union([z.object({
10
+ 'ok': z.literal(true).readonly(),
11
+ 'value': z.object({
12
+ 'replacementSeq': z.number().readonly(),
13
+ 'triggered': z.boolean().readonly(),
14
+ }).readonly(),
15
+ }), z.object({
16
+ 'ok': z.literal(false).readonly(),
17
+ 'error': z.union([z.object({
18
+ 'code': z.literal("session-not-found").readonly(),
19
+ }), z.object({
20
+ 'code': z.literal("target-not-found").readonly(),
21
+ }), z.object({
22
+ 'code': z.literal("not-a-user-message").readonly(),
23
+ }), z.object({
24
+ 'code': z.literal("already-withdrawn").readonly(),
25
+ }), z.object({
26
+ 'code': z.literal("empty-text").readonly(),
27
+ })]).readonly(),
28
+ })])
29
+ const _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema = z.object({
30
+ 'sessionId': z.intersection(z.string(), z.unknown()).readonly(),
31
+ 'targetSeq': z.number().readonly(),
32
+ })
33
+ const _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema = z.union([z.object({
34
+ 'ok': z.literal(true).readonly(),
35
+ 'value': z.object({
36
+ 'restoredSeq': z.number().readonly(),
37
+ }).readonly(),
38
+ }), z.object({
39
+ 'ok': z.literal(false).readonly(),
40
+ 'error': z.union([z.object({
41
+ 'code': z.literal("session-not-found").readonly(),
42
+ }), z.object({
43
+ 'code': z.literal("target-not-found").readonly(),
44
+ }), z.object({
45
+ 'code': z.literal("not-a-user-message").readonly(),
46
+ }), z.object({
47
+ 'code': z.literal("not-withdrawn").readonly(),
48
+ })]).readonly(),
49
+ })])
50
+ const _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema = z.object({
51
+ 'sessionId': z.intersection(z.string(), z.unknown()).readonly(),
52
+ 'targetSeq': z.number().readonly(),
53
+ })
54
+ const _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema = z.union([z.object({
55
+ 'ok': z.literal(true).readonly(),
56
+ 'value': z.object({
57
+ 'replacementSeq': z.number().readonly(),
58
+ 'shadowedCount': z.number().readonly(),
59
+ }).readonly(),
60
+ }), z.object({
61
+ 'ok': z.literal(false).readonly(),
62
+ 'error': z.union([z.object({
63
+ 'code': z.literal("session-not-found").readonly(),
64
+ }), z.object({
65
+ 'code': z.literal("target-not-found").readonly(),
66
+ }), z.object({
67
+ 'code': z.literal("not-a-user-message").readonly(),
68
+ }), z.object({
69
+ 'code': z.literal("already-withdrawn").readonly(),
70
+ })]).readonly(),
71
+ })])
72
+
73
+ export const TYPERT_REMOTE = {
74
+ package: '@khorsheed/dsh-client-message-tools',
75
+ descriptors: [
76
+ {
77
+ id: '@khorsheed/dsh-client-message-tools#messageTools/edit',
78
+ service: 'messageTools',
79
+ namespace: 'messageTools',
80
+ method: 'edit',
81
+ invocation: { kind: 'direct' },
82
+ parameters: [
83
+ {
84
+ name: 'request',
85
+ wire: 'request',
86
+ source: 'json',
87
+ codec: {
88
+ mode: 'strict',
89
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsEditRequest',
90
+ schema: _khorsheed_dsh_client_message_tools_messageTools_edit_parameter_0$schema,
91
+ },
92
+ },
93
+ ],
94
+ result: {
95
+ mode: 'strict',
96
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsEditResult',
97
+ schema: _khorsheed_dsh_client_message_tools_messageTools_edit_result$schema,
98
+ },
99
+ sourceLocation: {"file":"packages/message-tools/src/index.ts","line":133,"column":9},
100
+ },
101
+ {
102
+ id: '@khorsheed/dsh-client-message-tools#messageTools/restore',
103
+ service: 'messageTools',
104
+ namespace: 'messageTools',
105
+ method: 'restore',
106
+ invocation: { kind: 'direct' },
107
+ parameters: [
108
+ {
109
+ name: 'request',
110
+ wire: 'request',
111
+ source: 'json',
112
+ codec: {
113
+ mode: 'strict',
114
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsRestoreRequest',
115
+ schema: _khorsheed_dsh_client_message_tools_messageTools_restore_parameter_0$schema,
116
+ },
117
+ },
118
+ ],
119
+ result: {
120
+ mode: 'strict',
121
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsRestoreResult',
122
+ schema: _khorsheed_dsh_client_message_tools_messageTools_restore_result$schema,
123
+ },
124
+ sourceLocation: {"file":"packages/message-tools/src/index.ts","line":95,"column":9},
125
+ },
126
+ {
127
+ id: '@khorsheed/dsh-client-message-tools#messageTools/withdraw',
128
+ service: 'messageTools',
129
+ namespace: 'messageTools',
130
+ method: 'withdraw',
131
+ invocation: { kind: 'direct' },
132
+ parameters: [
133
+ {
134
+ name: 'request',
135
+ wire: 'request',
136
+ source: 'json',
137
+ codec: {
138
+ mode: 'strict',
139
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsWithdrawRequest',
140
+ schema: _khorsheed_dsh_client_message_tools_messageTools_withdraw_parameter_0$schema,
141
+ },
142
+ },
143
+ ],
144
+ result: {
145
+ mode: 'strict',
146
+ typeSymbol: '@khorsheed/dsh-client-message-tools/types#MessageToolsWithdrawResult',
147
+ schema: _khorsheed_dsh_client_message_tools_messageTools_withdraw_result$schema,
148
+ },
149
+ sourceLocation: {"file":"packages/message-tools/src/index.ts","line":61,"column":9},
150
+ },
151
+ ],
152
+ }
153
+
154
+ export default TYPERT_REMOTE
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Model chip for the inline editor's trailing seat: shows the session's
3
+ * current provider/model/effort and switches it through the SAME per-session
4
+ * ModelDirectory the composer seat and the /model popup share, so a switch
5
+ * made here is what every surface echoes next — and it is the host-validated
6
+ * selection the resent edit lands on. Visual structure clones the composer
7
+ * seat (ModelSelect), simplified to one scrollable menu.
8
+ */
9
+ import { type ReactNode } from 'react';
10
+ import type { ModelSelection } from '@deepseek-ai/dsh-api-remotes/client';
11
+ import type { ModelDirectoryState } from '@deepseek-ai/dsh-client-ui-model-selection/client';
12
+ import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
13
+ import type { UserMessageViewProps } from './slots.ts';
14
+ type Translate = UserMessageViewProps['t'];
15
+ /** Props of the editor model chip: the bound directory hook plus verbs. */
16
+ export interface ModelChipProps {
17
+ /** Selector hook over the session's shared model directory snapshot. */
18
+ useModelDirectory: SnapshotSelectorHook<ModelDirectoryState>;
19
+ /** Refresh the advisory directory (fire-and-forget; errors land on the store). */
20
+ loadModels: () => void;
21
+ /** Submit a complete provider/model/effort selection; resolves to host acceptance. */
22
+ selectModel: (selection: ModelSelection) => Promise<boolean>;
23
+ /** The message-tools locale seat. */
24
+ t: Translate;
25
+ }
26
+ /** The editor's model chip: trigger with current model/effort plus the switch menu. */
27
+ export declare function ModelChip({ useModelDirectory, loadModels, selectModel, t }: ModelChipProps): ReactNode;
28
+ export {};
29
+ //# sourceMappingURL=ModelChip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelChip.d.ts","sourceRoot":"","sources":["../../../src/client/ModelChip.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAA;AAE5F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAGtD,KAAK,SAAS,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAA;AAE1C,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,iBAAiB,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,CAAA;IAC5D,kFAAkF;IAClF,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,sFAAsF;IACtF,WAAW,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5D,qCAAqC;IACrC,CAAC,EAAE,SAAS,CAAA;CACb;AAED,uFAAuF;AACvF,wBAAgB,SAAS,CAAC,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,cAAc,GAAG,SAAS,CAoItG"}
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Model chip for the inline editor's trailing seat: shows the session's
4
+ * current provider/model/effort and switches it through the SAME per-session
5
+ * ModelDirectory the composer seat and the /model popup share, so a switch
6
+ * made here is what every surface echoes next — and it is the host-validated
7
+ * selection the resent edit lands on. Visual structure clones the composer
8
+ * seat (ModelSelect), simplified to one scrollable menu.
9
+ */
10
+ import { useEffect, useRef, useState } from 'react';
11
+ import { IconCheckOutline16, IconChevronDownOutline14 } from '@deepseek-ai/dsh-client-ui-primitives';
12
+ import css from './ModelChip.module.css';
13
+ /** The editor's model chip: trigger with current model/effort plus the switch menu. */
14
+ export function ModelChip({ useModelDirectory, loadModels, selectModel, t }) {
15
+ const state = useModelDirectory(snapshot => snapshot);
16
+ const [open, setOpen] = useState(false);
17
+ const [failed, setFailed] = useState(false);
18
+ const rootRef = useRef(null);
19
+ // The composer seat loads on session mount; the editor may open first, so
20
+ // load here too (the directory dedupes in-flight generations).
21
+ useEffect(() => { loadModels(); }, [loadModels]);
22
+ useEffect(() => {
23
+ if (!open)
24
+ return;
25
+ const onPointer = (event) => {
26
+ if (!rootRef.current?.contains(event.target))
27
+ setOpen(false);
28
+ };
29
+ const onKey = (event) => {
30
+ if (event.key === 'Escape')
31
+ setOpen(false);
32
+ };
33
+ document.addEventListener('mousedown', onPointer);
34
+ document.addEventListener('keydown', onKey);
35
+ return () => {
36
+ document.removeEventListener('mousedown', onPointer);
37
+ document.removeEventListener('keydown', onKey);
38
+ };
39
+ }, [open]);
40
+ const current = state.current;
41
+ const currentGroup = state.groups.find(group => group.id === current?.provider);
42
+ const currentModel = currentGroup?.models.find(model => model.id === current?.model);
43
+ const reasoning = currentModel?.reasoning;
44
+ const effectiveEffort = current?.reasoningEffort ?? reasoning?.defaultEffort;
45
+ const effortLabel = reasoning === undefined
46
+ ? undefined
47
+ : effectiveEffort === undefined
48
+ ? t('model.providerDefault')
49
+ : reasoning.efforts.find(level => level.id === effectiveEffort)?.name ?? effectiveEffort;
50
+ const modelLabel = currentModel?.name ?? current?.model ?? t('loading');
51
+ const busy = state.status === 'selecting';
52
+ const submit = (selection) => {
53
+ setFailed(false);
54
+ setOpen(false);
55
+ void selectModel(selection).then((ok) => { if (!ok)
56
+ setFailed(true); });
57
+ };
58
+ const chooseModel = (provider, modelId, defaultEffort) => {
59
+ if (busy || (current?.provider === provider && current.model === modelId))
60
+ return;
61
+ submit({
62
+ provider,
63
+ model: modelId,
64
+ ...defaultEffort === undefined ? {} : { reasoningEffort: defaultEffort },
65
+ });
66
+ };
67
+ const chooseEffort = (effort) => {
68
+ if (busy || current === null || effectiveEffort === effort)
69
+ return;
70
+ submit({
71
+ provider: current.provider,
72
+ model: current.model,
73
+ ...effort === undefined ? {} : { reasoningEffort: effort },
74
+ });
75
+ };
76
+ return (_jsxs("div", { ref: rootRef, className: css.chip, children: [_jsxs("button", { type: "button", className: css.trigger, "aria-label": t('model.aria', { model: modelLabel }), "aria-haspopup": "menu", "aria-expanded": open, title: effortLabel === undefined ? modelLabel : `${modelLabel} · ${effortLabel}`, disabled: busy, onClick: () => { setOpen(!open); if (!open)
77
+ loadModels(); }, children: [_jsx("span", { className: css.triggerLabel, children: modelLabel }), effortLabel !== undefined && _jsx("span", { className: css.triggerEffort, children: effortLabel }), _jsx(IconChevronDownOutline14, {})] }), open && (_jsxs("div", { className: css.menu, role: "menu", "aria-label": t('model.menuAria'), "aria-busy": state.status === 'loading', children: [reasoning !== undefined && current !== null && (_jsxs("section", { className: css.group, children: [_jsx("div", { className: css.groupTitle, children: t('model.effort') }), [
78
+ ...reasoning.defaultEffort === undefined
79
+ ? [{ key: 'provider-default', effort: undefined, label: t('model.providerDefault') }]
80
+ : [],
81
+ ...reasoning.efforts.map(level => ({ key: level.id, effort: level.id, label: level.name })),
82
+ ].map(level => (_jsxs("button", { type: "button", role: "menuitemradio", "aria-checked": effectiveEffort === level.effort, className: css.option, disabled: busy, onClick: () => { chooseEffort(level.effort); }, children: [_jsx("span", { className: css.optionLabel, children: level.label }), _jsx("span", { className: css.check, children: effectiveEffort === level.effort ? _jsx(IconCheckOutline16, {}) : null })] }, level.key)))] })), state.groups.map(group => (_jsxs("section", { className: css.group, children: [_jsx("div", { className: css.groupTitle, children: group.name }), group.models.map((model) => {
83
+ const selected = current?.provider === group.id && current.model === model.id;
84
+ return (_jsxs("button", { type: "button", role: "menuitemradio", "aria-checked": selected, className: css.option, disabled: busy, onClick: () => { chooseModel(group.id, model.id, model.reasoning?.defaultEffort); }, children: [_jsx("span", { className: css.optionLabel, children: model.name }), _jsx("span", { className: css.check, children: selected ? _jsx(IconCheckOutline16, {}) : null })] }, model.id));
85
+ })] }, group.id))), state.status === 'ready' && state.groups.length === 0 && (_jsx("div", { className: css.empty, children: t('model.empty') }))] })), failed && _jsx("span", { className: css.selectFailed, role: "status", children: t('model.selectFailed') })] }));
86
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Restored-assistant line ('message-tools-restored-assistant' keyed
3
+ * renderer): one withdrawn assistant reply's text replayed at the
4
+ * conversation tail by a restore. The body renders through the official
5
+ * `MarkdownText` (the same public renderer behind ui-conversation's
6
+ * AssistantMarkdown), so typography, code blocks, and lists match a native
7
+ * assistant reply; the「已恢复 · 助手回复」caption stays as a small tertiary
8
+ * marker. The model-facing frame text is not displayed (stripped in the
9
+ * Definition). No action row: the group's user bubbles already carry copy.
10
+ */
11
+ import type { ReactNode } from 'react';
12
+ import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
13
+ /** Full props of the restored-assistant renderer. */
14
+ export type RestoredMessageViewProps = PropsRuntime<'conversation.chat.node', 'message-tools-restored-assistant'> & PropsLocale<'message-tools'>;
15
+ /** The restored assistant line: caption plus the reply body in official markdown chrome. */
16
+ export declare function RestoredMessageView({ node, t }: RestoredMessageViewProps): ReactNode;
17
+ //# sourceMappingURL=RestoredMessageView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RestoredMessageView.d.ts","sourceRoot":"","sources":["../../../src/client/RestoredMessageView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAKjF,qDAAqD;AACrD,MAAM,MAAM,wBAAwB,GAClC,YAAY,CAAC,wBAAwB,EAAE,kCAAkC,CAAC,GACxE,WAAW,CAAC,eAAe,CAAC,CAAA;AAEhC,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,wBAAwB,GAAG,SAAS,CAWpF"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives';
3
+ import { IconUndoOutline16 } from './icons.js';
4
+ import css from './RestoredMessageView.module.css';
5
+ /** The restored assistant line: caption plus the reply body in official markdown chrome. */
6
+ export function RestoredMessageView({ node, t }) {
7
+ const data = node.data;
8
+ return (_jsxs("div", { className: css.restoredAssistantRow, children: [_jsxs("div", { className: css.restoredLabel, children: [_jsx(IconUndoOutline16, {}), _jsx("span", { children: t('restored.assistant') })] }), _jsx(MarkdownText, { text: data.text })] }));
9
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shadow user-message renderer (keys 'user' and 'steering', priority -1; also
3
+ * the plugin's own 'message-tools-edited' and 'message-tools-restored' rows):
4
+ * a visual clone of the official bubble chrome — ui-conversation ships no
5
+ * public components, so the structure is replicated against ui-primitives
6
+ * platform modules, with historical images rendered through the owner-prop
7
+ * `renderMessageImages` attachment slot (rc8 contract) — plus the
8
+ * copy/edit/withdraw action row and the「已编辑」/「已恢复」labels. User
9
+ * messages inside a withdrawn span render nothing; the withdrawal divider
10
+ * marks the spot.
11
+ */
12
+ import { type ReactNode } from 'react';
13
+ import type { UserMessageViewProps } from './slots.ts';
14
+ /** The shadowed user-message view: bubble plus copy/edit/withdraw actions. */
15
+ export declare const UserMessageView: import("react").MemoExoticComponent<({ node, renderMessageImages, t, useSession, editMessage, withdrawMessage, backfillDraft, useModelDirectory, modelsAvailable, loadModels, selectModel, }: UserMessageViewProps) => ReactNode>;
16
+ //# sourceMappingURL=UserMessageView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserMessageView.d.ts","sourceRoot":"","sources":["../../../src/client/UserMessageView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAUzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAwJtD,8EAA8E;AAC9E,eAAO,MAAM,eAAe,gMAGzB,oBAAoB,KAAG,SAAS,CAoHjC,CAAA"}