@lukstei/dsh-client-review-git 0.0.0-stage → 0.2.2-rc.5.10

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/dist/client.js ADDED
@@ -0,0 +1,3378 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@lukstei/dsh-client-review-git",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
8
+ let zod = require("zod");
9
+ let react = require("react");
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ // ../util-review-ui/src/review.ts
12
+ const commit = zod.z.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/);
13
+ const commitRecord = zod.z.object({
14
+ sha: commit,
15
+ subject: zod.z.string(),
16
+ author: zod.z.string(),
17
+ date: zod.z.string()
18
+ });
19
+ const reviewTargetSchema = zod.z.object({
20
+ repository: zod.z.string().default(""),
21
+ branch: zod.z.string().min(1),
22
+ commit: zod.z.string().min(1).optional()
23
+ });
24
+ /** Wire name of the presentation tool whose calls publish a review card. */
25
+ const GIT_REVIEW_TOOL = "git_review_present";
26
+ /** Durable shape the presentation tool publishes on its successful result. */
27
+ const branchReviewScopeSchema = zod.z.object({
28
+ kind: zod.z.literal("branch"),
29
+ repository: zod.z.string().min(1),
30
+ ref: zod.z.string().min(1),
31
+ base: zod.z.discriminatedUnion("kind", [zod.z.object({ kind: zod.z.literal("automatic") }), zod.z.object({
32
+ kind: zod.z.literal("manual"),
33
+ ref: zod.z.string().min(1)
34
+ })]),
35
+ revision: zod.z.discriminatedUnion("kind", [zod.z.object({ kind: zod.z.literal("all-commits") }), zod.z.object({
36
+ kind: zod.z.literal("commit"),
37
+ commit: commitRecord
38
+ })])
39
+ });
40
+ function branchLabel(ref) {
41
+ return ref.startsWith("refs/heads/") ? ref.slice(11) : ref;
42
+ }
43
+ function shortSha(sha) {
44
+ return sha.slice(0, 7);
45
+ }
46
+ zod.z.object({
47
+ kind: zod.z.enum([
48
+ "revision",
49
+ "staged",
50
+ "unstaged"
51
+ ]),
52
+ repository: zod.z.string().min(1),
53
+ before: commit.nullable(),
54
+ after: commit
55
+ });
56
+ // ../../node_modules/.pnpm/@deepseek-ai+dsh-typert-protocol@0.2.2-rc.5_@deepseek-ai+cordis@4.1.0/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/remote-info.js
57
+ /** Lazy assembly of generated Remote definitions using caller-supplied Zod; no runtime imports. */
58
+ /**
59
+ * Retain one generated definition per endpoint without constructing parsers or projections.
60
+ * The class instance builds its shared descriptor/method index on first access;
61
+ * input schemas and JSON Schema projections are cached only when requested.
62
+ * @param spec - compiler-produced method facts and Zod factories.
63
+ * @param zod - the generated artifact's Zod runtime for named-input parsers.
64
+ * @returns a lazy, mountable info instance with no registration or transport effects.
65
+ */
66
+ function createTypertRemoteInfo(spec, zod) {
67
+ return new RemoteInfo(spec, zod);
68
+ }
69
+ var RemoteInfo = class {
70
+ spec;
71
+ zod;
72
+ index;
73
+ constructor(spec, zod) {
74
+ this.spec = spec;
75
+ this.zod = zod;
76
+ }
77
+ get package() {
78
+ return this.spec.package;
79
+ }
80
+ get descriptors() {
81
+ return this.resolve().descriptors;
82
+ }
83
+ get methods() {
84
+ return this.resolve().methods;
85
+ }
86
+ resolve() {
87
+ if (this.index !== void 0) return this.index;
88
+ const zod = this.zod;
89
+ const descriptors = [];
90
+ const methods = Object.create(null);
91
+ for (const [endpoint, definition] of Object.entries(this.spec.methods)) {
92
+ const separator = endpoint.indexOf("/");
93
+ const namespace = endpoint.slice(0, separator);
94
+ const method = endpoint.slice(separator + 1);
95
+ const parameters = definition.parameters.map((parameter) => ({
96
+ ...parameter,
97
+ wire: parameter.wire ?? parameter.name
98
+ }));
99
+ const descriptor = {
100
+ ...definition,
101
+ id: `${this.spec.package}#${endpoint}`,
102
+ namespace,
103
+ method,
104
+ parameters,
105
+ result: definition.result.description === void 0 ? definition.result : new ResultValue(definition.result)
106
+ };
107
+ if (definition.invocation.kind === "direct") {
108
+ const inputs = [];
109
+ methods[endpoint] = Object.assign(descriptor, {
110
+ input(options) {
111
+ const strict = options?.strict === true;
112
+ return inputs[strict ? 1 : 0] ??= new NamedInput(parameters, strict, zod);
113
+ },
114
+ invoke(remote, input, signal) {
115
+ const named = input;
116
+ const values = parameters.map((parameter) => named[parameter.wire]);
117
+ if (definition.cancellation !== void 0) values.push(signal);
118
+ const receiver = Reflect.get(remote, namespace);
119
+ return Reflect.get(receiver, method).apply(receiver, values);
120
+ }
121
+ });
122
+ }
123
+ descriptors.push(descriptor);
124
+ }
125
+ return this.index = {
126
+ descriptors,
127
+ methods
128
+ };
129
+ }
130
+ };
131
+ function optional(parameter) {
132
+ return parameter.source === "json" && parameter.acceptsUndefined === true;
133
+ }
134
+ var NamedInput = class {
135
+ parameters;
136
+ strict;
137
+ zod;
138
+ schema;
139
+ projection;
140
+ constructor(parameters, strict, zod) {
141
+ this.parameters = parameters;
142
+ this.strict = strict;
143
+ this.zod = zod;
144
+ }
145
+ codec(parameter) {
146
+ return this.strict ? parameter.strictCodec : parameter.codec;
147
+ }
148
+ create = () => this.schema ??= this.zod.strictObject(Object.fromEntries(this.parameters.map((parameter) => {
149
+ const value = this.codec(parameter).create();
150
+ return [parameter.wire, optional(parameter) ? value.optional() : value.nonoptional()];
151
+ })));
152
+ get jsonSchema() {
153
+ return this.project().jsonSchema;
154
+ }
155
+ get jsonSchemaError() {
156
+ return this.project().jsonSchemaError;
157
+ }
158
+ project() {
159
+ if (this.projection !== void 0) return this.projection;
160
+ const unavailable = this.parameters.find((parameter) => this.codec(parameter).jsonSchema === void 0);
161
+ if (unavailable !== void 0) return this.projection = { jsonSchemaError: this.codec(unavailable).jsonSchemaError ?? `No JSON Schema for parameter ${unavailable.wire}` };
162
+ return this.projection = { jsonSchema: {
163
+ type: "object",
164
+ properties: Object.fromEntries(this.parameters.map((parameter) => [parameter.wire, {
165
+ ...this.codec(parameter).jsonSchema,
166
+ ...parameter.description === void 0 ? {} : { description: parameter.description }
167
+ }])),
168
+ required: this.parameters.filter((parameter) => !optional(parameter)).map((parameter) => parameter.wire),
169
+ additionalProperties: false
170
+ } };
171
+ }
172
+ };
173
+ var ResultValue = class {
174
+ spec;
175
+ projection;
176
+ constructor(spec) {
177
+ this.spec = spec;
178
+ }
179
+ get mode() {
180
+ return this.spec.mode;
181
+ }
182
+ get typeSymbol() {
183
+ return this.spec.typeSymbol;
184
+ }
185
+ get create() {
186
+ return this.spec.create;
187
+ }
188
+ get decode() {
189
+ return this.spec.decode;
190
+ }
191
+ get encode() {
192
+ return this.spec.encode;
193
+ }
194
+ get description() {
195
+ return this.spec.description;
196
+ }
197
+ get jsonSchemaError() {
198
+ return this.spec.jsonSchemaError;
199
+ }
200
+ get jsonSchema() {
201
+ if (this.projection === void 0) {
202
+ const schema = this.spec.jsonSchema;
203
+ this.projection = { value: schema === void 0 ? void 0 : {
204
+ ...schema,
205
+ description: this.spec.description
206
+ } };
207
+ }
208
+ return this.projection.value;
209
+ }
210
+ };
211
+ // lib/typert.remote-client.js
212
+ let _lukstei_dsh_client_review_git_workspaceReview_catalog_parameter_0$schema$value;
213
+ const _lukstei_dsh_client_review_git_workspaceReview_catalog_parameter_0$schema = () => _lukstei_dsh_client_review_git_workspaceReview_catalog_parameter_0$schema$value ??= zod.z.string();
214
+ let _lukstei_dsh_client_review_git_workspaceReview_catalog_result$schema$value;
215
+ const _lukstei_dsh_client_review_git_workspaceReview_catalog_result$schema = () => _lukstei_dsh_client_review_git_workspaceReview_catalog_result$schema$value ??= zod.z.union([zod.z.object({
216
+ "kind": zod.z.literal("git"),
217
+ "repository": zod.z.object({
218
+ "cwd": zod.z.string(),
219
+ "target": zod.z.union([zod.z.literal(null), zod.z.string()]),
220
+ "baselines": zod.z.array(zod.z.object({
221
+ "ref": zod.z.string(),
222
+ "label": zod.z.string()
223
+ })),
224
+ "gitbutlerError": zod.z.union([zod.z.literal(null), zod.z.string()]),
225
+ "branches": zod.z.array(zod.z.object({
226
+ "ref": zod.z.string(),
227
+ "label": zod.z.string(),
228
+ "modifiedAt": zod.z.number().describe("Branch tip committer time, in milliseconds since the Unix epoch."),
229
+ "base": zod.z.union([zod.z.literal(null), zod.z.string()]),
230
+ "kind": zod.z.union([zod.z.literal("git"), zod.z.literal("gitbutler")])
231
+ }))
232
+ }),
233
+ "repositories": zod.z.array(zod.z.object({
234
+ "cwd": zod.z.string(),
235
+ "target": zod.z.union([zod.z.literal(null), zod.z.string()]),
236
+ "baselines": zod.z.array(zod.z.object({
237
+ "ref": zod.z.string(),
238
+ "label": zod.z.string()
239
+ })),
240
+ "gitbutlerError": zod.z.union([zod.z.literal(null), zod.z.string()]),
241
+ "branches": zod.z.array(zod.z.object({
242
+ "ref": zod.z.string(),
243
+ "label": zod.z.string(),
244
+ "modifiedAt": zod.z.number().describe("Branch tip committer time, in milliseconds since the Unix epoch."),
245
+ "base": zod.z.union([zod.z.literal(null), zod.z.string()]),
246
+ "kind": zod.z.union([zod.z.literal("git"), zod.z.literal("gitbutler")])
247
+ }))
248
+ }))
249
+ }), zod.z.object({
250
+ "kind": zod.z.literal("unavailable"),
251
+ "cwd": zod.z.string(),
252
+ "message": zod.z.string()
253
+ })]);
254
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_0$schema$value;
255
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_0$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_0$schema$value ??= zod.z.string();
256
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_1$schema$value;
257
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_1$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_1$schema$value ??= zod.z.string();
258
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_2$schema$value;
259
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_2$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_2$schema$value ??= zod.z.string();
260
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_3$schema$value;
261
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_3$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_3$schema$value ??= zod.z.string();
262
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_4$schema$value;
263
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_4$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_4$schema$value ??= zod.z.number();
264
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_result$schema$value;
265
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_result$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_result$schema$value ??= zod.z.object({
266
+ "commits": zod.z.array(zod.z.object({
267
+ "sha": zod.z.string(),
268
+ "subject": zod.z.string(),
269
+ "author": zod.z.string(),
270
+ "date": zod.z.string()
271
+ })),
272
+ "hasMore": zod.z.boolean()
273
+ });
274
+ let _lukstei_dsh_client_review_git_workspaceReview_file_parameter_0$schema$value;
275
+ const _lukstei_dsh_client_review_git_workspaceReview_file_parameter_0$schema = () => _lukstei_dsh_client_review_git_workspaceReview_file_parameter_0$schema$value ??= zod.z.string();
276
+ let _lukstei_dsh_client_review_git_workspaceReview_file_parameter_1$schema$value;
277
+ const _lukstei_dsh_client_review_git_workspaceReview_file_parameter_1$schema = () => _lukstei_dsh_client_review_git_workspaceReview_file_parameter_1$schema$value ??= zod.z.object({
278
+ "kind": zod.z.union([
279
+ zod.z.literal("revision"),
280
+ zod.z.literal("staged"),
281
+ zod.z.literal("unstaged")
282
+ ]),
283
+ "repository": zod.z.string(),
284
+ "before": zod.z.union([zod.z.literal(null), zod.z.string()]),
285
+ "after": zod.z.string()
286
+ });
287
+ let _lukstei_dsh_client_review_git_workspaceReview_file_parameter_2$schema$value;
288
+ const _lukstei_dsh_client_review_git_workspaceReview_file_parameter_2$schema = () => _lukstei_dsh_client_review_git_workspaceReview_file_parameter_2$schema$value ??= zod.z.string();
289
+ let _lukstei_dsh_client_review_git_workspaceReview_file_result$schema$value;
290
+ const _lukstei_dsh_client_review_git_workspaceReview_file_result$schema = () => _lukstei_dsh_client_review_git_workspaceReview_file_result$schema$value ??= zod.z.union([zod.z.object({
291
+ "kind": zod.z.literal("text"),
292
+ "before": zod.z.union([zod.z.literal(null), zod.z.string()]),
293
+ "after": zod.z.union([zod.z.literal(null), zod.z.string()])
294
+ }), zod.z.object({
295
+ "kind": zod.z.literal("unavailable"),
296
+ "message": zod.z.string()
297
+ })]);
298
+ let _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_0$schema$value;
299
+ const _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_0$schema = () => _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_0$schema$value ??= zod.z.string();
300
+ let _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_1$schema$value;
301
+ const _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_1$schema = () => _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_1$schema$value ??= zod.z.object({
302
+ "repository": zod.z.string(),
303
+ "branch": zod.z.string(),
304
+ "commit": zod.z.union([zod.z.undefined(), zod.z.string()]).optional()
305
+ });
306
+ let _lukstei_dsh_client_review_git_workspaceReview_resolve_result$schema$value;
307
+ const _lukstei_dsh_client_review_git_workspaceReview_resolve_result$schema = () => _lukstei_dsh_client_review_git_workspaceReview_resolve_result$schema$value ??= zod.z.object({
308
+ "kind": zod.z.literal("branch"),
309
+ "repository": zod.z.string(),
310
+ "ref": zod.z.string(),
311
+ "revision": zod.z.union([zod.z.object({ "kind": zod.z.literal("all-commits") }), zod.z.object({
312
+ "kind": zod.z.literal("commit"),
313
+ "commit": zod.z.object({
314
+ "sha": zod.z.string(),
315
+ "subject": zod.z.string(),
316
+ "author": zod.z.string(),
317
+ "date": zod.z.string()
318
+ })
319
+ })]),
320
+ "base": zod.z.object({
321
+ "kind": zod.z.literal("manual"),
322
+ "ref": zod.z.string()
323
+ })
324
+ });
325
+ let _lukstei_dsh_client_review_git_workspaceReview_view_parameter_0$schema$value;
326
+ const _lukstei_dsh_client_review_git_workspaceReview_view_parameter_0$schema = () => _lukstei_dsh_client_review_git_workspaceReview_view_parameter_0$schema$value ??= zod.z.string();
327
+ let _lukstei_dsh_client_review_git_workspaceReview_view_parameter_1$schema$value;
328
+ const _lukstei_dsh_client_review_git_workspaceReview_view_parameter_1$schema = () => _lukstei_dsh_client_review_git_workspaceReview_view_parameter_1$schema$value ??= zod.z.union([zod.z.object({
329
+ "kind": zod.z.literal("uncommitted"),
330
+ "repository": zod.z.string(),
331
+ "stage": zod.z.union([zod.z.literal("staged"), zod.z.literal("unstaged")])
332
+ }), zod.z.object({
333
+ "kind": zod.z.literal("branch"),
334
+ "repository": zod.z.string(),
335
+ "ref": zod.z.string(),
336
+ "revision": zod.z.union([zod.z.object({ "kind": zod.z.literal("all-commits") }), zod.z.object({
337
+ "kind": zod.z.literal("commit"),
338
+ "commit": zod.z.object({
339
+ "sha": zod.z.string(),
340
+ "subject": zod.z.string(),
341
+ "author": zod.z.string(),
342
+ "date": zod.z.string()
343
+ })
344
+ })]),
345
+ "base": zod.z.string()
346
+ })]);
347
+ let _lukstei_dsh_client_review_git_workspaceReview_view_result$schema$value;
348
+ const _lukstei_dsh_client_review_git_workspaceReview_view_result$schema = () => _lukstei_dsh_client_review_git_workspaceReview_view_result$schema$value ??= zod.z.object({
349
+ "kind": zod.z.literal("diff"),
350
+ "view": zod.z.object({
351
+ "target": zod.z.string(),
352
+ "snapshot": zod.z.object({
353
+ "kind": zod.z.union([
354
+ zod.z.literal("revision"),
355
+ zod.z.literal("staged"),
356
+ zod.z.literal("unstaged")
357
+ ]),
358
+ "repository": zod.z.string(),
359
+ "before": zod.z.union([zod.z.literal(null), zod.z.string()]),
360
+ "after": zod.z.string()
361
+ }),
362
+ "diffs": zod.z.array(zod.z.object({
363
+ "path": zod.z.string(),
364
+ "status": zod.z.union([
365
+ zod.z.literal("added"),
366
+ zod.z.literal("deleted"),
367
+ zod.z.literal("modified")
368
+ ]),
369
+ "addedLines": zod.z.number(),
370
+ "deletedLines": zod.z.number()
371
+ })),
372
+ "summary": zod.z.object({
373
+ "files": zod.z.number(),
374
+ "added": zod.z.number(),
375
+ "deleted": zod.z.number()
376
+ })
377
+ })
378
+ });
379
+ let _lukstei_dsh_client_review_git_workspaceReview_catalog_parameter_0_strict$schema$value;
380
+ const _lukstei_dsh_client_review_git_workspaceReview_catalog_parameter_0_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_catalog_parameter_0_strict$schema$value ??= zod.z.string();
381
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_0_strict$schema$value;
382
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_0_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_0_strict$schema$value ??= zod.z.string();
383
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_1_strict$schema$value;
384
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_1_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_1_strict$schema$value ??= zod.z.string();
385
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_2_strict$schema$value;
386
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_2_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_2_strict$schema$value ??= zod.z.string();
387
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_3_strict$schema$value;
388
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_3_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_3_strict$schema$value ??= zod.z.string();
389
+ let _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_4_strict$schema$value;
390
+ const _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_4_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_4_strict$schema$value ??= zod.z.number();
391
+ let _lukstei_dsh_client_review_git_workspaceReview_file_parameter_0_strict$schema$value;
392
+ const _lukstei_dsh_client_review_git_workspaceReview_file_parameter_0_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_file_parameter_0_strict$schema$value ??= zod.z.string();
393
+ let _lukstei_dsh_client_review_git_workspaceReview_file_parameter_1_strict$schema$value;
394
+ const _lukstei_dsh_client_review_git_workspaceReview_file_parameter_1_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_file_parameter_1_strict$schema$value ??= zod.z.strictObject({
395
+ "kind": zod.z.union([
396
+ zod.z.literal("revision"),
397
+ zod.z.literal("staged"),
398
+ zod.z.literal("unstaged")
399
+ ]),
400
+ "repository": zod.z.string(),
401
+ "before": zod.z.union([zod.z.literal(null), zod.z.string()]),
402
+ "after": zod.z.string()
403
+ });
404
+ let _lukstei_dsh_client_review_git_workspaceReview_file_parameter_2_strict$schema$value;
405
+ const _lukstei_dsh_client_review_git_workspaceReview_file_parameter_2_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_file_parameter_2_strict$schema$value ??= zod.z.string();
406
+ let _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_0_strict$schema$value;
407
+ const _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_0_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_0_strict$schema$value ??= zod.z.string();
408
+ let _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_1_strict$schema$value;
409
+ const _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_1_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_1_strict$schema$value ??= zod.z.strictObject({
410
+ "repository": zod.z.string(),
411
+ "branch": zod.z.string(),
412
+ "commit": zod.z.union([zod.z.undefined(), zod.z.string()]).optional()
413
+ });
414
+ let _lukstei_dsh_client_review_git_workspaceReview_view_parameter_0_strict$schema$value;
415
+ const _lukstei_dsh_client_review_git_workspaceReview_view_parameter_0_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_view_parameter_0_strict$schema$value ??= zod.z.string();
416
+ let _lukstei_dsh_client_review_git_workspaceReview_view_parameter_1_strict$schema$value;
417
+ const _lukstei_dsh_client_review_git_workspaceReview_view_parameter_1_strict$schema = () => _lukstei_dsh_client_review_git_workspaceReview_view_parameter_1_strict$schema$value ??= zod.z.union([zod.z.strictObject({
418
+ "kind": zod.z.literal("uncommitted"),
419
+ "repository": zod.z.string(),
420
+ "stage": zod.z.union([zod.z.literal("staged"), zod.z.literal("unstaged")])
421
+ }), zod.z.strictObject({
422
+ "kind": zod.z.literal("branch"),
423
+ "repository": zod.z.string(),
424
+ "ref": zod.z.string(),
425
+ "revision": zod.z.union([zod.z.strictObject({ "kind": zod.z.literal("all-commits") }), zod.z.strictObject({
426
+ "kind": zod.z.literal("commit"),
427
+ "commit": zod.z.strictObject({
428
+ "sha": zod.z.string(),
429
+ "subject": zod.z.string(),
430
+ "author": zod.z.string(),
431
+ "date": zod.z.string()
432
+ })
433
+ })]),
434
+ "base": zod.z.string()
435
+ })]);
436
+ const TYPERT_REMOTE = createTypertRemoteInfo({
437
+ package: "@lukstei/dsh-client-review-git",
438
+ methods: {
439
+ "workspaceReview/catalog": {
440
+ service: "workspaceReview",
441
+ invocation: { kind: "direct" },
442
+ parameters: [{
443
+ name: "sessionId",
444
+ source: "json",
445
+ codec: {
446
+ mode: "strict",
447
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/catalog:sessionId",
448
+ create: _lukstei_dsh_client_review_git_workspaceReview_catalog_parameter_0$schema,
449
+ jsonSchema: { "type": "string" }
450
+ },
451
+ strictCodec: {
452
+ mode: "strict",
453
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/catalog:sessionId",
454
+ create: _lukstei_dsh_client_review_git_workspaceReview_catalog_parameter_0_strict$schema,
455
+ jsonSchema: { "type": "string" }
456
+ }
457
+ }],
458
+ cancellation: { parameter: "signal" },
459
+ result: {
460
+ mode: "strict",
461
+ typeSymbol: "@lukstei/util-review-ui/types#ReviewCatalog",
462
+ create: _lukstei_dsh_client_review_git_workspaceReview_catalog_result$schema,
463
+ jsonSchema: { "oneOf": [{
464
+ "type": "object",
465
+ "properties": {
466
+ "kind": {
467
+ "type": "string",
468
+ "const": "git"
469
+ },
470
+ "repository": {
471
+ "type": "object",
472
+ "properties": {
473
+ "cwd": { "type": "string" },
474
+ "target": { "oneOf": [{
475
+ "type": "null",
476
+ "const": null
477
+ }, { "type": "string" }] },
478
+ "baselines": {
479
+ "type": "array",
480
+ "items": {
481
+ "type": "object",
482
+ "properties": {
483
+ "ref": { "type": "string" },
484
+ "label": { "type": "string" }
485
+ },
486
+ "required": ["ref", "label"],
487
+ "additionalProperties": true
488
+ }
489
+ },
490
+ "gitbutlerError": { "oneOf": [{
491
+ "type": "null",
492
+ "const": null
493
+ }, { "type": "string" }] },
494
+ "branches": {
495
+ "type": "array",
496
+ "items": {
497
+ "type": "object",
498
+ "properties": {
499
+ "ref": { "type": "string" },
500
+ "label": { "type": "string" },
501
+ "modifiedAt": {
502
+ "type": "number",
503
+ "description": "Branch tip committer time, in milliseconds since the Unix epoch."
504
+ },
505
+ "base": { "oneOf": [{
506
+ "type": "null",
507
+ "const": null
508
+ }, { "type": "string" }] },
509
+ "kind": {
510
+ "type": "string",
511
+ "enum": ["git", "gitbutler"]
512
+ }
513
+ },
514
+ "required": [
515
+ "ref",
516
+ "label",
517
+ "modifiedAt",
518
+ "base",
519
+ "kind"
520
+ ],
521
+ "additionalProperties": true
522
+ }
523
+ }
524
+ },
525
+ "required": [
526
+ "cwd",
527
+ "target",
528
+ "baselines",
529
+ "gitbutlerError",
530
+ "branches"
531
+ ],
532
+ "additionalProperties": true
533
+ },
534
+ "repositories": {
535
+ "type": "array",
536
+ "items": {
537
+ "type": "object",
538
+ "properties": {
539
+ "cwd": { "type": "string" },
540
+ "target": { "oneOf": [{
541
+ "type": "null",
542
+ "const": null
543
+ }, { "type": "string" }] },
544
+ "baselines": {
545
+ "type": "array",
546
+ "items": {
547
+ "type": "object",
548
+ "properties": {
549
+ "ref": { "type": "string" },
550
+ "label": { "type": "string" }
551
+ },
552
+ "required": ["ref", "label"],
553
+ "additionalProperties": true
554
+ }
555
+ },
556
+ "gitbutlerError": { "oneOf": [{
557
+ "type": "null",
558
+ "const": null
559
+ }, { "type": "string" }] },
560
+ "branches": {
561
+ "type": "array",
562
+ "items": {
563
+ "type": "object",
564
+ "properties": {
565
+ "ref": { "type": "string" },
566
+ "label": { "type": "string" },
567
+ "modifiedAt": {
568
+ "type": "number",
569
+ "description": "Branch tip committer time, in milliseconds since the Unix epoch."
570
+ },
571
+ "base": { "oneOf": [{
572
+ "type": "null",
573
+ "const": null
574
+ }, { "type": "string" }] },
575
+ "kind": {
576
+ "type": "string",
577
+ "enum": ["git", "gitbutler"]
578
+ }
579
+ },
580
+ "required": [
581
+ "ref",
582
+ "label",
583
+ "modifiedAt",
584
+ "base",
585
+ "kind"
586
+ ],
587
+ "additionalProperties": true
588
+ }
589
+ }
590
+ },
591
+ "required": [
592
+ "cwd",
593
+ "target",
594
+ "baselines",
595
+ "gitbutlerError",
596
+ "branches"
597
+ ],
598
+ "additionalProperties": true
599
+ }
600
+ }
601
+ },
602
+ "required": [
603
+ "kind",
604
+ "repository",
605
+ "repositories"
606
+ ],
607
+ "additionalProperties": true
608
+ }, {
609
+ "type": "object",
610
+ "properties": {
611
+ "kind": {
612
+ "type": "string",
613
+ "const": "unavailable"
614
+ },
615
+ "cwd": { "type": "string" },
616
+ "message": { "type": "string" }
617
+ },
618
+ "required": [
619
+ "kind",
620
+ "cwd",
621
+ "message"
622
+ ],
623
+ "additionalProperties": true
624
+ }] }
625
+ },
626
+ sourceLocation: {
627
+ "file": "packages/git-diff/src/workspace-review-service.ts",
628
+ "line": 277,
629
+ "column": 8
630
+ }
631
+ },
632
+ "workspaceReview/commits": {
633
+ service: "workspaceReview",
634
+ invocation: { kind: "direct" },
635
+ parameters: [
636
+ {
637
+ name: "sessionId",
638
+ source: "json",
639
+ codec: {
640
+ mode: "strict",
641
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:sessionId",
642
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_0$schema,
643
+ jsonSchema: { "type": "string" }
644
+ },
645
+ strictCodec: {
646
+ mode: "strict",
647
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:sessionId",
648
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_0_strict$schema,
649
+ jsonSchema: { "type": "string" }
650
+ }
651
+ },
652
+ {
653
+ name: "repository",
654
+ source: "json",
655
+ codec: {
656
+ mode: "strict",
657
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:repository",
658
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_1$schema,
659
+ jsonSchema: { "type": "string" }
660
+ },
661
+ strictCodec: {
662
+ mode: "strict",
663
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:repository",
664
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_1_strict$schema,
665
+ jsonSchema: { "type": "string" }
666
+ }
667
+ },
668
+ {
669
+ name: "branch",
670
+ source: "json",
671
+ codec: {
672
+ mode: "strict",
673
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:branch",
674
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_2$schema,
675
+ jsonSchema: { "type": "string" }
676
+ },
677
+ strictCodec: {
678
+ mode: "strict",
679
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:branch",
680
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_2_strict$schema,
681
+ jsonSchema: { "type": "string" }
682
+ }
683
+ },
684
+ {
685
+ name: "base",
686
+ source: "json",
687
+ codec: {
688
+ mode: "strict",
689
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:base",
690
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_3$schema,
691
+ jsonSchema: { "type": "string" }
692
+ },
693
+ strictCodec: {
694
+ mode: "strict",
695
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:base",
696
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_3_strict$schema,
697
+ jsonSchema: { "type": "string" }
698
+ }
699
+ },
700
+ {
701
+ name: "offset",
702
+ source: "json",
703
+ codec: {
704
+ mode: "strict",
705
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:offset",
706
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_4$schema,
707
+ jsonSchema: { "type": "number" }
708
+ },
709
+ strictCodec: {
710
+ mode: "strict",
711
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/commits:offset",
712
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_parameter_4_strict$schema,
713
+ jsonSchema: { "type": "number" }
714
+ }
715
+ }
716
+ ],
717
+ cancellation: { parameter: "signal" },
718
+ result: {
719
+ mode: "strict",
720
+ typeSymbol: "@lukstei/util-review-ui/types#GitCommitPage",
721
+ create: _lukstei_dsh_client_review_git_workspaceReview_commits_result$schema,
722
+ jsonSchema: {
723
+ "type": "object",
724
+ "properties": {
725
+ "commits": {
726
+ "type": "array",
727
+ "items": {
728
+ "type": "object",
729
+ "properties": {
730
+ "sha": { "type": "string" },
731
+ "subject": { "type": "string" },
732
+ "author": { "type": "string" },
733
+ "date": { "type": "string" }
734
+ },
735
+ "required": [
736
+ "sha",
737
+ "subject",
738
+ "author",
739
+ "date"
740
+ ],
741
+ "additionalProperties": true
742
+ }
743
+ },
744
+ "hasMore": { "type": "boolean" }
745
+ },
746
+ "required": ["commits", "hasMore"],
747
+ "additionalProperties": true
748
+ }
749
+ },
750
+ sourceLocation: {
751
+ "file": "packages/git-diff/src/workspace-review-service.ts",
752
+ "line": 335,
753
+ "column": 8
754
+ }
755
+ },
756
+ "workspaceReview/file": {
757
+ service: "workspaceReview",
758
+ invocation: { kind: "direct" },
759
+ parameters: [
760
+ {
761
+ name: "sessionId",
762
+ source: "json",
763
+ codec: {
764
+ mode: "strict",
765
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/file:sessionId",
766
+ create: _lukstei_dsh_client_review_git_workspaceReview_file_parameter_0$schema,
767
+ jsonSchema: { "type": "string" }
768
+ },
769
+ strictCodec: {
770
+ mode: "strict",
771
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/file:sessionId",
772
+ create: _lukstei_dsh_client_review_git_workspaceReview_file_parameter_0_strict$schema,
773
+ jsonSchema: { "type": "string" }
774
+ }
775
+ },
776
+ {
777
+ name: "snapshot",
778
+ source: "json",
779
+ codec: {
780
+ mode: "strict",
781
+ typeSymbol: "@lukstei/util-review-ui/types#GitSnapshot",
782
+ create: _lukstei_dsh_client_review_git_workspaceReview_file_parameter_1$schema,
783
+ jsonSchema: {
784
+ "type": "object",
785
+ "properties": {
786
+ "kind": {
787
+ "type": "string",
788
+ "enum": [
789
+ "revision",
790
+ "staged",
791
+ "unstaged"
792
+ ]
793
+ },
794
+ "repository": { "type": "string" },
795
+ "before": { "oneOf": [{
796
+ "type": "null",
797
+ "const": null
798
+ }, { "type": "string" }] },
799
+ "after": { "type": "string" }
800
+ },
801
+ "required": [
802
+ "kind",
803
+ "repository",
804
+ "before",
805
+ "after"
806
+ ],
807
+ "additionalProperties": true
808
+ }
809
+ },
810
+ strictCodec: {
811
+ mode: "strict",
812
+ typeSymbol: "@lukstei/util-review-ui/types#GitSnapshot",
813
+ create: _lukstei_dsh_client_review_git_workspaceReview_file_parameter_1_strict$schema,
814
+ jsonSchema: {
815
+ "type": "object",
816
+ "properties": {
817
+ "kind": {
818
+ "type": "string",
819
+ "enum": [
820
+ "revision",
821
+ "staged",
822
+ "unstaged"
823
+ ]
824
+ },
825
+ "repository": { "type": "string" },
826
+ "before": { "oneOf": [{
827
+ "type": "null",
828
+ "const": null
829
+ }, { "type": "string" }] },
830
+ "after": { "type": "string" }
831
+ },
832
+ "required": [
833
+ "kind",
834
+ "repository",
835
+ "before",
836
+ "after"
837
+ ],
838
+ "additionalProperties": false
839
+ }
840
+ }
841
+ },
842
+ {
843
+ name: "path",
844
+ source: "json",
845
+ codec: {
846
+ mode: "strict",
847
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/file:path",
848
+ create: _lukstei_dsh_client_review_git_workspaceReview_file_parameter_2$schema,
849
+ jsonSchema: { "type": "string" }
850
+ },
851
+ strictCodec: {
852
+ mode: "strict",
853
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/file:path",
854
+ create: _lukstei_dsh_client_review_git_workspaceReview_file_parameter_2_strict$schema,
855
+ jsonSchema: { "type": "string" }
856
+ }
857
+ }
858
+ ],
859
+ cancellation: { parameter: "signal" },
860
+ result: {
861
+ mode: "strict",
862
+ typeSymbol: "@lukstei/util-review-ui/types#GitFileContents",
863
+ create: _lukstei_dsh_client_review_git_workspaceReview_file_result$schema,
864
+ jsonSchema: { "oneOf": [{
865
+ "type": "object",
866
+ "properties": {
867
+ "kind": {
868
+ "type": "string",
869
+ "const": "text"
870
+ },
871
+ "before": { "oneOf": [{
872
+ "type": "null",
873
+ "const": null
874
+ }, { "type": "string" }] },
875
+ "after": { "oneOf": [{
876
+ "type": "null",
877
+ "const": null
878
+ }, { "type": "string" }] }
879
+ },
880
+ "required": [
881
+ "kind",
882
+ "before",
883
+ "after"
884
+ ],
885
+ "additionalProperties": true
886
+ }, {
887
+ "type": "object",
888
+ "properties": {
889
+ "kind": {
890
+ "type": "string",
891
+ "const": "unavailable"
892
+ },
893
+ "message": { "type": "string" }
894
+ },
895
+ "required": ["kind", "message"],
896
+ "additionalProperties": true
897
+ }] }
898
+ },
899
+ sourceLocation: {
900
+ "file": "packages/git-diff/src/workspace-review-service.ts",
901
+ "line": 385,
902
+ "column": 8
903
+ }
904
+ },
905
+ "workspaceReview/resolve": {
906
+ service: "workspaceReview",
907
+ invocation: { kind: "direct" },
908
+ parameters: [{
909
+ name: "sessionId",
910
+ source: "json",
911
+ codec: {
912
+ mode: "strict",
913
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/resolve:sessionId",
914
+ create: _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_0$schema,
915
+ jsonSchema: { "type": "string" }
916
+ },
917
+ strictCodec: {
918
+ mode: "strict",
919
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/resolve:sessionId",
920
+ create: _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_0_strict$schema,
921
+ jsonSchema: { "type": "string" }
922
+ }
923
+ }, {
924
+ name: "target",
925
+ source: "json",
926
+ codec: {
927
+ mode: "strict",
928
+ typeSymbol: "@lukstei/util-review-ui/types#ReviewTarget",
929
+ create: _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_1$schema,
930
+ jsonSchema: {
931
+ "type": "object",
932
+ "properties": {
933
+ "repository": { "type": "string" },
934
+ "branch": { "type": "string" },
935
+ "commit": { "type": "string" }
936
+ },
937
+ "required": ["repository", "branch"],
938
+ "additionalProperties": true
939
+ }
940
+ },
941
+ strictCodec: {
942
+ mode: "strict",
943
+ typeSymbol: "@lukstei/util-review-ui/types#ReviewTarget",
944
+ create: _lukstei_dsh_client_review_git_workspaceReview_resolve_parameter_1_strict$schema,
945
+ jsonSchema: {
946
+ "type": "object",
947
+ "properties": {
948
+ "repository": { "type": "string" },
949
+ "branch": { "type": "string" },
950
+ "commit": { "type": "string" }
951
+ },
952
+ "required": ["repository", "branch"],
953
+ "additionalProperties": false
954
+ }
955
+ }
956
+ }],
957
+ cancellation: { parameter: "signal" },
958
+ result: {
959
+ mode: "strict",
960
+ typeSymbol: "@lukstei/util-review-ui/types#ResolvedReviewScope",
961
+ create: _lukstei_dsh_client_review_git_workspaceReview_resolve_result$schema,
962
+ jsonSchema: {
963
+ "type": "object",
964
+ "properties": {
965
+ "kind": {
966
+ "type": "string",
967
+ "const": "branch"
968
+ },
969
+ "repository": { "type": "string" },
970
+ "ref": { "type": "string" },
971
+ "revision": { "oneOf": [{
972
+ "type": "object",
973
+ "properties": { "kind": {
974
+ "type": "string",
975
+ "const": "all-commits"
976
+ } },
977
+ "required": ["kind"],
978
+ "additionalProperties": true
979
+ }, {
980
+ "type": "object",
981
+ "properties": {
982
+ "kind": {
983
+ "type": "string",
984
+ "const": "commit"
985
+ },
986
+ "commit": {
987
+ "type": "object",
988
+ "properties": {
989
+ "sha": { "type": "string" },
990
+ "subject": { "type": "string" },
991
+ "author": { "type": "string" },
992
+ "date": { "type": "string" }
993
+ },
994
+ "required": [
995
+ "sha",
996
+ "subject",
997
+ "author",
998
+ "date"
999
+ ],
1000
+ "additionalProperties": true
1001
+ }
1002
+ },
1003
+ "required": ["kind", "commit"],
1004
+ "additionalProperties": true
1005
+ }] },
1006
+ "base": {
1007
+ "type": "object",
1008
+ "properties": {
1009
+ "kind": {
1010
+ "type": "string",
1011
+ "const": "manual"
1012
+ },
1013
+ "ref": { "type": "string" }
1014
+ },
1015
+ "required": ["kind", "ref"],
1016
+ "additionalProperties": true
1017
+ }
1018
+ },
1019
+ "required": [
1020
+ "kind",
1021
+ "repository",
1022
+ "ref",
1023
+ "revision",
1024
+ "base"
1025
+ ],
1026
+ "additionalProperties": true
1027
+ }
1028
+ },
1029
+ sourceLocation: {
1030
+ "file": "packages/git-diff/src/workspace-review-service.ts",
1031
+ "line": 322,
1032
+ "column": 8
1033
+ }
1034
+ },
1035
+ "workspaceReview/view": {
1036
+ service: "workspaceReview",
1037
+ invocation: { kind: "direct" },
1038
+ parameters: [{
1039
+ name: "sessionId",
1040
+ source: "json",
1041
+ codec: {
1042
+ mode: "strict",
1043
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/view:sessionId",
1044
+ create: _lukstei_dsh_client_review_git_workspaceReview_view_parameter_0$schema,
1045
+ jsonSchema: { "type": "string" }
1046
+ },
1047
+ strictCodec: {
1048
+ mode: "strict",
1049
+ typeSymbol: "@lukstei/dsh-client-review-git#workspaceReview/view:sessionId",
1050
+ create: _lukstei_dsh_client_review_git_workspaceReview_view_parameter_0_strict$schema,
1051
+ jsonSchema: { "type": "string" }
1052
+ }
1053
+ }, {
1054
+ name: "selection",
1055
+ source: "json",
1056
+ codec: {
1057
+ mode: "strict",
1058
+ typeSymbol: "@lukstei/util-review-ui/types#ReviewSelection",
1059
+ create: _lukstei_dsh_client_review_git_workspaceReview_view_parameter_1$schema,
1060
+ jsonSchema: { "oneOf": [{
1061
+ "type": "object",
1062
+ "properties": {
1063
+ "kind": {
1064
+ "type": "string",
1065
+ "const": "uncommitted"
1066
+ },
1067
+ "repository": { "type": "string" },
1068
+ "stage": {
1069
+ "type": "string",
1070
+ "enum": ["staged", "unstaged"]
1071
+ }
1072
+ },
1073
+ "required": [
1074
+ "kind",
1075
+ "repository",
1076
+ "stage"
1077
+ ],
1078
+ "additionalProperties": true
1079
+ }, {
1080
+ "type": "object",
1081
+ "properties": {
1082
+ "kind": {
1083
+ "type": "string",
1084
+ "const": "branch"
1085
+ },
1086
+ "repository": { "type": "string" },
1087
+ "ref": { "type": "string" },
1088
+ "revision": { "oneOf": [{
1089
+ "type": "object",
1090
+ "properties": { "kind": {
1091
+ "type": "string",
1092
+ "const": "all-commits"
1093
+ } },
1094
+ "required": ["kind"],
1095
+ "additionalProperties": true
1096
+ }, {
1097
+ "type": "object",
1098
+ "properties": {
1099
+ "kind": {
1100
+ "type": "string",
1101
+ "const": "commit"
1102
+ },
1103
+ "commit": {
1104
+ "type": "object",
1105
+ "properties": {
1106
+ "sha": { "type": "string" },
1107
+ "subject": { "type": "string" },
1108
+ "author": { "type": "string" },
1109
+ "date": { "type": "string" }
1110
+ },
1111
+ "required": [
1112
+ "sha",
1113
+ "subject",
1114
+ "author",
1115
+ "date"
1116
+ ],
1117
+ "additionalProperties": true
1118
+ }
1119
+ },
1120
+ "required": ["kind", "commit"],
1121
+ "additionalProperties": true
1122
+ }] },
1123
+ "base": { "type": "string" }
1124
+ },
1125
+ "required": [
1126
+ "kind",
1127
+ "repository",
1128
+ "ref",
1129
+ "revision",
1130
+ "base"
1131
+ ],
1132
+ "additionalProperties": true
1133
+ }] }
1134
+ },
1135
+ strictCodec: {
1136
+ mode: "strict",
1137
+ typeSymbol: "@lukstei/util-review-ui/types#ReviewSelection",
1138
+ create: _lukstei_dsh_client_review_git_workspaceReview_view_parameter_1_strict$schema,
1139
+ jsonSchema: { "oneOf": [{
1140
+ "type": "object",
1141
+ "properties": {
1142
+ "kind": {
1143
+ "type": "string",
1144
+ "const": "uncommitted"
1145
+ },
1146
+ "repository": { "type": "string" },
1147
+ "stage": {
1148
+ "type": "string",
1149
+ "enum": ["staged", "unstaged"]
1150
+ }
1151
+ },
1152
+ "required": [
1153
+ "kind",
1154
+ "repository",
1155
+ "stage"
1156
+ ],
1157
+ "additionalProperties": false
1158
+ }, {
1159
+ "type": "object",
1160
+ "properties": {
1161
+ "kind": {
1162
+ "type": "string",
1163
+ "const": "branch"
1164
+ },
1165
+ "repository": { "type": "string" },
1166
+ "ref": { "type": "string" },
1167
+ "revision": { "oneOf": [{
1168
+ "type": "object",
1169
+ "properties": { "kind": {
1170
+ "type": "string",
1171
+ "const": "all-commits"
1172
+ } },
1173
+ "required": ["kind"],
1174
+ "additionalProperties": false
1175
+ }, {
1176
+ "type": "object",
1177
+ "properties": {
1178
+ "kind": {
1179
+ "type": "string",
1180
+ "const": "commit"
1181
+ },
1182
+ "commit": {
1183
+ "type": "object",
1184
+ "properties": {
1185
+ "sha": { "type": "string" },
1186
+ "subject": { "type": "string" },
1187
+ "author": { "type": "string" },
1188
+ "date": { "type": "string" }
1189
+ },
1190
+ "required": [
1191
+ "sha",
1192
+ "subject",
1193
+ "author",
1194
+ "date"
1195
+ ],
1196
+ "additionalProperties": false
1197
+ }
1198
+ },
1199
+ "required": ["kind", "commit"],
1200
+ "additionalProperties": false
1201
+ }] },
1202
+ "base": { "type": "string" }
1203
+ },
1204
+ "required": [
1205
+ "kind",
1206
+ "repository",
1207
+ "ref",
1208
+ "revision",
1209
+ "base"
1210
+ ],
1211
+ "additionalProperties": false
1212
+ }] }
1213
+ }
1214
+ }],
1215
+ cancellation: { parameter: "signal" },
1216
+ result: {
1217
+ mode: "strict",
1218
+ typeSymbol: "@lukstei/util-review-ui/types#ReviewView",
1219
+ create: _lukstei_dsh_client_review_git_workspaceReview_view_result$schema,
1220
+ jsonSchema: {
1221
+ "type": "object",
1222
+ "properties": {
1223
+ "kind": {
1224
+ "type": "string",
1225
+ "const": "diff"
1226
+ },
1227
+ "view": {
1228
+ "type": "object",
1229
+ "properties": {
1230
+ "target": { "type": "string" },
1231
+ "snapshot": {
1232
+ "type": "object",
1233
+ "properties": {
1234
+ "kind": {
1235
+ "type": "string",
1236
+ "enum": [
1237
+ "revision",
1238
+ "staged",
1239
+ "unstaged"
1240
+ ]
1241
+ },
1242
+ "repository": { "type": "string" },
1243
+ "before": { "oneOf": [{
1244
+ "type": "null",
1245
+ "const": null
1246
+ }, { "type": "string" }] },
1247
+ "after": { "type": "string" }
1248
+ },
1249
+ "required": [
1250
+ "kind",
1251
+ "repository",
1252
+ "before",
1253
+ "after"
1254
+ ],
1255
+ "additionalProperties": true
1256
+ },
1257
+ "diffs": {
1258
+ "type": "array",
1259
+ "items": {
1260
+ "type": "object",
1261
+ "properties": {
1262
+ "path": { "type": "string" },
1263
+ "status": {
1264
+ "type": "string",
1265
+ "enum": [
1266
+ "added",
1267
+ "deleted",
1268
+ "modified"
1269
+ ]
1270
+ },
1271
+ "addedLines": { "type": "number" },
1272
+ "deletedLines": { "type": "number" }
1273
+ },
1274
+ "required": [
1275
+ "path",
1276
+ "status",
1277
+ "addedLines",
1278
+ "deletedLines"
1279
+ ],
1280
+ "additionalProperties": true
1281
+ }
1282
+ },
1283
+ "summary": {
1284
+ "type": "object",
1285
+ "properties": {
1286
+ "files": { "type": "number" },
1287
+ "added": { "type": "number" },
1288
+ "deleted": { "type": "number" }
1289
+ },
1290
+ "required": [
1291
+ "files",
1292
+ "added",
1293
+ "deleted"
1294
+ ],
1295
+ "additionalProperties": true
1296
+ }
1297
+ },
1298
+ "required": [
1299
+ "target",
1300
+ "snapshot",
1301
+ "diffs",
1302
+ "summary"
1303
+ ],
1304
+ "additionalProperties": true
1305
+ }
1306
+ },
1307
+ "required": ["kind", "view"],
1308
+ "additionalProperties": true
1309
+ }
1310
+ },
1311
+ sourceLocation: {
1312
+ "file": "packages/git-diff/src/workspace-review-service.ts",
1313
+ "line": 348,
1314
+ "column": 8
1315
+ }
1316
+ }
1317
+ }
1318
+ }, zod.z);
1319
+ // \0git-diff-pane-css
1320
+ const cssText = ".PVpF4W_root {\n min-width: 0;\n height: 100%;\n min-height: 0;\n color: var(--dsw-alias-label-primary);\n font-family: var(--dsw-font-family);\n font-size: var(--dsh-content-font-size-secondary);\n flex-direction: column;\n line-height: 1.5;\n display: flex;\n container: PVpF4W_git-diff / size;\n}\n\n.PVpF4W_header {\n box-sizing: border-box;\n background: var(--dsw-alias-bg-module-platform);\n border-bottom: .5px solid var(--dsw-alias-border-l2);\n flex: none;\n align-items: center;\n gap: 6px;\n min-width: 0;\n height: 35px;\n min-height: 35px;\n padding: 0 10px;\n display: flex;\n}\n\n.PVpF4W_repositoryName {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n color: var(--dsw-alias-label-secondary);\n flex: 1;\n font-size: 13px;\n font-weight: 500;\n display: block;\n overflow: hidden;\n}\n\n.PVpF4W_scopePicker {\n flex: 0 auto;\n min-width: 0;\n max-width: 240px;\n display: block;\n}\n\n.PVpF4W_scopeSelector {\n margin-inline-start: auto;\n}\n\n.PVpF4W_baselinePicker {\n border-radius: var(--dsw-radius-sm);\n min-width: 0;\n max-width: 120px;\n height: 26px;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 26px;\n}\n\n.PVpF4W_body {\n flex-direction: column;\n flex: 1;\n gap: 8px;\n min-width: 0;\n min-height: 0;\n display: flex;\n overflow: hidden;\n}\n\n.PVpF4W_body > p {\n padding: 12px;\n}\n\n.PVpF4W_note, .PVpF4W_baseline {\n color: var(--dsw-alias-label-secondary);\n font: inherit;\n margin: 0;\n}\n\n.PVpF4W_error {\n color: var(--dsw-alias-state-error-primary);\n overflow-wrap: anywhere;\n margin: 0;\n}\n\n.PVpF4W_branchButton {\n border-radius: var(--dsw-radius-sm);\n justify-content: flex-start;\n width: auto;\n min-width: 0;\n max-width: 100%;\n height: 26px;\n padding-inline: 6px;\n font-size: 13px;\n}\n\n.PVpF4W_truncate, .PVpF4W_filename {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n overflow: hidden;\n}\n\n.PVpF4W_filename {\n flex: 0 auto;\n line-height: 20px;\n}\n\n.PVpF4W_baseline {\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: none;\n align-items: center;\n min-width: 0;\n max-width: 45%;\n height: 26px;\n font-size: 13px;\n line-height: 26px;\n display: inline-flex;\n overflow: hidden;\n}\n\n.PVpF4W_commitLabel {\n flex-direction: column;\n min-width: 0;\n display: flex;\n}\n\n.PVpF4W_branchMenuLabel {\n flex: 1;\n justify-content: space-between;\n align-items: center;\n gap: 20px;\n min-width: 0;\n display: flex;\n}\n\n.PVpF4W_branchMenuLabel time {\n white-space: nowrap;\n flex: none;\n}\n\n.PVpF4W_fileTreeScroll {\n overscroll-behavior: contain;\n flex: 1;\n min-width: 0;\n min-height: 0;\n overflow: auto;\n}\n\n.PVpF4W_directory {\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--dsw-alias-label-tertiary);\n cursor: pointer;\n padding: 5px 12px;\n overflow: hidden;\n}\n\n.PVpF4W_fileTree {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.PVpF4W_row {\n text-align: left;\n border-radius: 0;\n flex: 1;\n justify-content: flex-start;\n align-items: center;\n gap: 8px;\n min-width: 0;\n height: auto;\n min-height: 34px;\n padding: 4px 8px;\n}\n\n.PVpF4W_row time {\n white-space: nowrap;\n flex: none;\n line-height: 20px;\n}\n\n.PVpF4W_fileToolbar .PVpF4W_row:hover:not(:disabled), .PVpF4W_fileToolbar .PVpF4W_row:active:not(:disabled) {\n background: none;\n}\n\n.PVpF4W_disclosureOpen, .PVpF4W_disclosureClosed {\n transform-origin: center;\n flex: none;\n align-self: center;\n width: 14px;\n height: 14px;\n}\n\n.PVpF4W_disclosureClosed {\n transform: rotate(-90deg);\n}\n\n.PVpF4W_fileEntry {\n border-bottom: .5px solid var(--dsw-alias-border-l1);\n}\n\n.PVpF4W_fileBody {\n min-width: 0;\n}\n\n.PVpF4W_fileBody > p {\n padding: 8px 12px;\n}\n\n.PVpF4W_status {\n width: 1em;\n color: var(--dsw-alias-label-tertiary);\n flex: none;\n align-items: center;\n font-size: .9em;\n line-height: 20px;\n display: inline-flex;\n}\n\n.PVpF4W_lineCounts {\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n flex: none;\n align-items: center;\n gap: 6px;\n font-size: .9em;\n line-height: 20px;\n display: flex;\n}\n\n.PVpF4W_added {\n color: var(--dsw-alias-file-diff-added-marker);\n}\n\n.PVpF4W_visuallyHidden {\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n width: 1px;\n height: 1px;\n padding: 0;\n position: absolute;\n overflow: hidden;\n}\n\n.PVpF4W_deleted {\n color: var(--dsw-alias-file-diff-deleted-marker);\n}\n\n.PVpF4W_diffContent {\n --diffs-font-family: var(--dsh-font-family-code, monospace);\n --diffs-font-size: var(--dsh-code-font-size, 12px);\n min-width: 0;\n display: block;\n}\n\n.PVpF4W_icon {\n flex: none;\n width: 16px;\n height: 16px;\n}\n\n.PVpF4W_fileToolbar {\n box-sizing: border-box;\n min-height: 36px;\n transition: background var(--ds-transition-duration-fast, .1s)\n var(--ds-ease-in-out, ease);\n background: none;\n flex: none;\n justify-content: space-between;\n align-items: center;\n gap: 8px;\n margin: 0;\n padding: 0 6px 0 0;\n display: flex;\n}\n\n.PVpF4W_fileToolbar:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.PVpF4W_fileToolbar .PVpF4W_fileAction {\n width: 28px;\n min-width: 28px;\n color: var(--dsw-alias-label-secondary);\n padding: 0;\n}\n\n.PVpF4W_fileAction[aria-pressed=\"true\"] {\n color: var(--dsw-alias-label-primary);\n}\n\n.PVpF4W_fileAction .PVpF4W_icon {\n width: 14px;\n height: 14px;\n}\n\n.PVpF4W_reviewDock {\n flex-direction: column;\n flex: none;\n min-height: 0;\n display: flex;\n}\n\n.PVpF4W_reviewBar {\n box-sizing: border-box;\n background: var(--dsw-alias-bg-base);\n border-top: .5px solid var(--dsw-alias-border-l3);\n flex: none;\n justify-content: space-between;\n align-items: center;\n gap: 8px;\n height: 40px;\n min-height: 40px;\n padding: 4px 10px;\n display: flex;\n}\n\n.PVpF4W_reviewDrawer {\n box-sizing: border-box;\n overscroll-behavior: contain;\n border-top: .5px solid var(--dsw-alias-border-l3);\n max-height: min(280px, 35cqh);\n padding: 4px 8px;\n overflow: auto;\n}\n\n.PVpF4W_reviewRow {\n text-align: left;\n flex: 1;\n justify-content: flex-start;\n width: 100%;\n min-width: 0;\n height: auto;\n}\n\n.PVpF4W_reviewPreview {\n flex-direction: column;\n min-width: 0;\n padding-block: 4px;\n display: flex;\n}\n\n.PVpF4W_reviewItem {\n align-items: center;\n gap: 4px;\n display: flex;\n}\n\n.PVpF4W_chevronOpen {\n width: 16px;\n height: 16px;\n transform: rotate(180deg);\n}\n\n.PVpF4W_comment {\n box-sizing: border-box;\n color: var(--dsw-alias-label-primary);\n background: var(--dsw-alias-markdown-code-block);\n border: .5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-lg);\n font: var(--dsh-content-font-size-secondary) / 1.5 var(--dsw-font-family);\n max-width: 860px;\n margin: 8px 12px;\n padding: 8px 12px;\n}\n\n.PVpF4W_commentHeader {\n justify-content: space-between;\n align-items: center;\n gap: 8px;\n display: flex;\n}\n\n.PVpF4W_commentActions {\n align-items: center;\n gap: 4px;\n display: flex;\n}\n\n.PVpF4W_commentText {\n text-align: left;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n justify-content: flex-start;\n width: 100%;\n height: auto;\n}\n\n.PVpF4W_comment textarea {\n box-sizing: border-box;\n resize: vertical;\n width: 100%;\n color: inherit;\n border: 1px solid var(--dsw-alias-border-l3);\n font: inherit;\n background: none;\n border-radius: 4px;\n margin: 4px 0;\n padding: 6px;\n display: block;\n}\n\n@media (pointer: coarse) {\n .PVpF4W_fileToolbar {\n padding-block: 0;\n }\n\n .PVpF4W_row, .PVpF4W_directory {\n min-height: 44px;\n }\n\n .PVpF4W_directory {\n box-sizing: border-box;\n padding-block: 12px;\n }\n}\n\n@container PVpF4W_git-diff (width <= 600px) {\n .PVpF4W_header > .PVpF4W_baseline {\n display: none;\n }\n\n .PVpF4W_scopePicker {\n max-width: 180px;\n }\n}\n\n.PVpF4W_fileHeading {\n font: var(--dsh-content-font-size-secondary) / 1.5 var(--dsw-font-family);\n background: var(--dsw-alias-bg-module-platform);\n}\n\n.PVpF4W_fileHeading[data-expanded=\"true\"] {\n border-bottom: .5px solid var(--dsw-alias-border-l2);\n}\n\n.PVpF4W_reviewCardList {\n --deliverable-fill: var(--dsw-static-neutral-50);\n --deliverable-hover: var(--dsw-static-neutral-100);\n flex-direction: column;\n gap: 6px;\n width: 100%;\n margin-block: 6px;\n display: flex;\n}\n\nbody[data-ds-dark-theme] .PVpF4W_reviewCardList {\n --deliverable-fill: var(--dsw-static-neutral-850);\n --deliverable-hover: var(--dsw-static-neutral-800);\n}\n\n.PVpF4W_reviewCard {\n box-sizing: border-box;\n border: .5px solid var(--dsw-alias-border-l1);\n border-radius: var(--dsw-radius-lg);\n background: var(--deliverable-fill, var(--dsw-static-neutral-50));\n width: 100%;\n min-width: 0;\n height: 60px;\n color: var(--dsw-alias-label-primary);\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n transition: background-color .12s;\n display: flex;\n position: relative;\n overflow: hidden;\n}\n\nbody[data-ds-dark-theme] .PVpF4W_reviewCard {\n background: var(--deliverable-fill, var(--dsw-static-neutral-850));\n}\n\n@media (hover: hover) {\n .PVpF4W_reviewCard:hover {\n background: var(--deliverable-hover, var(--dsw-static-neutral-100));\n }\n\n body[data-ds-dark-theme] .PVpF4W_reviewCard:hover {\n background: var(--deliverable-hover, var(--dsw-static-neutral-800));\n }\n}\n\n.PVpF4W_reviewCard[data-clickable=\"true\"] {\n cursor: pointer;\n}\n\n.PVpF4W_reviewCard:focus-visible {\n box-shadow: inset 0 0 0 2px\n var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline: none;\n}\n\n.PVpF4W_reviewIcon {\n z-index: 2;\n box-sizing: border-box;\n pointer-events: none;\n border: .5px solid var(--dsw-alias-border-l1);\n background: color-mix(in srgb, var(--dsw-static-neutral-00) 50%, transparent);\n width: 40px;\n height: 40px;\n color: var(--dsw-alias-link);\n border-radius: 10px;\n flex: none;\n place-items: center;\n display: grid;\n position: relative;\n overflow: hidden;\n}\n\nbody[data-ds-dark-theme] .PVpF4W_reviewIcon {\n background: color-mix(in srgb, var(--dsw-static-neutral-00) 5%, transparent);\n}\n\n.PVpF4W_reviewDetails {\n z-index: 2;\n flex-direction: column;\n flex: 1;\n justify-content: center;\n gap: 2px;\n min-width: 0;\n display: flex;\n position: relative;\n}\n\n.PVpF4W_reviewTitle {\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n align-items: center;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n display: inline-flex;\n}\n\n.PVpF4W_reviewBranchCopy {\n cursor: pointer;\n border-radius: var(--dsw-radius-xs, 4px);\n -webkit-user-select: text;\n user-select: text;\n align-items: center;\n gap: 6px;\n min-width: 0;\n max-width: 100%;\n margin-left: -4px;\n padding: 1px 4px;\n transition: background-color .1s;\n display: inline-flex;\n}\n\n@media (hover: hover) {\n .PVpF4W_reviewBranchCopy:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n }\n}\n\n.PVpF4W_reviewBranchCopy:focus-visible {\n box-shadow: 0 0 0 1.5px\n var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline: none;\n}\n\n.PVpF4W_reviewBranchName {\n text-overflow: ellipsis;\n white-space: nowrap;\n -webkit-user-select: text;\n user-select: text;\n overflow: hidden;\n}\n\n.PVpF4W_reviewCopyIcon {\n opacity: .6;\n color: var(--dsw-alias-label-secondary);\n flex: none;\n align-items: center;\n transition: opacity .1s, color .1s;\n display: inline-flex;\n}\n\n.PVpF4W_reviewBranchCopy:hover .PVpF4W_reviewCopyIcon, .PVpF4W_reviewBranchCopy[data-copied=\"true\"] .PVpF4W_reviewCopyIcon {\n opacity: 1;\n color: var(--dsw-alias-link);\n}\n\n.PVpF4W_reviewCopyFeedback {\n color: var(--dsw-alias-link);\n flex: none;\n font-size: 11px;\n font-weight: 400;\n line-height: 16px;\n}\n\n.PVpF4W_reviewDescription {\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--dsw-alias-label-tertiary);\n font-size: 10px;\n font-weight: 400;\n line-height: 16px;\n overflow: hidden;\n}\n\n.PVpF4W_codeViewWrapper {\n min-width: 0;\n position: relative;\n}\n\n.PVpF4W_codeViewWrapper .md-code-block[data-line-numbers] {\n margin: 0;\n}\n\n.PVpF4W_codeViewWrapper .md-code-block[data-line-numbers] :where(pre) code > .line {\n padding-inline-start: calc(var(--dsl-code-block-line-number-width) + 20px);\n}\n\n.PVpF4W_codeViewWrapper .md-code-block[data-line-numbers] :where(pre) code > .line:before {\n width: var(--dsl-code-block-line-number-width);\n font-family: var(--dsh-font-family-code, monospace);\n font-variant-numeric: tabular-nums;\n inset-inline-start: 8px;\n}\n\n.PVpF4W_floatingQuote {\n z-index: 25;\n pointer-events: auto;\n position: absolute;\n}\n\n.PVpF4W_floatingQuoteButton {\n height: 24px;\n font-size: 11px;\n font-weight: 500;\n font-family: var(--dsw-font-family);\n color: #fff;\n background: var(--dsw-alias-interactive-bg-primary, #3b82f6);\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n border: none;\n border-radius: 12px;\n justify-content: center;\n align-items: center;\n padding: 0 10px;\n display: inline-flex;\n box-shadow: 0 2px 8px #00000040;\n}\n\n.PVpF4W_floatingQuoteButton:hover {\n filter: brightness(1.1);\n}\n";
1321
+ var _git_diff_pane_css_default = {
1322
+ "note": "PVpF4W_note",
1323
+ "repositoryName": "PVpF4W_repositoryName",
1324
+ "reviewDrawer": "PVpF4W_reviewDrawer",
1325
+ "reviewRow": "PVpF4W_reviewRow",
1326
+ "baseline": "PVpF4W_baseline",
1327
+ "reviewPreview": "PVpF4W_reviewPreview",
1328
+ "floatingQuote": "PVpF4W_floatingQuote",
1329
+ "reviewCopyFeedback": "PVpF4W_reviewCopyFeedback",
1330
+ "reviewBranchCopy": "PVpF4W_reviewBranchCopy",
1331
+ "reviewCopyIcon": "PVpF4W_reviewCopyIcon",
1332
+ "fileToolbar": "PVpF4W_fileToolbar",
1333
+ "fileEntry": "PVpF4W_fileEntry",
1334
+ "disclosureOpen": "PVpF4W_disclosureOpen",
1335
+ "reviewDetails": "PVpF4W_reviewDetails",
1336
+ "disclosureClosed": "PVpF4W_disclosureClosed",
1337
+ "row": "PVpF4W_row",
1338
+ "scopePicker": "PVpF4W_scopePicker",
1339
+ "icon": "PVpF4W_icon",
1340
+ "body": "PVpF4W_body",
1341
+ "git-diff": "PVpF4W_git-diff",
1342
+ "error": "PVpF4W_error",
1343
+ "codeViewWrapper": "PVpF4W_codeViewWrapper",
1344
+ "baselinePicker": "PVpF4W_baselinePicker",
1345
+ "scopeSelector": "PVpF4W_scopeSelector",
1346
+ "chevronOpen": "PVpF4W_chevronOpen",
1347
+ "fileBody": "PVpF4W_fileBody",
1348
+ "reviewCardList": "PVpF4W_reviewCardList",
1349
+ "status": "PVpF4W_status",
1350
+ "lineCounts": "PVpF4W_lineCounts",
1351
+ "fileHeading": "PVpF4W_fileHeading",
1352
+ "truncate": "PVpF4W_truncate",
1353
+ "commentHeader": "PVpF4W_commentHeader",
1354
+ "reviewDescription": "PVpF4W_reviewDescription",
1355
+ "fileTree": "PVpF4W_fileTree",
1356
+ "directory": "PVpF4W_directory",
1357
+ "reviewDock": "PVpF4W_reviewDock",
1358
+ "filename": "PVpF4W_filename",
1359
+ "branchMenuLabel": "PVpF4W_branchMenuLabel",
1360
+ "deleted": "PVpF4W_deleted",
1361
+ "fileTreeScroll": "PVpF4W_fileTreeScroll",
1362
+ "diffContent": "PVpF4W_diffContent",
1363
+ "branchButton": "PVpF4W_branchButton",
1364
+ "visuallyHidden": "PVpF4W_visuallyHidden",
1365
+ "reviewItem": "PVpF4W_reviewItem",
1366
+ "commentActions": "PVpF4W_commentActions",
1367
+ "commentText": "PVpF4W_commentText",
1368
+ "reviewTitle": "PVpF4W_reviewTitle",
1369
+ "header": "PVpF4W_header",
1370
+ "reviewBranchName": "PVpF4W_reviewBranchName",
1371
+ "reviewIcon": "PVpF4W_reviewIcon",
1372
+ "floatingQuoteButton": "PVpF4W_floatingQuoteButton",
1373
+ "comment": "PVpF4W_comment",
1374
+ "root": "PVpF4W_root",
1375
+ "reviewCard": "PVpF4W_reviewCard",
1376
+ "added": "PVpF4W_added",
1377
+ "reviewBar": "PVpF4W_reviewBar",
1378
+ "commitLabel": "PVpF4W_commitLabel",
1379
+ "fileAction": "PVpF4W_fileAction"
1380
+ };
1381
+ // ../util-review-ui/src/client/useSelectionQuote.ts
1382
+ /**
1383
+ * Computes 1-based start and end line indices from .line elements intersecting the range.
1384
+ * @internal
1385
+ */
1386
+ function getSelectedLineSpan(container, range) {
1387
+ const lineElements = container.querySelectorAll(".line");
1388
+ if (lineElements.length === 0) return null;
1389
+ let min = -1;
1390
+ let max = -1;
1391
+ const part = container.ownerDocument.createRange();
1392
+ for (let i = 0; i < lineElements.length; i++) {
1393
+ const line = lineElements[i];
1394
+ if (!range.intersectsNode(line)) {
1395
+ if (min !== -1) break;
1396
+ continue;
1397
+ }
1398
+ const isStart = line.contains(range.startContainer);
1399
+ const isEnd = line.contains(range.endContainer);
1400
+ if (!isStart && !isEnd) {
1401
+ if (min === -1) min = i;
1402
+ max = i;
1403
+ continue;
1404
+ }
1405
+ part.selectNodeContents(line);
1406
+ if (isStart) part.setStart(range.startContainer, range.startOffset);
1407
+ if (isEnd) part.setEnd(range.endContainer, range.endOffset);
1408
+ if (!part.collapsed && part.toString() !== "") {
1409
+ if (min === -1) min = i;
1410
+ max = i;
1411
+ }
1412
+ }
1413
+ return min === -1 ? null : {
1414
+ min: min + 1,
1415
+ max: max + 1
1416
+ };
1417
+ }
1418
+ function useSelectionQuote({ containerRef, enabled }) {
1419
+ const [floatingQuote, setFloatingQuote] = (0, react.useState)(null);
1420
+ (0, react.useEffect)(() => {
1421
+ if (!enabled) {
1422
+ setFloatingQuote(null);
1423
+ return;
1424
+ }
1425
+ const update = () => {
1426
+ const container = containerRef.current;
1427
+ if (!container) {
1428
+ setFloatingQuote(null);
1429
+ return;
1430
+ }
1431
+ const sel = window.getSelection();
1432
+ if (!sel || sel.isCollapsed || sel.rangeCount === 0) {
1433
+ setFloatingQuote(null);
1434
+ return;
1435
+ }
1436
+ const range = sel.getRangeAt(0);
1437
+ if (!container.contains(range.commonAncestorContainer)) {
1438
+ setFloatingQuote(null);
1439
+ return;
1440
+ }
1441
+ const text = sel.toString().trim();
1442
+ if (!text) {
1443
+ setFloatingQuote(null);
1444
+ return;
1445
+ }
1446
+ const rect = range.getBoundingClientRect();
1447
+ const containerRect = container.getBoundingClientRect();
1448
+ let lines;
1449
+ const span = getSelectedLineSpan(container, range);
1450
+ if (span !== null) lines = span.min === span.max ? String(span.min) : `${span.min}–${span.max}`;
1451
+ const top = Math.max(0, rect.top - containerRect.top - 32);
1452
+ const left = Math.max(8, Math.min(containerRect.width - 70, rect.left - containerRect.left + rect.width / 2 - 30));
1453
+ setFloatingQuote({
1454
+ text,
1455
+ lines,
1456
+ top,
1457
+ left
1458
+ });
1459
+ };
1460
+ document.addEventListener("selectionchange", update);
1461
+ return () => {
1462
+ document.removeEventListener("selectionchange", update);
1463
+ setFloatingQuote(null);
1464
+ };
1465
+ }, [enabled, containerRef]);
1466
+ const clearFloatingQuote = () => {
1467
+ setFloatingQuote(null);
1468
+ window.getSelection()?.removeAllRanges();
1469
+ };
1470
+ return {
1471
+ floatingQuote,
1472
+ clearFloatingQuote
1473
+ };
1474
+ }
1475
+ // ../util-review-ui/src/client/CodeFileView.tsx
1476
+ function CodeFileView({ path, code, diff = false, wrapped, result, onRetry, extra, onQuote }) {
1477
+ const containerRef = (0, react.useRef)(null);
1478
+ const { floatingQuote, clearFloatingQuote } = useSelectionQuote({
1479
+ containerRef,
1480
+ enabled: onQuote !== void 0
1481
+ });
1482
+ if (result.status === "loading" || result.status === "idle") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1483
+ className: _git_diff_pane_css_default.note,
1484
+ role: "status",
1485
+ children: "Loading file…"
1486
+ });
1487
+ if (result.status === "failed") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1488
+ className: _git_diff_pane_css_default.error,
1489
+ role: "alert",
1490
+ children: [
1491
+ result.message,
1492
+ " ",
1493
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1494
+ size: "sm",
1495
+ variant: "ghost",
1496
+ onClick: onRetry,
1497
+ children: "Retry"
1498
+ })
1499
+ ]
1500
+ });
1501
+ if (code === null) return extra ?? null;
1502
+ const handleQuote = (e) => {
1503
+ e.preventDefault();
1504
+ if (!floatingQuote || !onQuote) return;
1505
+ onQuote({
1506
+ text: floatingQuote.text,
1507
+ path,
1508
+ lines: floatingQuote.lines
1509
+ });
1510
+ clearFloatingQuote();
1511
+ };
1512
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1513
+ ref: containerRef,
1514
+ className: _git_diff_pane_css_default.codeViewWrapper,
1515
+ children: [
1516
+ floatingQuote !== null && onQuote !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1517
+ className: _git_diff_pane_css_default.floatingQuote,
1518
+ style: {
1519
+ top: `${floatingQuote.top}px`,
1520
+ left: `${floatingQuote.left}px`
1521
+ },
1522
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1523
+ type: "button",
1524
+ className: _git_diff_pane_css_default.floatingQuoteButton,
1525
+ onPointerDown: (e) => {
1526
+ e.preventDefault();
1527
+ },
1528
+ onClick: handleQuote,
1529
+ children: "Quote"
1530
+ })
1531
+ }),
1532
+ extra,
1533
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.CodeBlock, {
1534
+ code,
1535
+ lang: (0, _deepseek_ai_dsh_client_ui_primitives.languageForPath)(path),
1536
+ diff,
1537
+ lineNumbers: true,
1538
+ wrap: wrapped,
1539
+ showHeader: false,
1540
+ copyLabel: "Copy",
1541
+ copiedLabel: "Copied!"
1542
+ })
1543
+ ]
1544
+ });
1545
+ }
1546
+ // ../util-review-ui/src/client/diff.ts
1547
+ function createUnifiedDiff(path, before, after) {
1548
+ if (before === null && after === null) return "";
1549
+ if (before === null) {
1550
+ const lines = (after ?? "").split("\n");
1551
+ return [
1552
+ `--- /dev/null`,
1553
+ `+++ b/${path}`,
1554
+ `@@ -0,0 +1,${lines.length} @@`,
1555
+ ...lines.map((l) => `+${l}`)
1556
+ ].join("\n");
1557
+ }
1558
+ if (after === null) {
1559
+ const lines = (before ?? "").split("\n");
1560
+ return [
1561
+ `--- a/${path}`,
1562
+ `+++ /dev/null`,
1563
+ `@@ -1,${lines.length} +0,0 @@`,
1564
+ ...lines.map((l) => `-${l}`)
1565
+ ].join("\n");
1566
+ }
1567
+ const a = before.split("\n");
1568
+ const b = after.split("\n");
1569
+ if (before === after) return "";
1570
+ let prefix = 0;
1571
+ while (prefix < a.length && prefix < b.length && a[prefix] === b[prefix]) prefix++;
1572
+ let aEnd = a.length - 1;
1573
+ let bEnd = b.length - 1;
1574
+ while (aEnd >= prefix && bEnd >= prefix && a[aEnd] === b[bEnd]) {
1575
+ aEnd--;
1576
+ bEnd--;
1577
+ }
1578
+ const aMid = a.slice(prefix, aEnd + 1);
1579
+ const bMid = b.slice(prefix, bEnd + 1);
1580
+ let ops;
1581
+ if (aMid.length * bMid.length > 5e5) ops = [
1582
+ ...a.slice(0, prefix).map((l) => ({
1583
+ type: " ",
1584
+ line: l
1585
+ })),
1586
+ ...aMid.map((l) => ({
1587
+ type: "-",
1588
+ line: l
1589
+ })),
1590
+ ...bMid.map((l) => ({
1591
+ type: "+",
1592
+ line: l
1593
+ })),
1594
+ ...a.slice(aEnd + 1).map((l) => ({
1595
+ type: " ",
1596
+ line: l
1597
+ }))
1598
+ ];
1599
+ else {
1600
+ const m = aMid.length;
1601
+ const n = bMid.length;
1602
+ const dp = Array.from({ length: m + 1 }, () => new Int32Array(n + 1));
1603
+ for (let i = 0; i < m; i++) for (let j = 0; j < n; j++) dp[i + 1][j + 1] = aMid[i] === bMid[j] ? dp[i][j] + 1 : Math.max(dp[i + 1][j], dp[i][j + 1]);
1604
+ let i = m;
1605
+ let j = n;
1606
+ const midOps = [];
1607
+ while (i > 0 || j > 0) if (i > 0 && j > 0 && aMid[i - 1] === bMid[j - 1]) {
1608
+ midOps.push({
1609
+ type: " ",
1610
+ line: aMid[i - 1]
1611
+ });
1612
+ i--;
1613
+ j--;
1614
+ } else if (j > 0 && (i === 0 || dp[i][j - 1] >= dp[i - 1][j])) {
1615
+ midOps.push({
1616
+ type: "+",
1617
+ line: bMid[j - 1]
1618
+ });
1619
+ j--;
1620
+ } else {
1621
+ midOps.push({
1622
+ type: "-",
1623
+ line: aMid[i - 1]
1624
+ });
1625
+ i--;
1626
+ }
1627
+ midOps.reverse();
1628
+ ops = [
1629
+ ...a.slice(0, prefix).map((l) => ({
1630
+ type: " ",
1631
+ line: l
1632
+ })),
1633
+ ...midOps,
1634
+ ...a.slice(aEnd + 1).map((l) => ({
1635
+ type: " ",
1636
+ line: l
1637
+ }))
1638
+ ];
1639
+ }
1640
+ const context = 3;
1641
+ const changeIndices = [];
1642
+ for (let idx = 0; idx < ops.length; idx++) if (ops[idx].type !== " ") changeIndices.push(idx);
1643
+ if (changeIndices.length === 0) return "";
1644
+ const ranges = [];
1645
+ let currentRange = {
1646
+ start: Math.max(0, changeIndices[0] - context),
1647
+ end: Math.min(ops.length - 1, changeIndices[0] + context)
1648
+ };
1649
+ for (let k = 1; k < changeIndices.length; k++) {
1650
+ const nextChange = changeIndices[k];
1651
+ const nextStart = Math.max(0, nextChange - context);
1652
+ const nextEnd = Math.min(ops.length - 1, nextChange + context);
1653
+ if (nextStart <= currentRange.end + 1) currentRange.end = nextEnd;
1654
+ else {
1655
+ ranges.push(currentRange);
1656
+ currentRange = {
1657
+ start: nextStart,
1658
+ end: nextEnd
1659
+ };
1660
+ }
1661
+ }
1662
+ ranges.push(currentRange);
1663
+ const result = [`--- a/${path}`, `+++ b/${path}`];
1664
+ let oldLineNum = 1;
1665
+ let newLineNum = 1;
1666
+ let opIdx = 0;
1667
+ for (const range of ranges) {
1668
+ while (opIdx < range.start) {
1669
+ if (ops[opIdx].type === "-") oldLineNum++;
1670
+ else if (ops[opIdx].type === "+") newLineNum++;
1671
+ else {
1672
+ oldLineNum++;
1673
+ newLineNum++;
1674
+ }
1675
+ opIdx++;
1676
+ }
1677
+ const hunkOldStart = oldLineNum;
1678
+ const hunkNewStart = newLineNum;
1679
+ let hunkOldCount = 0;
1680
+ let hunkNewCount = 0;
1681
+ const hunkLines = [];
1682
+ while (opIdx <= range.end) {
1683
+ const op = ops[opIdx];
1684
+ hunkLines.push(`${op.type}${op.line}`);
1685
+ if (op.type === "-") {
1686
+ oldLineNum++;
1687
+ hunkOldCount++;
1688
+ } else if (op.type === "+") {
1689
+ newLineNum++;
1690
+ hunkNewCount++;
1691
+ } else {
1692
+ oldLineNum++;
1693
+ newLineNum++;
1694
+ hunkOldCount++;
1695
+ hunkNewCount++;
1696
+ }
1697
+ opIdx++;
1698
+ }
1699
+ result.push(`@@ -${hunkOldStart},${hunkOldCount} +${hunkNewStart},${hunkNewCount} @@`);
1700
+ result.push(...hunkLines);
1701
+ }
1702
+ return result.join("\n");
1703
+ }
1704
+ // ../util-review-ui/src/client/FileList.tsx
1705
+ function FileList(props) {
1706
+ const navRef = (0, react.useRef)(null);
1707
+ const initialScrollRestored = (0, react.useRef)(false);
1708
+ (0, react.useEffect)(() => {
1709
+ const nav = navRef.current;
1710
+ if (!nav) return;
1711
+ const container = nav.closest(`.${_git_diff_pane_css_default.fileTreeScroll}`);
1712
+ if (!container) return;
1713
+ if (!initialScrollRestored.current && typeof props.initialScrollTop === "number" && props.initialScrollTop > 0) {
1714
+ const targetTop = props.initialScrollTop;
1715
+ container.scrollTop = targetTop;
1716
+ requestAnimationFrame(() => {
1717
+ if (container.scrollTop !== targetTop) container.scrollTop = targetTop;
1718
+ });
1719
+ initialScrollRestored.current = true;
1720
+ }
1721
+ if (!props.onScroll) return;
1722
+ let rAF = null;
1723
+ const handleScroll = () => {
1724
+ if (rAF !== null) cancelAnimationFrame(rAF);
1725
+ rAF = requestAnimationFrame(() => {
1726
+ props.onScroll?.(container.scrollTop);
1727
+ rAF = null;
1728
+ });
1729
+ };
1730
+ container.addEventListener("scroll", handleScroll, { passive: true });
1731
+ return () => {
1732
+ if (rAF !== null) cancelAnimationFrame(rAF);
1733
+ container.removeEventListener("scroll", handleScroll);
1734
+ };
1735
+ }, [props.initialScrollTop, props.onScroll]);
1736
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1737
+ className: _git_diff_pane_css_default.fileTreeScroll,
1738
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
1739
+ ref: navRef,
1740
+ "aria-label": props.label,
1741
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileTree, {
1742
+ ...props,
1743
+ target: props.target ?? null,
1744
+ directory: "",
1745
+ depth: 0,
1746
+ visible: true
1747
+ })
1748
+ })
1749
+ });
1750
+ }
1751
+ function FileTree(props) {
1752
+ const entries = Map.groupBy(props.files, (file) => file.path.slice(props.directory.length).split("/")[0]);
1753
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1754
+ className: _git_diff_pane_css_default.fileTree,
1755
+ children: [...entries].map(([name, children]) => {
1756
+ const path = props.directory + name;
1757
+ const file = children.find((child) => child.path === path);
1758
+ const descendants = children.filter((child) => child.path !== path);
1759
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", { children: [file !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileEntry, {
1760
+ ...props,
1761
+ file,
1762
+ name
1763
+ }), descendants.length > 0 && (() => {
1764
+ const dir = compactDirectory(name, `${path}/`, descendants);
1765
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Directory, {
1766
+ ...props,
1767
+ files: descendants,
1768
+ directory: dir.directory,
1769
+ name: dir.name
1770
+ });
1771
+ })()] }, path);
1772
+ })
1773
+ });
1774
+ }
1775
+ function compactDirectory(name, directory, files) {
1776
+ let currentName = name;
1777
+ let currentDir = directory;
1778
+ while (true) {
1779
+ let nextSegment = null;
1780
+ let hasDirectFile = false;
1781
+ for (const file of files) {
1782
+ const relative = file.path.slice(currentDir.length);
1783
+ const slashIndex = relative.indexOf("/");
1784
+ if (slashIndex === -1) {
1785
+ hasDirectFile = true;
1786
+ break;
1787
+ }
1788
+ const segment = relative.slice(0, slashIndex);
1789
+ if (nextSegment === null) nextSegment = segment;
1790
+ else if (nextSegment !== segment) {
1791
+ nextSegment = null;
1792
+ break;
1793
+ }
1794
+ }
1795
+ if (hasDirectFile || nextSegment === null) break;
1796
+ currentName = `${currentName}/${nextSegment}`;
1797
+ currentDir = `${currentDir}${nextSegment}/`;
1798
+ }
1799
+ return {
1800
+ name: currentName,
1801
+ directory: currentDir
1802
+ };
1803
+ }
1804
+ function Directory(props) {
1805
+ const [open, setOpen] = (0, react.useState)(true);
1806
+ (0, react.useEffect)(() => {
1807
+ if (props.target === null || props.target === void 0) return;
1808
+ if (props.target.path.startsWith(props.directory)) setOpen(true);
1809
+ }, [props.target, props.directory]);
1810
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
1811
+ open,
1812
+ onToggle: (event) => setOpen(event.currentTarget.open),
1813
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
1814
+ className: _git_diff_pane_css_default.directory,
1815
+ style: { paddingInlineStart: 12 + props.depth * 16 },
1816
+ title: props.directory,
1817
+ "aria-label": `Directory ${props.directory.slice(0, -1)}`,
1818
+ children: props.name
1819
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileTree, {
1820
+ ...props,
1821
+ depth: props.depth + 1,
1822
+ visible: props.visible && open
1823
+ })]
1824
+ });
1825
+ }
1826
+ function FileEntry(props) {
1827
+ const [open, setOpen] = (0, react.useState)(() => props.isExpanded ? props.isExpanded(props.file.path) : false);
1828
+ const id = (0, react.useId)();
1829
+ const row = (0, react.useRef)(null);
1830
+ (0, react.useEffect)(() => {
1831
+ if (!props.target || props.target.path !== props.file.path) return;
1832
+ setOpen(true);
1833
+ props.onToggleExpanded?.(props.file.path, true);
1834
+ const frame = requestAnimationFrame(() => {
1835
+ if (row.current !== null) row.current.scrollIntoView({ block: "nearest" });
1836
+ });
1837
+ return () => cancelAnimationFrame(frame);
1838
+ }, [
1839
+ props.target,
1840
+ props.file.path,
1841
+ props.onToggleExpanded
1842
+ ]);
1843
+ const file = props.file;
1844
+ const heading = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1845
+ size: "sm",
1846
+ variant: "ghost",
1847
+ className: _git_diff_pane_css_default.row,
1848
+ style: { paddingInlineStart: 10 + props.depth * 16 },
1849
+ title: file.path,
1850
+ "aria-label": `${file.path} · ${file.status}`,
1851
+ "aria-expanded": open,
1852
+ "aria-controls": `${id}-content`,
1853
+ "aria-describedby": `${id}-description`,
1854
+ onClick: () => {
1855
+ const next = !open;
1856
+ setOpen(next);
1857
+ props.onToggleExpanded?.(props.file.path, next);
1858
+ },
1859
+ children: [
1860
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { className: open ? _git_diff_pane_css_default.disclosureOpen : _git_diff_pane_css_default.disclosureClosed }),
1861
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1862
+ className: _git_diff_pane_css_default.status,
1863
+ "aria-hidden": "true",
1864
+ children: {
1865
+ added: "A",
1866
+ modified: "M",
1867
+ deleted: "D"
1868
+ }[file.status]
1869
+ }),
1870
+ file.status === "deleted" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("del", {
1871
+ className: _git_diff_pane_css_default.filename,
1872
+ children: props.name
1873
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1874
+ className: _git_diff_pane_css_default.filename,
1875
+ children: props.name
1876
+ }),
1877
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1878
+ className: _git_diff_pane_css_default.lineCounts,
1879
+ "aria-hidden": "true",
1880
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1881
+ className: _git_diff_pane_css_default.added,
1882
+ children: ["+", file.addedLines]
1883
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1884
+ className: _git_diff_pane_css_default.deleted,
1885
+ children: ["−", file.deletedLines]
1886
+ })]
1887
+ }),
1888
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1889
+ id: `${id}-description`,
1890
+ className: _git_diff_pane_css_default.visuallyHidden,
1891
+ children: `${file.addedLines} additions, ${file.deletedLines} deletions`
1892
+ })
1893
+ ]
1894
+ });
1895
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1896
+ ref: row,
1897
+ className: _git_diff_pane_css_default.fileEntry,
1898
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: props.renderFile(file, heading, props.visible && open, `${id}-content`) })
1899
+ });
1900
+ }
1901
+ // ../util-review-ui/src/client/FileReview.tsx
1902
+ function FileReview({ heading, actions, expanded, wrapped, toggleWrap }) {
1903
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1904
+ className: _git_diff_pane_css_default.fileHeading,
1905
+ "data-expanded": expanded,
1906
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1907
+ className: _git_diff_pane_css_default.fileToolbar,
1908
+ children: [heading, expanded && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1909
+ className: _git_diff_pane_css_default.commentActions,
1910
+ children: [actions, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
1911
+ label: "Wrap lines",
1912
+ side: "bottom",
1913
+ align: "end",
1914
+ portal: true,
1915
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1916
+ size: "sm",
1917
+ className: _git_diff_pane_css_default.fileAction,
1918
+ variant: wrapped ? "toolbar" : "ghost",
1919
+ "aria-label": "Wrap lines",
1920
+ "aria-pressed": wrapped,
1921
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWrapLinesOutlineRegular, { className: _git_diff_pane_css_default.icon }),
1922
+ onClick: toggleWrap
1923
+ })
1924
+ })]
1925
+ })]
1926
+ })
1927
+ });
1928
+ }
1929
+ // ../util-review-ui/src/client/quote.ts
1930
+ /**
1931
+ * Formats a code quote payload ensuring file name, line numbers, and quoted text
1932
+ * are consistently present.
1933
+ */
1934
+ function formatQuoteContent(quote) {
1935
+ const header = quote.lines ? `**${quote.path}:${quote.lines}**` : `**${quote.path}**`;
1936
+ const normalized = quote.text.replace(/\r?\n$/, "");
1937
+ return {
1938
+ chipText: `${header}\n${quote.text}`,
1939
+ markdownText: `> ${header}\n${normalized.split("\n").map((l) => `> ${l}`).join("\n")}\n\n`
1940
+ };
1941
+ }
1942
+ /**
1943
+ * Inserts a formatted quote into the conversation composer or falls back to
1944
+ * clipboard copy.
1945
+ */
1946
+ function quoteToComposer(quote, inputActions) {
1947
+ const { chipText, markdownText } = formatQuoteContent(quote);
1948
+ let inserted = false;
1949
+ if (inputActions) {
1950
+ try {
1951
+ inserted = Boolean(inputActions.insertQuote(chipText));
1952
+ if (inserted) inputActions.persistDraft();
1953
+ } catch {
1954
+ inserted = false;
1955
+ }
1956
+ if (!inserted) try {
1957
+ const span = inputActions.captureInsertion();
1958
+ if (Boolean(inputActions.insertText(markdownText, {
1959
+ ...span,
1960
+ start: span.end
1961
+ }))) {
1962
+ inputActions.persistDraft();
1963
+ inserted = true;
1964
+ }
1965
+ } catch {
1966
+ inserted = false;
1967
+ }
1968
+ }
1969
+ if (!inserted) (0, _deepseek_ai_dsh_client_ui_primitives.writeClipboard)(markdownText);
1970
+ }
1971
+ // ../util-review-ui/src/client/useLazyFile.ts
1972
+ function useLazyFile(load, expanded) {
1973
+ const [attempt, setAttempt] = (0, react.useState)(0);
1974
+ const [result, setResult] = (0, react.useState)({
1975
+ status: "idle",
1976
+ value: null
1977
+ });
1978
+ const request = (0, react.useRef)(null);
1979
+ (0, react.useEffect)(() => {
1980
+ if (request.current !== null && request.current.load !== load) request.current.controller.abort();
1981
+ if (!expanded) return;
1982
+ if (request.current !== null && request.current.load === load && request.current.attempt === attempt && !request.current.controller.signal.aborted) return;
1983
+ if (request.current !== null) request.current.controller.abort();
1984
+ const controller = new AbortController();
1985
+ request.current = {
1986
+ load,
1987
+ attempt,
1988
+ controller
1989
+ };
1990
+ setResult((previous) => ({
1991
+ status: "loading",
1992
+ value: previous.value
1993
+ }));
1994
+ load(controller.signal).then((result) => {
1995
+ if (controller.signal.aborted) return;
1996
+ if (result.ok) setResult({
1997
+ status: "ready",
1998
+ value: result.value
1999
+ });
2000
+ else setResult((previous) => ({
2001
+ status: "failed",
2002
+ value: previous.value,
2003
+ message: result.error.message
2004
+ }));
2005
+ }, (error) => {
2006
+ if (!controller.signal.aborted) setResult((previous) => ({
2007
+ status: "failed",
2008
+ value: previous.value,
2009
+ message: error instanceof Error ? error.message : String(error)
2010
+ }));
2011
+ });
2012
+ }, [
2013
+ expanded,
2014
+ load,
2015
+ attempt
2016
+ ]);
2017
+ (0, react.useEffect)(() => () => {
2018
+ if (request.current !== null) request.current.controller.abort();
2019
+ }, []);
2020
+ const retry = () => setAttempt((value) => value + 1);
2021
+ return {
2022
+ result,
2023
+ retry
2024
+ };
2025
+ }
2026
+ // src/client/FileInspector.tsx
2027
+ function FileInspector(props) {
2028
+ const { wrapped, toggleWrap } = props;
2029
+ const onQuote = (0, react.useCallback)((quote) => {
2030
+ quoteToComposer(quote, props.inputActions);
2031
+ }, [props.inputActions]);
2032
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileList, {
2033
+ label: "Changed file list",
2034
+ files: props.view.diffs.map((file) => ({
2035
+ kind: "diff",
2036
+ ...file
2037
+ })),
2038
+ isExpanded: props.isExpanded,
2039
+ onToggleExpanded: props.onToggleExpanded,
2040
+ initialScrollTop: props.initialScrollTop,
2041
+ onScroll: props.onScroll,
2042
+ renderFile: (file, heading, expanded, contentId) => {
2043
+ if (file.kind !== "diff") throw new Error("Git files require diff metadata");
2044
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GitFile, {
2045
+ ...props,
2046
+ file,
2047
+ heading,
2048
+ contentId,
2049
+ expanded,
2050
+ wrapped,
2051
+ toggleWrap,
2052
+ onQuote
2053
+ });
2054
+ }
2055
+ });
2056
+ }
2057
+ function GitFile({ view, revision, api, sessionId, file, heading, contentId, expanded, wrapped, toggleWrap, onQuote }) {
2058
+ const { result, retry } = useLazyFile((0, react.useCallback)((signal) => {
2059
+ return api.file(sessionId, view.snapshot, file.path, signal);
2060
+ }, [
2061
+ api,
2062
+ sessionId,
2063
+ view.snapshot,
2064
+ file.path,
2065
+ revision
2066
+ ]), expanded);
2067
+ const contents = result.value;
2068
+ const patch = (0, react.useMemo)(() => {
2069
+ if (contents === null || contents.kind !== "text") return null;
2070
+ return createUnifiedDiff(file.path, contents.before, contents.after);
2071
+ }, [contents, file.path]);
2072
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileReview, {
2073
+ heading,
2074
+ expanded,
2075
+ wrapped,
2076
+ toggleWrap,
2077
+ actions: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
2078
+ label: "Quote diff to chat",
2079
+ portal: true,
2080
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2081
+ size: "sm",
2082
+ variant: "ghost",
2083
+ "aria-label": `Quote diff ${file.path}`,
2084
+ onClick: () => {
2085
+ if (patch !== null) onQuote({
2086
+ text: patch,
2087
+ path: file.path
2088
+ });
2089
+ else onQuote({
2090
+ text: file.path,
2091
+ path: file.path
2092
+ });
2093
+ },
2094
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconNewChatOutlineRegular, { className: _git_diff_pane_css_default.icon })
2095
+ })
2096
+ })
2097
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
2098
+ id: contentId,
2099
+ className: _git_diff_pane_css_default.fileBody,
2100
+ "aria-label": `File diff ${file.path}`,
2101
+ hidden: !expanded,
2102
+ children: expanded && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeFileView, {
2103
+ path: file.path,
2104
+ code: patch,
2105
+ diff: true,
2106
+ wrapped,
2107
+ result,
2108
+ onRetry: retry,
2109
+ onQuote,
2110
+ extra: contents !== null && contents.kind === "unavailable" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
2111
+ className: _git_diff_pane_css_default.note,
2112
+ children: [
2113
+ file.path,
2114
+ ": ",
2115
+ contents.message
2116
+ ]
2117
+ }) : null
2118
+ })
2119
+ })] });
2120
+ }
2121
+ // ../util-review-ui/src/client/relativeTime.ts
2122
+ const relativeFormat = new Intl.RelativeTimeFormat("en", {
2123
+ style: "short",
2124
+ numeric: "always"
2125
+ });
2126
+ function formatRelativeTime(timestamp) {
2127
+ const age = (0, _deepseek_ai_dsh_client_ui_primitives.relativeTime)(timestamp, Date.now());
2128
+ return age.unit === "now" ? "just now" : relativeFormat.format(-age.n, {
2129
+ minutes: "minute",
2130
+ hours: "hour",
2131
+ days: "day",
2132
+ months: "month",
2133
+ years: "year"
2134
+ }[age.unit]);
2135
+ }
2136
+ // ../util-review-ui/src/types.ts
2137
+ const MAX_BRANCH_AGE_MS = 6048e5;
2138
+ // src/client/useLoad.ts
2139
+ function useLoad(load) {
2140
+ const [result, setResult] = (0, react.useState)({ status: "loading" });
2141
+ (0, react.useEffect)(() => {
2142
+ const controller = new AbortController();
2143
+ setResult({ status: "loading" });
2144
+ load(controller.signal).then((result) => {
2145
+ if (!controller.signal.aborted) setResult(result.ok ? {
2146
+ status: "ready",
2147
+ value: result.value
2148
+ } : {
2149
+ status: "failed",
2150
+ message: result.error.message
2151
+ });
2152
+ }, (error) => {
2153
+ if (!controller.signal.aborted) setResult({
2154
+ status: "failed",
2155
+ message: error instanceof Error ? error.message : String(error)
2156
+ });
2157
+ });
2158
+ return () => controller.abort();
2159
+ }, [load]);
2160
+ return result;
2161
+ }
2162
+ // src/client/ReviewToolbar.tsx
2163
+ function ReviewToolbar({ catalog, activeRepository, onSelectRepository, selection, base, revision, select, api, sessionId, refresh }) {
2164
+ const [scopeOpen, setScopeOpen] = (0, react.useState)(false);
2165
+ const [repoOpen, setRepoOpen] = (0, react.useState)(false);
2166
+ const [baselineOpen, setBaselineOpen] = (0, react.useState)(false);
2167
+ const active = activeRepository;
2168
+ const allBranches = active !== null ? active.branches.filter((branch) => branch.ref.startsWith("refs/heads/")) : [];
2169
+ const branches = allBranches.filter((branch) => Date.now() - branch.modifiedAt <= MAX_BRANCH_AGE_MS);
2170
+ const options = [...active !== null ? [
2171
+ ...allBranches.map((branch) => ({
2172
+ id: branch.ref,
2173
+ label: branch.label,
2174
+ disabled: false,
2175
+ value: {
2176
+ kind: "branch",
2177
+ repository: active.cwd,
2178
+ ref: branch.ref,
2179
+ base: { kind: "automatic" },
2180
+ revision: { kind: "all-commits" }
2181
+ }
2182
+ })),
2183
+ {
2184
+ id: "staged",
2185
+ label: "Staged changes",
2186
+ value: {
2187
+ kind: "uncommitted",
2188
+ repository: active.cwd,
2189
+ stage: "staged"
2190
+ },
2191
+ disabled: false
2192
+ },
2193
+ {
2194
+ id: "unstaged",
2195
+ label: "Unstaged changes",
2196
+ value: {
2197
+ kind: "uncommitted",
2198
+ repository: active.cwd,
2199
+ stage: "unstaged"
2200
+ },
2201
+ disabled: false
2202
+ }
2203
+ ] : []];
2204
+ const selectedId = selection === null ? "" : selection.kind === "branch" ? selection.ref : selection.stage;
2205
+ const selectedOption = options.find((option) => option.id === selectedId);
2206
+ const scopeLabel = selectedOption === void 0 ? "Select scope" : selectedOption.label;
2207
+ const selectedBaseline = active === null ? void 0 : active.baselines.find((item) => item.ref === base);
2208
+ const baselineLabel = selectedBaseline === void 0 ? "Baseline" : selectedBaseline.label;
2209
+ const cwd = active !== null ? active.cwd : catalog === null ? "Repository" : catalog.kind === "git" ? catalog.repository.cwd : catalog.cwd;
2210
+ const nameOf = (path) => path.slice(Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1);
2211
+ const name = nameOf(cwd);
2212
+ let context = "";
2213
+ if (active !== null) {
2214
+ const comparisonBase = selection !== null && selection.kind === "branch" ? base : active.target;
2215
+ const baseline = active.baselines.find((item) => item.ref === comparisonBase);
2216
+ if (baseline !== void 0) context = `vs ${baseline.label}`;
2217
+ }
2218
+ if (selection !== null && selection.kind === "uncommitted") context = selection.stage === "staged" ? "HEAD → Index" : "Index → Working tree";
2219
+ const isMultiRepo = catalog !== null && catalog.kind === "git" && catalog.repositories.length > 1;
2220
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2221
+ className: _git_diff_pane_css_default.header,
2222
+ children: [
2223
+ isMultiRepo && active !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
2224
+ open: repoOpen,
2225
+ onClose: () => setRepoOpen(false),
2226
+ selectedId: active.cwd,
2227
+ portal: true,
2228
+ compact: true,
2229
+ autoFocus: true,
2230
+ className: _git_diff_pane_css_default.scopePicker,
2231
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2232
+ size: "sm",
2233
+ variant: "ghost",
2234
+ className: _git_diff_pane_css_default.branchButton,
2235
+ "aria-label": "Repository",
2236
+ "aria-haspopup": "menu",
2237
+ "aria-expanded": repoOpen,
2238
+ title: active.cwd,
2239
+ onClick: () => setRepoOpen(!repoOpen),
2240
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2241
+ className: _git_diff_pane_css_default.truncate,
2242
+ children: nameOf(active.cwd) === "" ? active.cwd : nameOf(active.cwd)
2243
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { className: _git_diff_pane_css_default.icon })]
2244
+ }),
2245
+ items: catalog.repositories.map((repo) => ({
2246
+ id: repo.cwd,
2247
+ label: nameOf(repo.cwd) === "" ? repo.cwd : nameOf(repo.cwd)
2248
+ })),
2249
+ onSelect: (id) => {
2250
+ onSelectRepository(id);
2251
+ setRepoOpen(false);
2252
+ }
2253
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
2254
+ label: cwd,
2255
+ side: "bottom",
2256
+ portal: true,
2257
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2258
+ className: _git_diff_pane_css_default.repositoryName,
2259
+ children: name === "" ? cwd : name
2260
+ })
2261
+ }),
2262
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
2263
+ open: scopeOpen,
2264
+ onClose: () => setScopeOpen(false),
2265
+ selectedId,
2266
+ portal: true,
2267
+ compact: true,
2268
+ autoFocus: true,
2269
+ className: `${_git_diff_pane_css_default.scopePicker} ${_git_diff_pane_css_default.scopeSelector}`,
2270
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2271
+ size: "sm",
2272
+ variant: "ghost",
2273
+ className: _git_diff_pane_css_default.branchButton,
2274
+ "aria-label": "Scope",
2275
+ "aria-haspopup": "menu",
2276
+ "aria-expanded": scopeOpen,
2277
+ title: scopeLabel,
2278
+ onClick: () => setScopeOpen(!scopeOpen),
2279
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2280
+ className: _git_diff_pane_css_default.truncate,
2281
+ children: scopeLabel
2282
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { className: _git_diff_pane_css_default.icon })]
2283
+ }),
2284
+ items: [
2285
+ {
2286
+ type: "label",
2287
+ id: "branches-label",
2288
+ text: "Branches"
2289
+ },
2290
+ ...branches.map((branch) => ({
2291
+ id: branch.ref,
2292
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BranchLabel, {
2293
+ name: branch.label,
2294
+ modifiedAt: branch.modifiedAt
2295
+ })
2296
+ })),
2297
+ {
2298
+ type: "separator",
2299
+ id: "working-divider"
2300
+ },
2301
+ {
2302
+ type: "label",
2303
+ id: "working-label",
2304
+ text: "Working tree"
2305
+ },
2306
+ ...options.filter((item) => item.value.kind === "uncommitted").map(({ id, label, disabled }) => ({
2307
+ id,
2308
+ label,
2309
+ disabled
2310
+ }))
2311
+ ],
2312
+ onSelect: (id) => {
2313
+ const option = options.find((item) => item.id === id);
2314
+ if (option === void 0) throw new Error("Scope must exist");
2315
+ select(option.value);
2316
+ setScopeOpen(false);
2317
+ }
2318
+ }),
2319
+ selection !== null && selection.kind === "branch" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommitPicker, {
2320
+ api,
2321
+ sessionId,
2322
+ selection: {
2323
+ ...selection,
2324
+ base
2325
+ },
2326
+ revision,
2327
+ selectRevision: (revision) => select({
2328
+ ...selection,
2329
+ revision
2330
+ })
2331
+ }, `${selection.ref}:${base}`),
2332
+ selection !== null && selection.kind === "branch" && active !== null && (selection.base.kind === "manual" || base === "") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
2333
+ open: baselineOpen,
2334
+ onClose: () => setBaselineOpen(false),
2335
+ selectedId: base,
2336
+ portal: true,
2337
+ compact: true,
2338
+ autoFocus: true,
2339
+ className: _git_diff_pane_css_default.scopePicker,
2340
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2341
+ size: "sm",
2342
+ variant: "ghost",
2343
+ className: _git_diff_pane_css_default.branchButton,
2344
+ "aria-label": "Baseline",
2345
+ "aria-haspopup": "menu",
2346
+ "aria-expanded": baselineOpen,
2347
+ title: baselineLabel,
2348
+ onClick: () => setBaselineOpen(!baselineOpen),
2349
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2350
+ className: _git_diff_pane_css_default.truncate,
2351
+ children: baselineLabel
2352
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { className: _git_diff_pane_css_default.icon })]
2353
+ }),
2354
+ items: active.baselines.map((item) => ({
2355
+ id: item.ref,
2356
+ label: item.label
2357
+ })),
2358
+ onSelect: (id) => {
2359
+ select({
2360
+ ...selection,
2361
+ base: {
2362
+ kind: "manual",
2363
+ ref: id
2364
+ },
2365
+ revision: { kind: "all-commits" }
2366
+ });
2367
+ setBaselineOpen(false);
2368
+ }
2369
+ }),
2370
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2371
+ className: _git_diff_pane_css_default.baseline,
2372
+ title: context,
2373
+ children: context
2374
+ }),
2375
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
2376
+ label: "Refresh",
2377
+ side: "bottom",
2378
+ align: "end",
2379
+ portal: true,
2380
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2381
+ size: "sm",
2382
+ variant: "ghost",
2383
+ "aria-label": "Refresh",
2384
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, { className: _git_diff_pane_css_default.icon }),
2385
+ onClick: refresh
2386
+ })
2387
+ })
2388
+ ]
2389
+ });
2390
+ }
2391
+ function BranchLabel({ name, modifiedAt }) {
2392
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2393
+ className: _git_diff_pane_css_default.branchMenuLabel,
2394
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2395
+ className: _git_diff_pane_css_default.truncate,
2396
+ children: name
2397
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
2398
+ className: _git_diff_pane_css_default.meta,
2399
+ dateTime: new Date(modifiedAt).toISOString(),
2400
+ title: `Latest commit: ${new Date(modifiedAt).toLocaleString()}`,
2401
+ children: formatRelativeTime(modifiedAt)
2402
+ })]
2403
+ });
2404
+ }
2405
+ function CommitPicker({ api, sessionId, selection, revision, selectRevision }) {
2406
+ const [offset, setOffset] = (0, react.useState)(0);
2407
+ const [open, setOpen] = (0, react.useState)(false);
2408
+ const result = useLoad((0, react.useCallback)((signal) => {
2409
+ return selection.base === "" ? Promise.resolve({
2410
+ ok: true,
2411
+ value: {
2412
+ commits: [],
2413
+ hasMore: false
2414
+ }
2415
+ }) : api.commits(sessionId, selection.repository, selection.ref, selection.base, offset, signal);
2416
+ }, [
2417
+ api,
2418
+ sessionId,
2419
+ selection.repository,
2420
+ selection.ref,
2421
+ selection.base,
2422
+ offset,
2423
+ revision
2424
+ ]));
2425
+ const label = selection.revision.kind === "all-commits" ? "All commits" : `${selection.revision.commit.sha.slice(0, 8)} ${selection.revision.commit.subject}`;
2426
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
2427
+ open,
2428
+ onClose: () => setOpen(false),
2429
+ selectedId: selection.revision.kind === "all-commits" ? "all" : selection.revision.commit.sha,
2430
+ portal: true,
2431
+ compact: true,
2432
+ autoFocus: true,
2433
+ className: _git_diff_pane_css_default.scopePicker,
2434
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2435
+ size: "sm",
2436
+ variant: "ghost",
2437
+ className: _git_diff_pane_css_default.branchButton,
2438
+ "aria-label": "Commit",
2439
+ "aria-haspopup": "menu",
2440
+ "aria-expanded": open,
2441
+ title: label,
2442
+ disabled: selection.base === "",
2443
+ onClick: () => setOpen(!open),
2444
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2445
+ className: _git_diff_pane_css_default.truncate,
2446
+ children: label
2447
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { className: _git_diff_pane_css_default.icon })]
2448
+ }),
2449
+ items: [{
2450
+ id: "all",
2451
+ label: "All commits"
2452
+ }, ...result.status === "ready" ? result.value.commits.length === 0 ? [{
2453
+ type: "label",
2454
+ id: "empty",
2455
+ text: "No commits on this branch"
2456
+ }] : result.value.commits.map((commit) => ({
2457
+ id: commit.sha,
2458
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2459
+ className: _git_diff_pane_css_default.commitLabel,
2460
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2461
+ className: _git_diff_pane_css_default.truncate,
2462
+ children: commit.subject
2463
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2464
+ className: _git_diff_pane_css_default.meta,
2465
+ children: [
2466
+ commit.sha.slice(0, 8),
2467
+ " · ",
2468
+ commit.author,
2469
+ " ·",
2470
+ " ",
2471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
2472
+ dateTime: commit.date,
2473
+ title: new Date(commit.date).toLocaleString(),
2474
+ children: formatRelativeTime(Date.parse(commit.date))
2475
+ })
2476
+ ]
2477
+ })]
2478
+ })
2479
+ })) : [{
2480
+ type: "label",
2481
+ id: "status",
2482
+ text: result.status === "loading" ? "Loading commits…" : result.message
2483
+ }]],
2484
+ footer: result.status === "ready" && result.value.commits.length > 0 ? [{
2485
+ id: "previous",
2486
+ label: "Previous commits",
2487
+ disabled: offset === 0
2488
+ }, {
2489
+ id: "more",
2490
+ label: "More commits",
2491
+ disabled: !result.value.hasMore
2492
+ }] : [],
2493
+ onSelect: (id) => {
2494
+ if (id === "previous") setOffset(offset - 50);
2495
+ else if (id === "more") setOffset(offset + 50);
2496
+ else {
2497
+ if (id === "all") selectRevision({ kind: "all-commits" });
2498
+ else {
2499
+ if (result.status !== "ready") throw new Error("Commits must be loaded");
2500
+ const commit = result.value.commits.find((item) => item.sha === id);
2501
+ if (commit === void 0) throw new Error("Commit must exist");
2502
+ selectRevision({
2503
+ kind: "commit",
2504
+ commit
2505
+ });
2506
+ }
2507
+ setOpen(false);
2508
+ }
2509
+ }
2510
+ });
2511
+ }
2512
+ // src/client/reviewSelection.ts
2513
+ function resolveReviewBaseline(scope, catalog) {
2514
+ if (scope === null || scope.kind !== "branch") return "";
2515
+ if (scope.base.kind === "manual") return scope.base.ref;
2516
+ if (catalog === null || catalog.kind !== "git") return "";
2517
+ const repo = catalog.repositories.find((r) => r.cwd === scope.repository);
2518
+ if (repo === void 0) return "";
2519
+ const branch = repo.branches.find((branch) => branch.ref === scope.ref);
2520
+ return branch === void 0 || branch.base === null ? "" : branch.base;
2521
+ }
2522
+ // src/client/useReviewViewState.ts
2523
+ /** @internal */
2524
+ const REVIEW_STORAGE_PREFIX = "dsh-client-review-git:state:v1:";
2525
+ function isReviewScope(val) {
2526
+ if (!val || typeof val !== "object") return false;
2527
+ const obj = val;
2528
+ if (typeof obj.repository !== "string") return false;
2529
+ if (obj.kind === "uncommitted") return obj.stage === "staged" || obj.stage === "unstaged";
2530
+ if (obj.kind === "branch") return typeof obj.ref === "string" && Boolean(obj.base) && Boolean(obj.revision);
2531
+ return false;
2532
+ }
2533
+ /** @internal */
2534
+ function readPersistedReviewState(sessionId) {
2535
+ if (typeof localStorage === "undefined") return null;
2536
+ try {
2537
+ const raw = localStorage.getItem(`${REVIEW_STORAGE_PREFIX}${sessionId}`);
2538
+ if (!raw) return null;
2539
+ const parsed = JSON.parse(raw);
2540
+ if (parsed.version !== 1) return null;
2541
+ if (typeof parsed.updatedAt !== "number" || !Number.isFinite(parsed.updatedAt) || Date.now() - parsed.updatedAt > 864e5) {
2542
+ localStorage.removeItem(`${REVIEW_STORAGE_PREFIX}${sessionId}`);
2543
+ return null;
2544
+ }
2545
+ return {
2546
+ version: 1,
2547
+ selectedRepoCwd: typeof parsed.selectedRepoCwd === "string" ? parsed.selectedRepoCwd : null,
2548
+ scope: isReviewScope(parsed.scope) ? parsed.scope : null,
2549
+ expandedPaths: Array.isArray(parsed.expandedPaths) ? parsed.expandedPaths.filter((p) => typeof p === "string") : [],
2550
+ scrollTop: typeof parsed.scrollTop === "number" ? parsed.scrollTop : 0,
2551
+ wrapped: Boolean(parsed.wrapped),
2552
+ updatedAt: parsed.updatedAt
2553
+ };
2554
+ } catch {
2555
+ return null;
2556
+ }
2557
+ }
2558
+ /** @internal */
2559
+ function writePersistedReviewState(sessionId, state) {
2560
+ if (typeof localStorage === "undefined") return;
2561
+ try {
2562
+ const payload = {
2563
+ version: 1,
2564
+ selectedRepoCwd: state.selectedRepoCwd,
2565
+ scope: state.scope,
2566
+ expandedPaths: state.expandedPaths,
2567
+ scrollTop: state.scrollTop,
2568
+ wrapped: state.wrapped,
2569
+ updatedAt: Date.now()
2570
+ };
2571
+ localStorage.setItem(`${REVIEW_STORAGE_PREFIX}${sessionId}`, JSON.stringify(payload));
2572
+ } catch {}
2573
+ }
2574
+ function useReviewViewState(sessionId, initialScope) {
2575
+ const [initialState] = (0, react.useState)(() => readPersistedReviewState(sessionId));
2576
+ const isScopeOverridden = initialScope !== void 0 && initialState?.scope !== null && initialState?.scope !== void 0 && (initialState.scope.kind !== initialScope.kind || initialState.scope.repository !== initialScope.repository || initialState.scope.kind === "branch" && initialScope.kind === "branch" && initialState.scope.ref !== initialScope.ref);
2577
+ const [selectedRepoCwd, setSelectedRepoCwd] = (0, react.useState)(() => initialScope !== void 0 ? initialScope.repository : initialState?.selectedRepoCwd ?? null);
2578
+ const [scope, setScope] = (0, react.useState)(() => initialScope ?? initialState?.scope ?? null);
2579
+ const [expandedPaths, setExpandedPaths] = (0, react.useState)(() => isScopeOverridden ? /* @__PURE__ */ new Set() : new Set(initialState?.expandedPaths ?? []));
2580
+ const [wrapped, setWrapped] = (0, react.useState)(() => initialState?.wrapped ?? false);
2581
+ const scrollTopRef = (0, react.useRef)(isScopeOverridden ? 0 : initialState?.scrollTop ?? 0);
2582
+ const debounceTimerRef = (0, react.useRef)(null);
2583
+ const isFirstMountRef = (0, react.useRef)(true);
2584
+ const stateRef = (0, react.useRef)({
2585
+ selectedRepoCwd,
2586
+ scope,
2587
+ expandedPaths,
2588
+ scrollTop: scrollTopRef.current,
2589
+ wrapped
2590
+ });
2591
+ stateRef.current = {
2592
+ selectedRepoCwd,
2593
+ scope,
2594
+ expandedPaths,
2595
+ scrollTop: scrollTopRef.current,
2596
+ wrapped
2597
+ };
2598
+ const persist = (0, react.useCallback)(() => {
2599
+ writePersistedReviewState(sessionId, {
2600
+ selectedRepoCwd: stateRef.current.selectedRepoCwd,
2601
+ scope: stateRef.current.scope,
2602
+ expandedPaths: Array.from(stateRef.current.expandedPaths),
2603
+ scrollTop: stateRef.current.scrollTop,
2604
+ wrapped: stateRef.current.wrapped
2605
+ });
2606
+ }, [sessionId]);
2607
+ const debouncedPersist = (0, react.useCallback)(() => {
2608
+ if (debounceTimerRef.current !== null) clearTimeout(debounceTimerRef.current);
2609
+ debounceTimerRef.current = setTimeout(() => {
2610
+ debounceTimerRef.current = null;
2611
+ persist();
2612
+ }, 100);
2613
+ }, [persist]);
2614
+ (0, react.useEffect)(() => {
2615
+ if (isFirstMountRef.current) {
2616
+ isFirstMountRef.current = false;
2617
+ if (!isScopeOverridden) return;
2618
+ }
2619
+ persist();
2620
+ }, [
2621
+ selectedRepoCwd,
2622
+ scope,
2623
+ expandedPaths,
2624
+ wrapped,
2625
+ persist,
2626
+ isScopeOverridden
2627
+ ]);
2628
+ (0, react.useEffect)(() => {
2629
+ return () => {
2630
+ if (debounceTimerRef.current !== null) {
2631
+ clearTimeout(debounceTimerRef.current);
2632
+ persist();
2633
+ }
2634
+ };
2635
+ }, [persist]);
2636
+ const isPathExpanded = (0, react.useCallback)((path) => {
2637
+ return expandedPaths.has(path);
2638
+ }, [expandedPaths]);
2639
+ const togglePathExpanded = (0, react.useCallback)((path, expand) => {
2640
+ setExpandedPaths((prev) => {
2641
+ const next = new Set(prev);
2642
+ if (expand ?? !next.has(path)) next.add(path);
2643
+ else next.delete(path);
2644
+ return next;
2645
+ });
2646
+ }, []);
2647
+ const setScrollTop = (0, react.useCallback)((top) => {
2648
+ scrollTopRef.current = top;
2649
+ debouncedPersist();
2650
+ }, [debouncedPersist]);
2651
+ const toggleWrapped = (0, react.useCallback)(() => {
2652
+ setWrapped((w) => !w);
2653
+ }, []);
2654
+ return {
2655
+ selectedRepoCwd,
2656
+ setSelectedRepoCwd,
2657
+ scope,
2658
+ setScope,
2659
+ expandedPaths,
2660
+ isPathExpanded,
2661
+ setPathExpanded: togglePathExpanded,
2662
+ togglePathExpanded,
2663
+ scrollTop: scrollTopRef.current,
2664
+ setScrollTop,
2665
+ wrapped,
2666
+ toggleWrapped
2667
+ };
2668
+ }
2669
+ // src/client/GitDiffPane.tsx
2670
+ function GitDiffPane(props) {
2671
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReviewPane, { ...props }, props.sessionId);
2672
+ }
2673
+ function ReviewPane({ sessionId, api, inputActions, scope: initialScope }) {
2674
+ const [revision, setRevision] = (0, react.useState)(0);
2675
+ const reviewState = useReviewViewState(sessionId, initialScope);
2676
+ const { selectedRepoCwd, setSelectedRepoCwd, scope, setScope: select } = reviewState;
2677
+ const catalogResult = useLoad((0, react.useCallback)((signal) => {
2678
+ return api.catalog(sessionId, signal);
2679
+ }, [
2680
+ api,
2681
+ sessionId,
2682
+ revision
2683
+ ]));
2684
+ const [previousCatalog, setPreviousCatalog] = (0, react.useState)(null);
2685
+ (0, react.useEffect)(() => {
2686
+ if (catalogResult.status === "ready") setPreviousCatalog(catalogResult);
2687
+ }, [catalogResult]);
2688
+ const catalog = catalogResult.status === "ready" || previousCatalog === null ? catalogResult : previousCatalog;
2689
+ const activeRepository = catalog.status === "ready" && catalog.value.kind === "git" ? catalog.value.repositories.find((r) => r.cwd === selectedRepoCwd) ?? catalog.value.repository : null;
2690
+ const onSelectRepository = (cwd) => {
2691
+ setSelectedRepoCwd(cwd);
2692
+ if (scope !== null) select(null);
2693
+ };
2694
+ const base = resolveReviewBaseline(scope, catalog.status === "ready" ? catalog.value : null);
2695
+ const selection = (0, react.useMemo)(() => scope === null || scope.kind !== "branch" ? scope : {
2696
+ ...scope,
2697
+ base
2698
+ }, [scope, base]);
2699
+ const refresh = () => setRevision((value) => value + 1);
2700
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2701
+ className: _git_diff_pane_css_default.root,
2702
+ children: [
2703
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: cssText }),
2704
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReviewToolbar, {
2705
+ catalog: catalog.status === "ready" ? catalog.value : null,
2706
+ activeRepository,
2707
+ onSelectRepository,
2708
+ selection: scope,
2709
+ base,
2710
+ revision,
2711
+ select,
2712
+ api,
2713
+ sessionId,
2714
+ refresh
2715
+ }),
2716
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2717
+ className: _git_diff_pane_css_default.body,
2718
+ children: [catalogResult.status === "failed" && previousCatalog !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2719
+ className: _git_diff_pane_css_default.error,
2720
+ role: "alert",
2721
+ children: catalogResult.message
2722
+ }), catalog.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2723
+ className: _git_diff_pane_css_default.note,
2724
+ role: "status",
2725
+ children: "Loading repository…"
2726
+ }) : catalog.status === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2727
+ className: _git_diff_pane_css_default.error,
2728
+ role: "alert",
2729
+ children: catalog.message
2730
+ }) : catalog.value.kind === "unavailable" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
2731
+ className: _git_diff_pane_css_default.note,
2732
+ children: [
2733
+ "Git unavailable: ",
2734
+ catalog.value.message,
2735
+ "."
2736
+ ]
2737
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2738
+ activeRepository !== null && activeRepository.gitbutlerError !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
2739
+ className: _git_diff_pane_css_default.note,
2740
+ children: [
2741
+ "GitButler metadata unavailable:",
2742
+ " ",
2743
+ activeRepository.gitbutlerError
2744
+ ]
2745
+ }),
2746
+ activeRepository !== null && activeRepository.branches.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2747
+ className: _git_diff_pane_css_default.note,
2748
+ children: "No branches found."
2749
+ }),
2750
+ selection === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2751
+ className: _git_diff_pane_css_default.note,
2752
+ children: "Choose a review scope."
2753
+ }) : selection.kind === "branch" && selection.base === "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2754
+ className: _git_diff_pane_css_default.note,
2755
+ children: "Choose the repository's default branch to compare."
2756
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comparison, {
2757
+ revision,
2758
+ api,
2759
+ sessionId,
2760
+ selection,
2761
+ inputActions,
2762
+ isExpanded: reviewState.isPathExpanded,
2763
+ onToggleExpanded: reviewState.setPathExpanded,
2764
+ initialScrollTop: reviewState.scrollTop,
2765
+ onScroll: reviewState.setScrollTop,
2766
+ wrapped: reviewState.wrapped,
2767
+ toggleWrap: reviewState.toggleWrapped
2768
+ }, JSON.stringify(selection))
2769
+ ] })]
2770
+ })
2771
+ ]
2772
+ });
2773
+ }
2774
+ function Comparison({ revision, api, sessionId, selection, inputActions, isExpanded, onToggleExpanded, initialScrollTop, onScroll, wrapped, toggleWrap }) {
2775
+ const current = useLoad((0, react.useCallback)(async (signal) => {
2776
+ const result = await api.view(sessionId, selection, signal);
2777
+ return result.ok ? {
2778
+ ok: true,
2779
+ value: {
2780
+ revision,
2781
+ result: result.value
2782
+ }
2783
+ } : result;
2784
+ }, [
2785
+ api,
2786
+ sessionId,
2787
+ selection,
2788
+ revision
2789
+ ]));
2790
+ const [previous, setPrevious] = (0, react.useState)(null);
2791
+ (0, react.useEffect)(() => {
2792
+ if (current.status === "ready") setPrevious(current);
2793
+ }, [current]);
2794
+ const result = current.status === "ready" || previous === null ? current : previous;
2795
+ if (result.status === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2796
+ className: _git_diff_pane_css_default.note,
2797
+ role: "status",
2798
+ children: "Loading diff…"
2799
+ });
2800
+ if (result.status === "failed") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2801
+ className: _git_diff_pane_css_default.error,
2802
+ role: "alert",
2803
+ children: result.message
2804
+ });
2805
+ if (result.value.result.kind !== "diff") throw new Error("Git scopes must produce a diff");
2806
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [current.status === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2807
+ className: _git_diff_pane_css_default.error,
2808
+ role: "alert",
2809
+ children: current.message
2810
+ }), result.value.result.view.diffs.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2811
+ className: _git_diff_pane_css_default.note,
2812
+ children: "No file differences found."
2813
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileInspector, {
2814
+ revision: result.value.revision,
2815
+ view: result.value.result.view,
2816
+ api,
2817
+ sessionId,
2818
+ inputActions,
2819
+ isExpanded,
2820
+ onToggleExpanded,
2821
+ initialScrollTop,
2822
+ onScroll,
2823
+ wrapped,
2824
+ toggleWrap
2825
+ })] });
2826
+ }
2827
+ // ../util-review-ui/src/client/ReviewCard.tsx
2828
+ /**
2829
+ * Render one review card in the transcript's turn tail.
2830
+ * @param props - branch, commit line, and optional open action.
2831
+ * @returns the card row.
2832
+ */
2833
+ function ReviewCard({ title, description, onOpen }) {
2834
+ const { copied, onCopy } = (0, _deepseek_ai_dsh_client_ui_primitives.useClipboardCopy)(title);
2835
+ const handleCardClick = () => {
2836
+ if (onOpen !== void 0) onOpen();
2837
+ };
2838
+ const handleCardKeyDown = (e) => {
2839
+ if (onOpen !== void 0 && (e.key === "Enter" || e.key === " ")) {
2840
+ e.preventDefault();
2841
+ onOpen();
2842
+ }
2843
+ };
2844
+ const handleCopyClick = (e) => {
2845
+ e.stopPropagation();
2846
+ const selection = window.getSelection()?.toString();
2847
+ if (selection && selection.length > 0) return;
2848
+ onCopy();
2849
+ };
2850
+ const handleCopyKeyDown = (e) => {
2851
+ if (e.key === "Enter" || e.key === " ") {
2852
+ e.preventDefault();
2853
+ e.stopPropagation();
2854
+ onCopy();
2855
+ }
2856
+ };
2857
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2858
+ className: _git_diff_pane_css_default.reviewCard,
2859
+ "data-review-card": true,
2860
+ "data-clickable": onOpen !== void 0 ? "true" : void 0,
2861
+ onClick: onOpen !== void 0 ? handleCardClick : void 0,
2862
+ onKeyDown: onOpen !== void 0 ? handleCardKeyDown : void 0,
2863
+ tabIndex: onOpen !== void 0 ? 0 : void 0,
2864
+ role: onOpen !== void 0 ? "button" : void 0,
2865
+ children: [
2866
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: cssText }),
2867
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2868
+ className: _git_diff_pane_css_default.reviewIcon,
2869
+ "aria-hidden": true,
2870
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { size: 20 })
2871
+ }),
2872
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2873
+ className: _git_diff_pane_css_default.reviewDetails,
2874
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2875
+ className: _git_diff_pane_css_default.reviewTitle,
2876
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2877
+ className: _git_diff_pane_css_default.reviewBranchCopy,
2878
+ "data-branch-copy": true,
2879
+ "data-copied": copied ? "true" : void 0,
2880
+ title: copied ? "Copied branch name" : `Click to copy branch name: ${title}`,
2881
+ onClick: handleCopyClick,
2882
+ onKeyDown: handleCopyKeyDown,
2883
+ tabIndex: 0,
2884
+ role: "button",
2885
+ "aria-label": copied ? "Copied branch name" : `Copy branch name: ${title}`,
2886
+ children: [
2887
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2888
+ className: _git_diff_pane_css_default.reviewBranchName,
2889
+ children: title
2890
+ }),
2891
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2892
+ className: _git_diff_pane_css_default.reviewCopyIcon,
2893
+ "aria-hidden": true,
2894
+ children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 13 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCopyOutlineRegular, { size: 13 })
2895
+ }),
2896
+ copied && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2897
+ className: _git_diff_pane_css_default.reviewCopyFeedback,
2898
+ children: "Copied!"
2899
+ })
2900
+ ]
2901
+ })
2902
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2903
+ className: _git_diff_pane_css_default.reviewDescription,
2904
+ title: description,
2905
+ children: description
2906
+ })]
2907
+ })
2908
+ ]
2909
+ });
2910
+ }
2911
+ // src/client/review-turn.ts
2912
+ const reviewScopeOrTargetSchema = zod.z.union([branchReviewScopeSchema, reviewTargetSchema]);
2913
+ function isBranchReviewScope(scope) {
2914
+ return "kind" in scope && scope.kind === "branch";
2915
+ }
2916
+ function parseTargetArgs(argsRaw) {
2917
+ try {
2918
+ const parsed = JSON.parse(argsRaw);
2919
+ const target = reviewTargetSchema.safeParse(parsed);
2920
+ return target.success ? target.data : null;
2921
+ } catch {
2922
+ return null;
2923
+ }
2924
+ }
2925
+ /**
2926
+ * Turn-local accumulator for presentation calls; it publishes no view Node.
2927
+ * The tool persists its target or scope on the successful `tool/result`, so a
2928
+ * resumed or replayed session rebuilds the same cards, deferring review scope
2929
+ * resolution to click time.
2930
+ */
2931
+ const gitReviewDefinition = {
2932
+ kind: "git-review",
2933
+ match: (event) => {
2934
+ if (event.type === "turn/start") return {
2935
+ id: String(event.data.turn),
2936
+ role: "start"
2937
+ };
2938
+ if (event.type === "command/run" && event.data.name === "git-review") try {
2939
+ const data = JSON.parse(event.data.args ?? "{}");
2940
+ return typeof data === "object" && data !== null && "turn" in data && typeof data.turn === "number" ? {
2941
+ id: String(data.turn),
2942
+ role: "update"
2943
+ } : null;
2944
+ } catch {
2945
+ return null;
2946
+ }
2947
+ if (event.type === "git-review/presented") {
2948
+ const data = event.data;
2949
+ return typeof data === "object" && data !== null && "turn" in data && typeof data.turn === "number" ? {
2950
+ id: String(data.turn),
2951
+ role: "update"
2952
+ } : null;
2953
+ }
2954
+ if (event.type === "tool/call") return event.data.name === "git_review_present" ? {
2955
+ id: String(event.data.turn),
2956
+ role: "update"
2957
+ } : null;
2958
+ if (event.type === "tool/result") return {
2959
+ id: String(event.data.turn),
2960
+ role: "update"
2961
+ };
2962
+ return null;
2963
+ },
2964
+ start: (_context, match) => {
2965
+ if (match.event.type !== "turn/start") throw new Error("git-review start requires turn/start");
2966
+ return {
2967
+ turn: match.event.data.turn,
2968
+ calls: /* @__PURE__ */ new Map(),
2969
+ reviews: []
2970
+ };
2971
+ },
2972
+ update: (context, match) => {
2973
+ const event = match.event;
2974
+ if (event.type === "command/run" && event.data.name === "git-review") {
2975
+ try {
2976
+ const data = JSON.parse(event.data.args ?? "{}");
2977
+ const parsed = reviewScopeOrTargetSchema.safeParse(data.target);
2978
+ if (parsed.success) {
2979
+ const id = data.callId ? String(data.callId) : `review-${event.seq}`;
2980
+ if (context.state.reviews.some((r) => r.id === id)) return context.state;
2981
+ return {
2982
+ ...context.state,
2983
+ reviews: [...context.state.reviews, {
2984
+ id,
2985
+ scope: parsed.data
2986
+ }]
2987
+ };
2988
+ }
2989
+ } catch {}
2990
+ return context.state;
2991
+ }
2992
+ if (event.type === "git-review/presented") {
2993
+ const data = event.data;
2994
+ const parsed = reviewScopeOrTargetSchema.safeParse(data.target);
2995
+ if (parsed.success) {
2996
+ const id = data.callId ? String(data.callId) : `review-${event.seq}`;
2997
+ if (context.state.reviews.some((r) => r.id === id)) return context.state;
2998
+ return {
2999
+ ...context.state,
3000
+ reviews: [...context.state.reviews, {
3001
+ id,
3002
+ scope: parsed.data
3003
+ }]
3004
+ };
3005
+ }
3006
+ return context.state;
3007
+ }
3008
+ if (event.type === "tool/call") {
3009
+ const calls = new Map(context.state.calls);
3010
+ calls.set(String(event.data.callId), parseTargetArgs(event.data.arguments));
3011
+ return {
3012
+ ...context.state,
3013
+ calls
3014
+ };
3015
+ }
3016
+ if (event.type !== "tool/result") return context.state;
3017
+ const callId = String(event.data.message.source.callId);
3018
+ if (!context.state.calls.has(callId)) return context.state;
3019
+ const calls = new Map(context.state.calls);
3020
+ const argumentTarget = calls.get(callId);
3021
+ calls.delete(callId);
3022
+ if (event.data.message.isError) return {
3023
+ ...context.state,
3024
+ calls
3025
+ };
3026
+ if (context.state.reviews.some((r) => r.id === callId)) return {
3027
+ ...context.state,
3028
+ calls
3029
+ };
3030
+ const parsed = reviewScopeOrTargetSchema.safeParse(event.data.meta);
3031
+ const scope = parsed.success ? parsed.data : argumentTarget;
3032
+ if (scope === null || scope === void 0) return {
3033
+ ...context.state,
3034
+ calls
3035
+ };
3036
+ return {
3037
+ ...context.state,
3038
+ calls,
3039
+ reviews: [...context.state.reviews, {
3040
+ id: callId,
3041
+ scope
3042
+ }]
3043
+ };
3044
+ },
3045
+ buildLocationData: (context, scope, previous) => {
3046
+ const state = context.state;
3047
+ if (scope !== "turn" || state === void 0) return null;
3048
+ if (previous?.kind === "turn" && previous.turn === state.turn && previous.key === "git-review" && previous.value.reviews === state.reviews) return previous;
3049
+ return {
3050
+ kind: "turn",
3051
+ turn: state.turn,
3052
+ key: "git-review",
3053
+ value: { reviews: state.reviews }
3054
+ };
3055
+ }
3056
+ };
3057
+ // src/client/GitReviewCard.tsx
3058
+ function extractToolCall(block, key) {
3059
+ if (!block || typeof block !== "object") return null;
3060
+ if ("isError" in block && Boolean(block.isError)) return null;
3061
+ const call = "call" in block && block.call ? block.call : "kind" in block && block.call ? block.call : block;
3062
+ const isRecord = (v) => typeof v === "object" && v !== null;
3063
+ if ((isRecord(call) && typeof call.name === "string" ? call.name : void 0) !== "git_review_present") return null;
3064
+ const argsRaw = isRecord(call) && typeof call.argsRaw === "string" ? call.argsRaw : void 0;
3065
+ if (typeof argsRaw !== "string") return null;
3066
+ try {
3067
+ const parsed = JSON.parse(argsRaw);
3068
+ const target = reviewScopeOrTargetSchema.safeParse(parsed);
3069
+ if (!target.success) return null;
3070
+ return {
3071
+ id: "callId" in block && typeof block.callId === "string" ? block.callId : isRecord(call) && typeof call.callId === "string" ? call.callId : key,
3072
+ scope: target.data
3073
+ };
3074
+ } catch {
3075
+ return null;
3076
+ }
3077
+ }
3078
+ function useResolvedReviews(props) {
3079
+ const manualReviews = "reviews" in props ? props.reviews : void 0;
3080
+ const turnDataReviews = "turn" in props && props.turn?.data !== void 0 ? props.turn.data.get("git-review")?.reviews ?? [] : [];
3081
+ const turnNumber = "turn" in props && props.turn !== void 0 ? typeof props.turn.turn === "number" ? props.turn.turn : void 0 : void 0;
3082
+ const useChat = "useChat" in props ? props.useChat : void 0;
3083
+ const fallbackReviews = useChat ? useChat((snapshot) => {
3084
+ if (manualReviews !== void 0 && manualReviews.length > 0 || turnDataReviews.length > 0 || turnNumber === void 0) return [];
3085
+ const keys = snapshot.locations.getTurn(turnNumber);
3086
+ const results = [];
3087
+ for (const key of keys) {
3088
+ const node = snapshot.nodes.get(key);
3089
+ if (node?.kind === "assistant-step") {
3090
+ const blocks = node.data?.blocks;
3091
+ if (Array.isArray(blocks)) for (const block of blocks) {
3092
+ const entry = extractToolCall(block, key);
3093
+ if (entry && !results.some((r) => r.id === entry.id)) results.push(entry);
3094
+ }
3095
+ }
3096
+ if (node?.kind === "tool-call") {
3097
+ const entry = extractToolCall(node.data?.root, key);
3098
+ if (entry && !results.some((r) => r.id === entry.id)) results.push(entry);
3099
+ }
3100
+ }
3101
+ return results;
3102
+ }) : [];
3103
+ if (manualReviews !== void 0 && manualReviews.length > 0) return manualReviews;
3104
+ if (turnDataReviews.length > 0) return turnDataReviews;
3105
+ return fallbackReviews;
3106
+ }
3107
+ /**
3108
+ * Render the persistent review card for a presented Git review target or scope.
3109
+ * Intended for turn-tail rendering so it remains visible after turn completion.
3110
+ * @param props - turn-tail runtime props and injected opener.
3111
+ * @returns the cards, or null when no review target is present.
3112
+ */
3113
+ function GitReviewCard(props) {
3114
+ const { sessionId, openReview, canOpen } = props;
3115
+ const reviews = useResolvedReviews(props);
3116
+ if (reviews.length === 0) return null;
3117
+ const hasOpener = canOpen !== void 0 ? canOpen() : openReview !== void 0;
3118
+ const onOpen = (scope) => hasOpener && openReview !== void 0 ? () => openReview(sessionId, scope) : void 0;
3119
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3120
+ className: _git_diff_pane_css_default.reviewCardList,
3121
+ "data-git-review-cards": true,
3122
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: cssText }), reviews.map((review) => {
3123
+ const scope = review.scope;
3124
+ let branch;
3125
+ let commitSha = null;
3126
+ let commitSubject = null;
3127
+ if (isBranchReviewScope(scope)) {
3128
+ branch = scope.ref;
3129
+ if (scope.revision.kind === "commit") {
3130
+ commitSha = scope.revision.commit.sha;
3131
+ commitSubject = scope.revision.commit.subject;
3132
+ }
3133
+ } else {
3134
+ branch = scope.branch;
3135
+ if (scope.commit !== void 0) commitSha = scope.commit;
3136
+ }
3137
+ const description = commitSha === null ? "All commits" : commitSubject !== null ? `${shortSha(commitSha)} — ${commitSubject}` : shortSha(commitSha);
3138
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReviewCard, {
3139
+ title: branchLabel(branch),
3140
+ description,
3141
+ onOpen: onOpen(review.scope)
3142
+ }, review.id);
3143
+ })]
3144
+ });
3145
+ }
3146
+ // src/client/GitReviewRow.tsx
3147
+ /* v8 ignore next */
3148
+ const noop = () => void 0;
3149
+ function formatTarget(argsRaw) {
3150
+ try {
3151
+ const parsed = JSON.parse(argsRaw);
3152
+ const target = reviewTargetSchema.safeParse(parsed);
3153
+ if (target.success) {
3154
+ const label = branchLabel(target.data.branch);
3155
+ return target.data.commit !== void 0 ? `${label} @ ${shortSha(target.data.commit)}` : label;
3156
+ }
3157
+ } catch {}
3158
+ return argsRaw;
3159
+ }
3160
+ function parseTarget(argsRaw) {
3161
+ try {
3162
+ const parsed = JSON.parse(argsRaw);
3163
+ const target = reviewTargetSchema.safeParse(parsed);
3164
+ return target.success ? target.data : void 0;
3165
+ } catch {
3166
+ return;
3167
+ }
3168
+ }
3169
+ /**
3170
+ * Render a git_review_present call during tool execution inside the process group.
3171
+ * @param props - tool call props.
3172
+ * @returns in-process disclosure row.
3173
+ */
3174
+ function GitReviewRow(props) {
3175
+ const { block, inspect, phase, openReview, canOpen, sessionId } = props;
3176
+ const [expanded, setExpanded] = (0, react.useState)(false);
3177
+ if (phase === "preparing") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3178
+ "data-tool": "git_review_present",
3179
+ "data-state": "preparing",
3180
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
3181
+ title: "Git Review",
3182
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { size: 14 }),
3183
+ open: false,
3184
+ expandable: false,
3185
+ onToggle: noop,
3186
+ running: true
3187
+ })
3188
+ });
3189
+ const settled = block && "kind" in block;
3190
+ const isError = block && "isError" in block && Boolean(block.isError);
3191
+ const error = block && "error" in block ? block.error : void 0;
3192
+ const state = !settled ? "running" : error?.code === "interrupted" ? "stopped" : isError ? "error" : "ok";
3193
+ const call = block && "call" in block ? block.call : block;
3194
+ const args = (call && "argsRaw" in call && typeof call.argsRaw === "string" ? call.argsRaw : void 0) ?? "";
3195
+ const details = (settled && "content" in block && Array.isArray(block.content) ? block.content.map((item) => item.type === "text" ? item.text : JSON.stringify(item)).join("\n") : "") || (settled && error ? `${error.name}: ${error.code}` : "");
3196
+ const target = parseTarget(args);
3197
+ const hasContent = details !== "" || target !== void 0;
3198
+ const hasOpener = canOpen !== void 0 ? canOpen() : openReview !== void 0;
3199
+ const onOpen = target && hasOpener && openReview !== void 0 && sessionId !== void 0 ? () => openReview(sessionId, target) : void 0;
3200
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3201
+ "data-tool": "git_review_present",
3202
+ "data-state": state,
3203
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
3204
+ title: "Git Review",
3205
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { size: 14 }),
3206
+ open: expanded && hasContent,
3207
+ expandable: hasContent,
3208
+ expandOnRowClick: true,
3209
+ keepContentWhenOpen: true,
3210
+ onToggle: () => {
3211
+ setExpanded((value) => !value);
3212
+ },
3213
+ collapsedContent: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3214
+ style: {
3215
+ marginLeft: 8,
3216
+ fontSize: 12,
3217
+ display: "flex",
3218
+ gap: 8,
3219
+ alignItems: "center"
3220
+ },
3221
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: formatTarget(args) })
3222
+ }),
3223
+ children: [
3224
+ details !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
3225
+ style: {
3226
+ margin: "8px 0",
3227
+ padding: 12,
3228
+ borderRadius: "var(--dsw-radius-lg)",
3229
+ background: "var(--dsw-alias-bg-layer-1)",
3230
+ color: "var(--dsw-alias-label-secondary)",
3231
+ whiteSpace: "pre-wrap",
3232
+ overflowWrap: "anywhere",
3233
+ fontSize: 12
3234
+ },
3235
+ children: details
3236
+ }),
3237
+ target && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3238
+ style: { marginTop: 8 },
3239
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: ".PVpF4W_root {\n min-width: 0;\n height: 100%;\n min-height: 0;\n color: var(--dsw-alias-label-primary);\n font-family: var(--dsw-font-family);\n font-size: var(--dsh-content-font-size-secondary);\n flex-direction: column;\n line-height: 1.5;\n display: flex;\n container: PVpF4W_git-diff / size;\n}\n\n.PVpF4W_header {\n box-sizing: border-box;\n background: var(--dsw-alias-bg-module-platform);\n border-bottom: .5px solid var(--dsw-alias-border-l2);\n flex: none;\n align-items: center;\n gap: 6px;\n min-width: 0;\n height: 35px;\n min-height: 35px;\n padding: 0 10px;\n display: flex;\n}\n\n.PVpF4W_repositoryName {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n color: var(--dsw-alias-label-secondary);\n flex: 1;\n font-size: 13px;\n font-weight: 500;\n display: block;\n overflow: hidden;\n}\n\n.PVpF4W_scopePicker {\n flex: 0 auto;\n min-width: 0;\n max-width: 240px;\n display: block;\n}\n\n.PVpF4W_scopeSelector {\n margin-inline-start: auto;\n}\n\n.PVpF4W_baselinePicker {\n border-radius: var(--dsw-radius-sm);\n min-width: 0;\n max-width: 120px;\n height: 26px;\n color: inherit;\n font: inherit;\n font-size: 13px;\n line-height: 26px;\n}\n\n.PVpF4W_body {\n flex-direction: column;\n flex: 1;\n gap: 8px;\n min-width: 0;\n min-height: 0;\n display: flex;\n overflow: hidden;\n}\n\n.PVpF4W_body > p {\n padding: 12px;\n}\n\n.PVpF4W_note, .PVpF4W_baseline {\n color: var(--dsw-alias-label-secondary);\n font: inherit;\n margin: 0;\n}\n\n.PVpF4W_error {\n color: var(--dsw-alias-state-error-primary);\n overflow-wrap: anywhere;\n margin: 0;\n}\n\n.PVpF4W_branchButton {\n border-radius: var(--dsw-radius-sm);\n justify-content: flex-start;\n width: auto;\n min-width: 0;\n max-width: 100%;\n height: 26px;\n padding-inline: 6px;\n font-size: 13px;\n}\n\n.PVpF4W_truncate, .PVpF4W_filename {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n overflow: hidden;\n}\n\n.PVpF4W_filename {\n flex: 0 auto;\n line-height: 20px;\n}\n\n.PVpF4W_baseline {\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: none;\n align-items: center;\n min-width: 0;\n max-width: 45%;\n height: 26px;\n font-size: 13px;\n line-height: 26px;\n display: inline-flex;\n overflow: hidden;\n}\n\n.PVpF4W_commitLabel {\n flex-direction: column;\n min-width: 0;\n display: flex;\n}\n\n.PVpF4W_branchMenuLabel {\n flex: 1;\n justify-content: space-between;\n align-items: center;\n gap: 20px;\n min-width: 0;\n display: flex;\n}\n\n.PVpF4W_branchMenuLabel time {\n white-space: nowrap;\n flex: none;\n}\n\n.PVpF4W_fileTreeScroll {\n overscroll-behavior: contain;\n flex: 1;\n min-width: 0;\n min-height: 0;\n overflow: auto;\n}\n\n.PVpF4W_directory {\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--dsw-alias-label-tertiary);\n cursor: pointer;\n padding: 5px 12px;\n overflow: hidden;\n}\n\n.PVpF4W_fileTree {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.PVpF4W_row {\n text-align: left;\n border-radius: 0;\n flex: 1;\n justify-content: flex-start;\n align-items: center;\n gap: 8px;\n min-width: 0;\n height: auto;\n min-height: 34px;\n padding: 4px 8px;\n}\n\n.PVpF4W_row time {\n white-space: nowrap;\n flex: none;\n line-height: 20px;\n}\n\n.PVpF4W_fileToolbar .PVpF4W_row:hover:not(:disabled), .PVpF4W_fileToolbar .PVpF4W_row:active:not(:disabled) {\n background: none;\n}\n\n.PVpF4W_disclosureOpen, .PVpF4W_disclosureClosed {\n transform-origin: center;\n flex: none;\n align-self: center;\n width: 14px;\n height: 14px;\n}\n\n.PVpF4W_disclosureClosed {\n transform: rotate(-90deg);\n}\n\n.PVpF4W_fileEntry {\n border-bottom: .5px solid var(--dsw-alias-border-l1);\n}\n\n.PVpF4W_fileBody {\n min-width: 0;\n}\n\n.PVpF4W_fileBody > p {\n padding: 8px 12px;\n}\n\n.PVpF4W_status {\n width: 1em;\n color: var(--dsw-alias-label-tertiary);\n flex: none;\n align-items: center;\n font-size: .9em;\n line-height: 20px;\n display: inline-flex;\n}\n\n.PVpF4W_lineCounts {\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n flex: none;\n align-items: center;\n gap: 6px;\n font-size: .9em;\n line-height: 20px;\n display: flex;\n}\n\n.PVpF4W_added {\n color: var(--dsw-alias-file-diff-added-marker);\n}\n\n.PVpF4W_visuallyHidden {\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n width: 1px;\n height: 1px;\n padding: 0;\n position: absolute;\n overflow: hidden;\n}\n\n.PVpF4W_deleted {\n color: var(--dsw-alias-file-diff-deleted-marker);\n}\n\n.PVpF4W_diffContent {\n --diffs-font-family: var(--dsh-font-family-code, monospace);\n --diffs-font-size: var(--dsh-code-font-size, 12px);\n min-width: 0;\n display: block;\n}\n\n.PVpF4W_icon {\n flex: none;\n width: 16px;\n height: 16px;\n}\n\n.PVpF4W_fileToolbar {\n box-sizing: border-box;\n min-height: 36px;\n transition: background var(--ds-transition-duration-fast, .1s)\n var(--ds-ease-in-out, ease);\n background: none;\n flex: none;\n justify-content: space-between;\n align-items: center;\n gap: 8px;\n margin: 0;\n padding: 0 6px 0 0;\n display: flex;\n}\n\n.PVpF4W_fileToolbar:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.PVpF4W_fileToolbar .PVpF4W_fileAction {\n width: 28px;\n min-width: 28px;\n color: var(--dsw-alias-label-secondary);\n padding: 0;\n}\n\n.PVpF4W_fileAction[aria-pressed=\"true\"] {\n color: var(--dsw-alias-label-primary);\n}\n\n.PVpF4W_fileAction .PVpF4W_icon {\n width: 14px;\n height: 14px;\n}\n\n.PVpF4W_reviewDock {\n flex-direction: column;\n flex: none;\n min-height: 0;\n display: flex;\n}\n\n.PVpF4W_reviewBar {\n box-sizing: border-box;\n background: var(--dsw-alias-bg-base);\n border-top: .5px solid var(--dsw-alias-border-l3);\n flex: none;\n justify-content: space-between;\n align-items: center;\n gap: 8px;\n height: 40px;\n min-height: 40px;\n padding: 4px 10px;\n display: flex;\n}\n\n.PVpF4W_reviewDrawer {\n box-sizing: border-box;\n overscroll-behavior: contain;\n border-top: .5px solid var(--dsw-alias-border-l3);\n max-height: min(280px, 35cqh);\n padding: 4px 8px;\n overflow: auto;\n}\n\n.PVpF4W_reviewRow {\n text-align: left;\n flex: 1;\n justify-content: flex-start;\n width: 100%;\n min-width: 0;\n height: auto;\n}\n\n.PVpF4W_reviewPreview {\n flex-direction: column;\n min-width: 0;\n padding-block: 4px;\n display: flex;\n}\n\n.PVpF4W_reviewItem {\n align-items: center;\n gap: 4px;\n display: flex;\n}\n\n.PVpF4W_chevronOpen {\n width: 16px;\n height: 16px;\n transform: rotate(180deg);\n}\n\n.PVpF4W_comment {\n box-sizing: border-box;\n color: var(--dsw-alias-label-primary);\n background: var(--dsw-alias-markdown-code-block);\n border: .5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-lg);\n font: var(--dsh-content-font-size-secondary) / 1.5 var(--dsw-font-family);\n max-width: 860px;\n margin: 8px 12px;\n padding: 8px 12px;\n}\n\n.PVpF4W_commentHeader {\n justify-content: space-between;\n align-items: center;\n gap: 8px;\n display: flex;\n}\n\n.PVpF4W_commentActions {\n align-items: center;\n gap: 4px;\n display: flex;\n}\n\n.PVpF4W_commentText {\n text-align: left;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n justify-content: flex-start;\n width: 100%;\n height: auto;\n}\n\n.PVpF4W_comment textarea {\n box-sizing: border-box;\n resize: vertical;\n width: 100%;\n color: inherit;\n border: 1px solid var(--dsw-alias-border-l3);\n font: inherit;\n background: none;\n border-radius: 4px;\n margin: 4px 0;\n padding: 6px;\n display: block;\n}\n\n@media (pointer: coarse) {\n .PVpF4W_fileToolbar {\n padding-block: 0;\n }\n\n .PVpF4W_row, .PVpF4W_directory {\n min-height: 44px;\n }\n\n .PVpF4W_directory {\n box-sizing: border-box;\n padding-block: 12px;\n }\n}\n\n@container PVpF4W_git-diff (width <= 600px) {\n .PVpF4W_header > .PVpF4W_baseline {\n display: none;\n }\n\n .PVpF4W_scopePicker {\n max-width: 180px;\n }\n}\n\n.PVpF4W_fileHeading {\n font: var(--dsh-content-font-size-secondary) / 1.5 var(--dsw-font-family);\n background: var(--dsw-alias-bg-module-platform);\n}\n\n.PVpF4W_fileHeading[data-expanded=\"true\"] {\n border-bottom: .5px solid var(--dsw-alias-border-l2);\n}\n\n.PVpF4W_reviewCardList {\n --deliverable-fill: var(--dsw-static-neutral-50);\n --deliverable-hover: var(--dsw-static-neutral-100);\n flex-direction: column;\n gap: 6px;\n width: 100%;\n margin-block: 6px;\n display: flex;\n}\n\nbody[data-ds-dark-theme] .PVpF4W_reviewCardList {\n --deliverable-fill: var(--dsw-static-neutral-850);\n --deliverable-hover: var(--dsw-static-neutral-800);\n}\n\n.PVpF4W_reviewCard {\n box-sizing: border-box;\n border: .5px solid var(--dsw-alias-border-l1);\n border-radius: var(--dsw-radius-lg);\n background: var(--deliverable-fill, var(--dsw-static-neutral-50));\n width: 100%;\n min-width: 0;\n height: 60px;\n color: var(--dsw-alias-label-primary);\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n transition: background-color .12s;\n display: flex;\n position: relative;\n overflow: hidden;\n}\n\nbody[data-ds-dark-theme] .PVpF4W_reviewCard {\n background: var(--deliverable-fill, var(--dsw-static-neutral-850));\n}\n\n@media (hover: hover) {\n .PVpF4W_reviewCard:hover {\n background: var(--deliverable-hover, var(--dsw-static-neutral-100));\n }\n\n body[data-ds-dark-theme] .PVpF4W_reviewCard:hover {\n background: var(--deliverable-hover, var(--dsw-static-neutral-800));\n }\n}\n\n.PVpF4W_reviewCard[data-clickable=\"true\"] {\n cursor: pointer;\n}\n\n.PVpF4W_reviewCard:focus-visible {\n box-shadow: inset 0 0 0 2px\n var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline: none;\n}\n\n.PVpF4W_reviewIcon {\n z-index: 2;\n box-sizing: border-box;\n pointer-events: none;\n border: .5px solid var(--dsw-alias-border-l1);\n background: color-mix(in srgb, var(--dsw-static-neutral-00) 50%, transparent);\n width: 40px;\n height: 40px;\n color: var(--dsw-alias-link);\n border-radius: 10px;\n flex: none;\n place-items: center;\n display: grid;\n position: relative;\n overflow: hidden;\n}\n\nbody[data-ds-dark-theme] .PVpF4W_reviewIcon {\n background: color-mix(in srgb, var(--dsw-static-neutral-00) 5%, transparent);\n}\n\n.PVpF4W_reviewDetails {\n z-index: 2;\n flex-direction: column;\n flex: 1;\n justify-content: center;\n gap: 2px;\n min-width: 0;\n display: flex;\n position: relative;\n}\n\n.PVpF4W_reviewTitle {\n min-width: 0;\n color: var(--dsw-alias-label-primary);\n align-items: center;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n display: inline-flex;\n}\n\n.PVpF4W_reviewBranchCopy {\n cursor: pointer;\n border-radius: var(--dsw-radius-xs, 4px);\n -webkit-user-select: text;\n user-select: text;\n align-items: center;\n gap: 6px;\n min-width: 0;\n max-width: 100%;\n margin-left: -4px;\n padding: 1px 4px;\n transition: background-color .1s;\n display: inline-flex;\n}\n\n@media (hover: hover) {\n .PVpF4W_reviewBranchCopy:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n }\n}\n\n.PVpF4W_reviewBranchCopy:focus-visible {\n box-shadow: 0 0 0 1.5px\n var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));\n outline: none;\n}\n\n.PVpF4W_reviewBranchName {\n text-overflow: ellipsis;\n white-space: nowrap;\n -webkit-user-select: text;\n user-select: text;\n overflow: hidden;\n}\n\n.PVpF4W_reviewCopyIcon {\n opacity: .6;\n color: var(--dsw-alias-label-secondary);\n flex: none;\n align-items: center;\n transition: opacity .1s, color .1s;\n display: inline-flex;\n}\n\n.PVpF4W_reviewBranchCopy:hover .PVpF4W_reviewCopyIcon, .PVpF4W_reviewBranchCopy[data-copied=\"true\"] .PVpF4W_reviewCopyIcon {\n opacity: 1;\n color: var(--dsw-alias-link);\n}\n\n.PVpF4W_reviewCopyFeedback {\n color: var(--dsw-alias-link);\n flex: none;\n font-size: 11px;\n font-weight: 400;\n line-height: 16px;\n}\n\n.PVpF4W_reviewDescription {\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--dsw-alias-label-tertiary);\n font-size: 10px;\n font-weight: 400;\n line-height: 16px;\n overflow: hidden;\n}\n\n.PVpF4W_codeViewWrapper {\n min-width: 0;\n position: relative;\n}\n\n.PVpF4W_codeViewWrapper .md-code-block[data-line-numbers] {\n margin: 0;\n}\n\n.PVpF4W_codeViewWrapper .md-code-block[data-line-numbers] :where(pre) code > .line {\n padding-inline-start: calc(var(--dsl-code-block-line-number-width) + 20px);\n}\n\n.PVpF4W_codeViewWrapper .md-code-block[data-line-numbers] :where(pre) code > .line:before {\n width: var(--dsl-code-block-line-number-width);\n font-family: var(--dsh-font-family-code, monospace);\n font-variant-numeric: tabular-nums;\n inset-inline-start: 8px;\n}\n\n.PVpF4W_floatingQuote {\n z-index: 25;\n pointer-events: auto;\n position: absolute;\n}\n\n.PVpF4W_floatingQuoteButton {\n height: 24px;\n font-size: 11px;\n font-weight: 500;\n font-family: var(--dsw-font-family);\n color: #fff;\n background: var(--dsw-alias-interactive-bg-primary, #3b82f6);\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n border: none;\n border-radius: 12px;\n justify-content: center;\n align-items: center;\n padding: 0 10px;\n display: inline-flex;\n box-shadow: 0 2px 8px #00000040;\n}\n\n.PVpF4W_floatingQuoteButton:hover {\n filter: brightness(1.1);\n}\n" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReviewCard, {
3240
+ title: branchLabel(target.branch),
3241
+ description: target.commit !== void 0 ? shortSha(target.commit) : "All commits",
3242
+ onOpen
3243
+ })]
3244
+ }),
3245
+ inspect && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3246
+ type: "button",
3247
+ style: {
3248
+ alignSelf: "flex-start",
3249
+ border: "none",
3250
+ padding: "4px 0",
3251
+ background: "transparent",
3252
+ color: "var(--dsw-alias-link)",
3253
+ font: "inherit",
3254
+ fontSize: 12,
3255
+ cursor: "pointer"
3256
+ },
3257
+ onClick: inspect,
3258
+ children: "Inspect"
3259
+ })
3260
+ ]
3261
+ })
3262
+ });
3263
+ }
3264
+ // src/client/index.tsx
3265
+ const inject = [
3266
+ "sidebarRightTabs",
3267
+ "slots",
3268
+ "remote",
3269
+ "uiConversation"
3270
+ ];
3271
+ function ReviewTabBody({ renderFactorySlot }) {
3272
+ return renderFactorySlot("gitdiff.review", {});
3273
+ }
3274
+ function ReviewHeaderAction({ sessionId, useSplit, toggle }) {
3275
+ const pressed = useSplit((state) => {
3276
+ const overlay = state.overlays.get(sessionId);
3277
+ return overlay !== void 0 && overlay.kind === "slot" && overlay.slotName === "gitdiff.review";
3278
+ });
3279
+ const label = pressed ? "Close git review" : "Show git review";
3280
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
3281
+ label,
3282
+ portal: true,
3283
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
3284
+ size: "sm",
3285
+ variant: "ghost",
3286
+ className: `dsh-split-icon-btn${pressed ? " is-pressed" : ""}`,
3287
+ "aria-label": label,
3288
+ "aria-pressed": pressed,
3289
+ onClick: toggle,
3290
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { size: 14 })
3291
+ })
3292
+ });
3293
+ }
3294
+ async function apply(ctx) {
3295
+ const dispose = await ctx.remote.$mount(TYPERT_REMOTE);
3296
+ ctx.effect(() => dispose);
3297
+ let opener;
3298
+ const reviewInjected = () => ({
3299
+ openReview: (sessionId, target) => {
3300
+ if (opener) opener(sessionId, target).catch((error) => {
3301
+ console.error("[GitReview] Open review failed:", error);
3302
+ });
3303
+ },
3304
+ canOpen: () => opener !== void 0
3305
+ });
3306
+ ctx.effect(() => ctx.uiConversation.events.register(gitReviewDefinition), "review: git-review turn data");
3307
+ ctx.effect(() => ctx.slots.inject("tool.call.toolview", () => ctx.slots.register({
3308
+ name: "tool.call.toolview",
3309
+ key: GIT_REVIEW_TOOL,
3310
+ inject: reviewInjected
3311
+ }, GitReviewRow)), "review: review tool view");
3312
+ ctx.effect(() => ctx.slots.inject("conversation.chat.turnTail", () => ctx.slots.register({
3313
+ name: "conversation.chat.turnTail",
3314
+ id: "git-review",
3315
+ inject: reviewInjected
3316
+ }, GitReviewCard)), "review: review cards");
3317
+ ctx.plugin({
3318
+ inject: ["splitView", "remote.workspaceReview"],
3319
+ apply(splitCtx) {
3320
+ opener = async (sessionId, targetOrScope) => {
3321
+ let scope;
3322
+ if (isBranchReviewScope(targetOrScope)) scope = targetOrScope;
3323
+ else {
3324
+ const res = await splitCtx.remote.workspaceReview.resolve(sessionId, targetOrScope, new AbortController().signal);
3325
+ if (!res.ok) {
3326
+ console.error("[GitReview] Resolution failed:", res.error.message);
3327
+ return;
3328
+ }
3329
+ scope = res.value;
3330
+ }
3331
+ splitCtx.splitView.openSlotOverlay(sessionId, "gitdiff.review", `Review ${branchLabel(scope.ref)}`, { scope });
3332
+ };
3333
+ splitCtx.effect(() => () => {
3334
+ opener = void 0;
3335
+ });
3336
+ splitCtx.effect(() => splitCtx.slots.inject("split.pane.header.actions", () => splitCtx.slots.register({
3337
+ name: "split.pane.header.actions",
3338
+ id: "git-review",
3339
+ order: 12,
3340
+ inject: (sessionId) => ({
3341
+ hooks: { split: splitCtx.splitView },
3342
+ toggle: () => {
3343
+ const overlay = splitCtx.splitView.getSnapshot().overlays.get(sessionId);
3344
+ if (overlay !== void 0 && overlay.kind === "slot" && overlay.slotName === "gitdiff.review") splitCtx.splitView.closeOverlay(sessionId);
3345
+ else splitCtx.splitView.openSlotOverlay(sessionId, "gitdiff.review", "Review", {});
3346
+ }
3347
+ })
3348
+ }, ReviewHeaderAction)), "review: split pane action");
3349
+ }
3350
+ });
3351
+ ctx.inject(["remote.workspaceReview"], (ctx) => {
3352
+ ctx.effect(() => ctx.sidebarRightTabs.register({
3353
+ id: "dsh-client-git-diff",
3354
+ kind: "gitbutler",
3355
+ title: () => "Workspace Review",
3356
+ guide: [{
3357
+ id: "open",
3358
+ order: 50,
3359
+ title: () => "Review",
3360
+ description: () => "Browse Git changes"
3361
+ }]
3362
+ }));
3363
+ ctx.effect(() => ctx.slots.registerFactory({
3364
+ name: "gitdiff.review",
3365
+ scope: "session",
3366
+ inject: () => ({ api: ctx.remote.workspaceReview })
3367
+ }, GitDiffPane));
3368
+ ctx.effect(() => ctx.slots.inject("sidebar.right.pane.tab", () => ctx.slots.register({
3369
+ name: "sidebar.right.pane.tab",
3370
+ key: "dsh-client-git-diff"
3371
+ }, ReviewTabBody)));
3372
+ });
3373
+ }
3374
+ exports.apply = apply;
3375
+ exports.inject = inject;
3376
+ return module.exports;
3377
+ }
3378
+ });