opencode-azure-devops-pr-review 0.4.3 → 0.4.5
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/CHANGELOG.md +185 -0
- package/README.md +209 -81
- package/package.json +2 -2
- package/src/attribution.mjs +9 -0
- package/src/comments.mjs +56 -1
- package/src/host.mjs +12 -0
- package/src/output.mjs +14 -3
- package/src/runtime.mjs +277 -22
- package/src/setup.mjs +23 -12
- package/src/tui-actions.mjs +239 -0
- package/src/tui-model.mjs +81 -10
- package/src/tui-setup.mjs +7 -4
- package/src/tui-view.jsx +233 -69
- package/src/tui.js +428 -162
package/src/tui.js
CHANGED
|
@@ -17,10 +17,13 @@ import { createElement as _$createElement } from "@opentui/solid";
|
|
|
17
17
|
// the session on screen and leaves the keyboard with the prompt; with the setting
|
|
18
18
|
// terminalPanel: manual it opens only with /pr-panel, its one command.
|
|
19
19
|
//
|
|
20
|
-
// The panel
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
20
|
+
// The panel reads AZPR's own notices in the conversation, the report queued to a review session, and
|
|
21
|
+
// the sessions' `metadata.azpr` (src/tui-model.mjs works out what to show). It reads no settings file:
|
|
22
|
+
// the server part writes that setting into the metadata of its notices. After a review or a comment
|
|
23
|
+
// preview, and while a run is under way, it lists what can be done next in one row at its foot, picked
|
|
24
|
+
// instead of typed: each sends the command a person would type (/pr-comment, or /pr-stop for the run
|
|
25
|
+
// under way), to the session on screen, after asking what is needed (src/tui-actions.mjs). It sends
|
|
26
|
+
// nothing by itself, and never a prompt.
|
|
24
27
|
//
|
|
25
28
|
// The dialogs of /pr-setup ask for AZPR's settings (src/tui-setup.mjs says what and in which order) and
|
|
26
29
|
// hand every answer to the server part over the plugin's RPC. They read and write no file and make no
|
|
@@ -31,6 +34,7 @@ import { createElement as _$createElement } from "@opentui/solid";
|
|
|
31
34
|
import { For, Show, createEffect, createMemo, createSignal, onCleanup, onMount } from "solid-js";
|
|
32
35
|
import { MouseButton, SyntaxStyle, TextAttributes } from "@opentui/core";
|
|
33
36
|
import { PANEL, buildPanel, conversationOf, createReader, opensPanel } from "./tui-model.mjs";
|
|
37
|
+
import { actionRows, createActions } from "./tui-actions.mjs";
|
|
34
38
|
import { SETUP_RPC, createSetup, isSetupNotice } from "./tui-setup.mjs";
|
|
35
39
|
|
|
36
40
|
// Short enough for one line of a toast, which the host wraps at about fifty characters.
|
|
@@ -45,9 +49,11 @@ const token = (theme, ...paths) => {
|
|
|
45
49
|
};
|
|
46
50
|
const colors = theme => {
|
|
47
51
|
const base = token(theme, "text.base", "text.default");
|
|
52
|
+
const muted = token(theme, "text.muted", "text.subdued") ?? base;
|
|
48
53
|
return {
|
|
49
54
|
base,
|
|
50
|
-
muted
|
|
55
|
+
muted,
|
|
56
|
+
rule: token(theme, "border.base", "border.default") ?? muted,
|
|
51
57
|
running: token(theme, "text.feedback.info.base") ?? base,
|
|
52
58
|
failed: token(theme, "text.feedback.error.base") ?? base,
|
|
53
59
|
done: token(theme, "text.feedback.success.base") ?? base,
|
|
@@ -122,6 +128,23 @@ function markdownStyle(context) {
|
|
|
122
128
|
};
|
|
123
129
|
return SyntaxStyle.fromStyles(styles, context.renderer.nativeScene);
|
|
124
130
|
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Whether the release of a mouse button is a click: the left button, and not the end of a selection. A
|
|
134
|
+
* selection of text that is dragged across the panel ends where the button is released, and OpenTUI sends that
|
|
135
|
+
* release to whatever lies under the pointer, marked as dragging: it picks nothing.
|
|
136
|
+
*/
|
|
137
|
+
const clicked = event => event.button === MouseButton.LEFT && !event.isDragging;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the pointer of a mouse event is over the element whose handler runs. OpenTUI sends the release of a
|
|
140
|
+
* button that was dragged away to the element it was pressed on, wherever the pointer is by then: a step that
|
|
141
|
+
* was pressed and then left is not picked. True where the host does not say where either of them is.
|
|
142
|
+
*/
|
|
143
|
+
const inside = event => {
|
|
144
|
+
const at = event.currentTarget;
|
|
145
|
+
if (!at || ![event.x, event.y, at.x, at.y, at.width, at.height].every(Number.isFinite)) return true;
|
|
146
|
+
return event.x >= at.x && event.x < at.x + at.width && event.y >= at.y && event.y < at.y + at.height;
|
|
147
|
+
};
|
|
125
148
|
function Row(props) {
|
|
126
149
|
const [hover, setHover] = createSignal(false);
|
|
127
150
|
const mark = () => props.row.state === "running" ? props.colors.running : props.row.state === "failed" ? props.colors.failed : props.colors.done;
|
|
@@ -138,7 +161,7 @@ function Row(props) {
|
|
|
138
161
|
_$setProp(_el$, "onMouseOver", () => setHover(true));
|
|
139
162
|
_$setProp(_el$, "onMouseOut", () => setHover(false));
|
|
140
163
|
_$setProp(_el$, "onMouseUp", event => {
|
|
141
|
-
if (event
|
|
164
|
+
if (!clicked(event)) return;
|
|
142
165
|
event.stopPropagation();
|
|
143
166
|
props.open(props.row.id);
|
|
144
167
|
});
|
|
@@ -193,6 +216,64 @@ function Row(props) {
|
|
|
193
216
|
return _el$;
|
|
194
217
|
})();
|
|
195
218
|
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* One thing that can be done next, in the row at the panel's foot: its key and a word or two. It is clicked,
|
|
222
|
+
* or picked with the key while the panel has the keyboard, which is when the key has its colour: a key that
|
|
223
|
+
* would only type a letter into the prompt is drawn dim.
|
|
224
|
+
* A click on it is a button pressed, not the keyboard asked for. The host gives a panel the keyboard on mouse
|
|
225
|
+
* down, so that is stopped here: what is typed next still goes to the prompt. The press and its release are
|
|
226
|
+
* handed on separately, since a click is both, on one step of one offer; any other press or release here ends
|
|
227
|
+
* what was pressed (`forget`), as it does anywhere else in the panel.
|
|
228
|
+
*/
|
|
229
|
+
function Button(props) {
|
|
230
|
+
const [hover, setHover] = createSignal(false);
|
|
231
|
+
return (() => {
|
|
232
|
+
var _el$6 = _$createElement("box"),
|
|
233
|
+
_el$7 = _$createElement("text"),
|
|
234
|
+
_el$8 = _$createElement("text");
|
|
235
|
+
_$insertNode(_el$6, _el$7);
|
|
236
|
+
_$insertNode(_el$6, _el$8);
|
|
237
|
+
_$setProp(_el$6, "flexDirection", "row");
|
|
238
|
+
_$setProp(_el$6, "flexShrink", 0);
|
|
239
|
+
_$setProp(_el$6, "gap", 1);
|
|
240
|
+
_$setProp(_el$6, "onMouseOver", () => setHover(true));
|
|
241
|
+
_$setProp(_el$6, "onMouseOut", () => setHover(false));
|
|
242
|
+
_$setProp(_el$6, "onMouseDown", event => {
|
|
243
|
+
if (event.button !== MouseButton.LEFT) return props.forget();
|
|
244
|
+
event.stopPropagation();
|
|
245
|
+
props.press(props.item.id);
|
|
246
|
+
});
|
|
247
|
+
_$setProp(_el$6, "onMouseUp", event => {
|
|
248
|
+
if (!clicked(event)) return props.forget();
|
|
249
|
+
event.stopPropagation();
|
|
250
|
+
props.lift(props.item.id, inside(event));
|
|
251
|
+
});
|
|
252
|
+
_$setProp(_el$7, "flexShrink", 0);
|
|
253
|
+
_$setProp(_el$7, "selectable", false);
|
|
254
|
+
_$insert(_el$7, () => `[${props.item.key}]`);
|
|
255
|
+
_$setProp(_el$8, "flexShrink", 0);
|
|
256
|
+
_$setProp(_el$8, "selectable", false);
|
|
257
|
+
_$insert(_el$8, () => props.item.label);
|
|
258
|
+
_$effect(_p$ => {
|
|
259
|
+
var _v$7 = hover() ? props.colors.hover : undefined,
|
|
260
|
+
_v$8 = props.live ? props.colors.link : props.colors.muted,
|
|
261
|
+
_v$9 = props.item.primary ? props.colors.base : props.colors.text,
|
|
262
|
+
_v$0 = props.item.primary ? TextAttributes.BOLD : 0;
|
|
263
|
+
_v$7 !== _p$.e && (_p$.e = _$setProp(_el$6, "backgroundColor", _v$7, _p$.e));
|
|
264
|
+
_v$8 !== _p$.t && (_p$.t = _$setProp(_el$7, "fg", _v$8, _p$.t));
|
|
265
|
+
_v$9 !== _p$.a && (_p$.a = _$setProp(_el$8, "fg", _v$9, _p$.a));
|
|
266
|
+
_v$0 !== _p$.o && (_p$.o = _$setProp(_el$8, "attributes", _v$0, _p$.o));
|
|
267
|
+
return _p$;
|
|
268
|
+
}, {
|
|
269
|
+
e: undefined,
|
|
270
|
+
t: undefined,
|
|
271
|
+
a: undefined,
|
|
272
|
+
o: undefined
|
|
273
|
+
});
|
|
274
|
+
return _el$6;
|
|
275
|
+
})();
|
|
276
|
+
}
|
|
196
277
|
function Panel(props) {
|
|
197
278
|
const context = props.context;
|
|
198
279
|
const state = props.state;
|
|
@@ -213,13 +294,67 @@ function Panel(props) {
|
|
|
213
294
|
});
|
|
214
295
|
onCleanup(() => release(syntax()));
|
|
215
296
|
const close = () => {
|
|
297
|
+
forget();
|
|
216
298
|
state.dismiss(props.panel.sessionID);
|
|
217
299
|
props.panel.close();
|
|
218
300
|
};
|
|
219
|
-
const open = sessionID =>
|
|
220
|
-
|
|
221
|
-
|
|
301
|
+
const open = sessionID => {
|
|
302
|
+
forget();
|
|
303
|
+
context.ui.router.navigate({
|
|
304
|
+
type: "session",
|
|
305
|
+
sessionID
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
// What a notice offers next (a review or a preview its steps, a run under way that it can be stopped), where
|
|
309
|
+
// this host lets the panel send a command; picking one asks first.
|
|
310
|
+
const offered = createMemo(() => state.actions ? actionRows(model().next) : []);
|
|
311
|
+
const offers = id => offered().some(item => item.id === id);
|
|
312
|
+
// Steps are keyed by their name, so a step keeps its element, and with it its place and its hover, while the
|
|
313
|
+
// list is worked out again, which every notice and every answer of the server causes. A step that was drawn
|
|
314
|
+
// anew is, until the next frame, not where the renderer looks for what lies under the pointer: a press or a
|
|
315
|
+
// release in that moment would go nowhere, and the click would be lost. While a run is under way, the
|
|
316
|
+
// moments are many.
|
|
317
|
+
const steps = createMemo(() => offered().map(item => item.id), [], {
|
|
318
|
+
equals: (a, b) => a.length === b.length && a.every((id, index) => id === b[index])
|
|
222
319
|
});
|
|
320
|
+
const step = id => offered().find(item => item.id === id) ?? {
|
|
321
|
+
id,
|
|
322
|
+
key: "",
|
|
323
|
+
label: ""
|
|
324
|
+
};
|
|
325
|
+
let drawn = true;
|
|
326
|
+
onCleanup(() => drawn = false);
|
|
327
|
+
const act = id => {
|
|
328
|
+
const next = model().next;
|
|
329
|
+
if (!next || !offers(id)) return;
|
|
330
|
+
const sessionID = props.panel.sessionID;
|
|
331
|
+
// A dialog can stay open for any time. Its answer counts only while this panel still shows that notice's
|
|
332
|
+
// offer in that session: not for a preview planned again meanwhile, for another session on screen, or
|
|
333
|
+
// once the panel was closed.
|
|
334
|
+
const still = () => drawn && mine() && props.panel.sessionID === sessionID && model().next?.offer === next.offer;
|
|
335
|
+
void state.actions.run(id, next, sessionID, still);
|
|
336
|
+
};
|
|
337
|
+
// A click is the left button pressed and let go on the same step of the same offer, with the pointer still on
|
|
338
|
+
// it. A preview can be planned again while the button is held, and the row then shows the steps of another
|
|
339
|
+
// notice: the release would act on what was not pressed, so it picks nothing. Nor does a release whose press
|
|
340
|
+
// was elsewhere, or one after the pointer left the step. A press is one gesture's: whatever the panel sees
|
|
341
|
+
// of another press or release (on a step, a session's row, `close` or anywhere in it) ends what was pressed,
|
|
342
|
+
// so that a gesture that was given up does not make a later release a click.
|
|
343
|
+
let pressed;
|
|
344
|
+
const press = id => {
|
|
345
|
+
pressed = {
|
|
346
|
+
id,
|
|
347
|
+
offer: model().next?.offer
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
const forget = () => {
|
|
351
|
+
pressed = undefined;
|
|
352
|
+
};
|
|
353
|
+
const lift = (id, over) => {
|
|
354
|
+
const was = pressed;
|
|
355
|
+
pressed = undefined;
|
|
356
|
+
if (over && was && was.id === id && was.offer !== undefined && was.offer === model().next?.offer) act(id);
|
|
357
|
+
};
|
|
223
358
|
|
|
224
359
|
// The host gives the keyboard to a panel that opens, and has no way to open one without it. AZPR is
|
|
225
360
|
// driven by commands, so the panel hands the keyboard back to the prompt: the next command can be typed
|
|
@@ -275,6 +410,16 @@ function Panel(props) {
|
|
|
275
410
|
if (notices) state.readInbox(notices.sessionID, notices.token, false);
|
|
276
411
|
});
|
|
277
412
|
|
|
413
|
+
// Another document (a preview planned again, a report after a preview) is read from its beginning, wherever
|
|
414
|
+
// the one before it was left.
|
|
415
|
+
let shownBefore;
|
|
416
|
+
createEffect(() => {
|
|
417
|
+
const markdown = model().markdown;
|
|
418
|
+
if (!markdown) return;
|
|
419
|
+
if (shownBefore !== undefined && markdown !== shownBefore) scroll?.scrollTo(0);
|
|
420
|
+
shownBefore = markdown;
|
|
421
|
+
});
|
|
422
|
+
|
|
278
423
|
// Active only while the panel has the keyboard; the IDs let a user bind other keys in the TUI's configuration.
|
|
279
424
|
const page = () => Math.max(4, (scroll?.viewport?.height ?? scroll?.height ?? 10) - 2);
|
|
280
425
|
context.keymap.layer(() => ({
|
|
@@ -320,9 +465,49 @@ function Panel(props) {
|
|
|
320
465
|
group: "AZPR",
|
|
321
466
|
bind: "end",
|
|
322
467
|
run: () => scroll?.scrollTo(scroll.scrollHeight)
|
|
468
|
+
},
|
|
469
|
+
// What a review, a preview or a run under way offers; each is there only while the panel lists it.
|
|
470
|
+
{
|
|
471
|
+
id: "azpr.panel.plan",
|
|
472
|
+
title: "AZPR panel: preview the comments",
|
|
473
|
+
group: "AZPR",
|
|
474
|
+
bind: "c",
|
|
475
|
+
enabled: () => offers("plan"),
|
|
476
|
+
run: () => act("plan")
|
|
477
|
+
}, {
|
|
478
|
+
id: "azpr.panel.publish",
|
|
479
|
+
title: "AZPR panel: post the previewed comments",
|
|
480
|
+
group: "AZPR",
|
|
481
|
+
bind: "p",
|
|
482
|
+
enabled: () => offers("publish"),
|
|
483
|
+
run: () => act("publish")
|
|
484
|
+
}, {
|
|
485
|
+
id: "azpr.panel.adjust",
|
|
486
|
+
title: "AZPR panel: leave findings out or change a level",
|
|
487
|
+
group: "AZPR",
|
|
488
|
+
bind: "a",
|
|
489
|
+
enabled: () => offers("adjust"),
|
|
490
|
+
run: () => act("adjust")
|
|
491
|
+
}, {
|
|
492
|
+
id: "azpr.panel.reset",
|
|
493
|
+
title: "AZPR panel: reset your adjustments",
|
|
494
|
+
group: "AZPR",
|
|
495
|
+
bind: "u",
|
|
496
|
+
enabled: () => offers("reset"),
|
|
497
|
+
run: () => act("reset")
|
|
498
|
+
}, {
|
|
499
|
+
id: "azpr.panel.stop",
|
|
500
|
+
title: "AZPR panel: stop the run under way",
|
|
501
|
+
group: "AZPR",
|
|
502
|
+
bind: "s",
|
|
503
|
+
enabled: () => offers("stop"),
|
|
504
|
+
run: () => act("stop")
|
|
323
505
|
}]
|
|
324
506
|
}));
|
|
325
507
|
|
|
508
|
+
// A run with a receipt has ended: one that was stopped, or failed before it had anything to show, is not
|
|
509
|
+
// waited for, so the panel does not say "yet" of it.
|
|
510
|
+
const ended = () => Boolean(model().status) && model().status !== "RUNNING";
|
|
326
511
|
// Rows are keyed by session, so a row keeps its place and its hover while the list is worked out again.
|
|
327
512
|
const ids = createMemo(() => model().rows.map(row => row.id), [], {
|
|
328
513
|
equals: (a, b) => a.length === b.length && a.every((id, index) => id === b[index])
|
|
@@ -334,109 +519,119 @@ function Panel(props) {
|
|
|
334
519
|
report: false
|
|
335
520
|
};
|
|
336
521
|
return (() => {
|
|
337
|
-
var _el$
|
|
338
|
-
_el$
|
|
339
|
-
_el$
|
|
340
|
-
_el$
|
|
341
|
-
_el$
|
|
342
|
-
_el$
|
|
343
|
-
_el$
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
_$
|
|
347
|
-
_$setProp(_el$
|
|
348
|
-
_$setProp(_el$
|
|
349
|
-
_$setProp(_el$
|
|
350
|
-
_$setProp(_el$
|
|
351
|
-
_$setProp(_el$
|
|
352
|
-
_$insertNode(_el$
|
|
353
|
-
_$insertNode(_el$
|
|
354
|
-
_$insertNode(_el$
|
|
355
|
-
_$setProp(_el$
|
|
356
|
-
_$setProp(_el$
|
|
357
|
-
_$
|
|
358
|
-
_$setProp(_el$
|
|
359
|
-
_$
|
|
360
|
-
_$
|
|
522
|
+
var _el$9 = _$createElement("box"),
|
|
523
|
+
_el$0 = _$createElement("box"),
|
|
524
|
+
_el$1 = _$createElement("box"),
|
|
525
|
+
_el$10 = _$createElement("text"),
|
|
526
|
+
_el$11 = _$createElement("b"),
|
|
527
|
+
_el$17 = _$createElement("box"),
|
|
528
|
+
_el$18 = _$createElement("text"),
|
|
529
|
+
_el$21 = _$createElement("box"),
|
|
530
|
+
_el$22 = _$createElement("scrollbox");
|
|
531
|
+
_$insertNode(_el$9, _el$0);
|
|
532
|
+
_$setProp(_el$9, "flexDirection", "column");
|
|
533
|
+
_$setProp(_el$9, "flexGrow", 1);
|
|
534
|
+
_$setProp(_el$9, "minHeight", 0);
|
|
535
|
+
_$setProp(_el$9, "onMouseDown", forget);
|
|
536
|
+
_$setProp(_el$9, "onMouseUp", forget);
|
|
537
|
+
_$insertNode(_el$0, _el$1);
|
|
538
|
+
_$insertNode(_el$0, _el$21);
|
|
539
|
+
_$insertNode(_el$0, _el$22);
|
|
540
|
+
_$setProp(_el$0, "flexDirection", "column");
|
|
541
|
+
_$setProp(_el$0, "flexGrow", 1);
|
|
542
|
+
_$setProp(_el$0, "minHeight", 0);
|
|
543
|
+
_$setProp(_el$0, "paddingLeft", 2);
|
|
544
|
+
_$setProp(_el$0, "paddingRight", 2);
|
|
545
|
+
_$setProp(_el$0, "paddingTop", 1);
|
|
546
|
+
_$insertNode(_el$1, _el$10);
|
|
547
|
+
_$insertNode(_el$1, _el$17);
|
|
548
|
+
_$insertNode(_el$1, _el$18);
|
|
549
|
+
_$setProp(_el$1, "flexDirection", "row");
|
|
550
|
+
_$setProp(_el$1, "flexShrink", 0);
|
|
551
|
+
_$insertNode(_el$10, _el$11);
|
|
552
|
+
_$setProp(_el$10, "flexShrink", 0);
|
|
553
|
+
_$insertNode(_el$11, _$createTextNode(`AZPR`));
|
|
554
|
+
_$insert(_el$10, _$createComponent(Show, {
|
|
361
555
|
get when() {
|
|
362
556
|
return model().run;
|
|
363
557
|
},
|
|
364
558
|
get children() {
|
|
365
|
-
var _el$
|
|
366
|
-
_el$
|
|
367
|
-
_$insertNode(_el$
|
|
368
|
-
_$insert(_el$
|
|
369
|
-
return _el$
|
|
559
|
+
var _el$13 = _$createElement("span"),
|
|
560
|
+
_el$14 = _$createTextNode(` `);
|
|
561
|
+
_$insertNode(_el$13, _el$14);
|
|
562
|
+
_$insert(_el$13, () => model().run, null);
|
|
563
|
+
return _el$13;
|
|
370
564
|
}
|
|
371
565
|
}), null);
|
|
372
|
-
_$insert(_el$
|
|
566
|
+
_$insert(_el$10, _$createComponent(Show, {
|
|
373
567
|
get when() {
|
|
374
568
|
return model().status;
|
|
375
569
|
},
|
|
376
570
|
get children() {
|
|
377
|
-
var _el$
|
|
378
|
-
_el$
|
|
379
|
-
_$insertNode(_el$
|
|
380
|
-
_$insert(_el$
|
|
381
|
-
_$effect(_$p => _$setProp(_el$
|
|
571
|
+
var _el$15 = _$createElement("span"),
|
|
572
|
+
_el$16 = _$createTextNode(` · `);
|
|
573
|
+
_$insertNode(_el$15, _el$16);
|
|
574
|
+
_$insert(_el$15, () => model().status, null);
|
|
575
|
+
_$effect(_$p => _$setProp(_el$15, "style", {
|
|
382
576
|
fg: palette().muted
|
|
383
577
|
}, _$p));
|
|
384
|
-
return _el$
|
|
578
|
+
return _el$15;
|
|
385
579
|
}
|
|
386
580
|
}), null);
|
|
387
|
-
_$setProp(_el$
|
|
388
|
-
_$insertNode(_el$
|
|
389
|
-
_$setProp(_el$
|
|
390
|
-
_$setProp(_el$
|
|
391
|
-
_$setProp(_el$
|
|
392
|
-
if (event
|
|
581
|
+
_$setProp(_el$17, "flexGrow", 1);
|
|
582
|
+
_$insertNode(_el$18, _$createTextNode(`close`));
|
|
583
|
+
_$setProp(_el$18, "flexShrink", 0);
|
|
584
|
+
_$setProp(_el$18, "selectable", false);
|
|
585
|
+
_$setProp(_el$18, "onMouseUp", event => {
|
|
586
|
+
if (!clicked(event)) return;
|
|
393
587
|
event.stopPropagation();
|
|
394
588
|
close();
|
|
395
589
|
});
|
|
396
|
-
_$insert(_el$
|
|
590
|
+
_$insert(_el$0, _$createComponent(Show, {
|
|
397
591
|
get when() {
|
|
398
592
|
return model().progress;
|
|
399
593
|
},
|
|
400
594
|
get children() {
|
|
401
|
-
var _el$
|
|
402
|
-
_$setProp(_el$
|
|
403
|
-
_$insert(_el$
|
|
404
|
-
_$effect(_$p => _$setProp(_el$
|
|
405
|
-
return _el$
|
|
595
|
+
var _el$20 = _$createElement("text");
|
|
596
|
+
_$setProp(_el$20, "flexShrink", 0);
|
|
597
|
+
_$insert(_el$20, () => model().progress);
|
|
598
|
+
_$effect(_$p => _$setProp(_el$20, "fg", palette().muted, _$p));
|
|
599
|
+
return _el$20;
|
|
406
600
|
}
|
|
407
|
-
}), _el$
|
|
408
|
-
_$
|
|
409
|
-
_$setProp(_el$
|
|
410
|
-
_$
|
|
411
|
-
_$setProp(_el$
|
|
412
|
-
_$setProp(_el$
|
|
601
|
+
}), _el$21);
|
|
602
|
+
_$setProp(_el$21, "height", 1);
|
|
603
|
+
_$setProp(_el$21, "flexShrink", 0);
|
|
604
|
+
_$use(element => scroll = element, _el$22);
|
|
605
|
+
_$setProp(_el$22, "flexGrow", 1);
|
|
606
|
+
_$setProp(_el$22, "minHeight", 0);
|
|
607
|
+
_$setProp(_el$22, "verticalScrollbarOptions", {
|
|
413
608
|
visible: false
|
|
414
609
|
});
|
|
415
|
-
_$setProp(_el$
|
|
610
|
+
_$setProp(_el$22, "contentOptions", {
|
|
416
611
|
minHeight: 0
|
|
417
612
|
});
|
|
418
|
-
_$insert(_el$
|
|
613
|
+
_$insert(_el$22, _$createComponent(Show, {
|
|
419
614
|
get when() {
|
|
420
615
|
return ids().length > 0 || model().deleted > 0;
|
|
421
616
|
},
|
|
422
617
|
get children() {
|
|
423
|
-
var _el$
|
|
424
|
-
_$setProp(_el$
|
|
425
|
-
_$setProp(_el$
|
|
426
|
-
_$setProp(_el$
|
|
427
|
-
_$insert(_el$
|
|
618
|
+
var _el$23 = _$createElement("box");
|
|
619
|
+
_$setProp(_el$23, "flexDirection", "column");
|
|
620
|
+
_$setProp(_el$23, "flexShrink", 0);
|
|
621
|
+
_$setProp(_el$23, "paddingBottom", 1);
|
|
622
|
+
_$insert(_el$23, _$createComponent(Show, {
|
|
428
623
|
get when() {
|
|
429
624
|
return ids().length > 0;
|
|
430
625
|
},
|
|
431
626
|
get children() {
|
|
432
|
-
var _el$
|
|
433
|
-
_$insertNode(_el$
|
|
434
|
-
_$setProp(_el$
|
|
435
|
-
_$effect(_$p => _$setProp(_el$
|
|
436
|
-
return _el$
|
|
627
|
+
var _el$24 = _$createElement("text");
|
|
628
|
+
_$insertNode(_el$24, _$createTextNode(`Sessions (click one to open it)`));
|
|
629
|
+
_$setProp(_el$24, "selectable", false);
|
|
630
|
+
_$effect(_$p => _$setProp(_el$24, "fg", palette().muted, _$p));
|
|
631
|
+
return _el$24;
|
|
437
632
|
}
|
|
438
633
|
}), null);
|
|
439
|
-
_$insert(_el$
|
|
634
|
+
_$insert(_el$23, _$createComponent(For, {
|
|
440
635
|
get each() {
|
|
441
636
|
return ids();
|
|
442
637
|
},
|
|
@@ -453,35 +648,35 @@ function Panel(props) {
|
|
|
453
648
|
open: open
|
|
454
649
|
})
|
|
455
650
|
}), null);
|
|
456
|
-
_$insert(_el$
|
|
651
|
+
_$insert(_el$23, _$createComponent(Show, {
|
|
457
652
|
get when() {
|
|
458
653
|
return model().deleted > 0;
|
|
459
654
|
},
|
|
460
655
|
get children() {
|
|
461
|
-
var _el$
|
|
462
|
-
_el$
|
|
463
|
-
_$insertNode(_el$
|
|
464
|
-
_$insert(_el$
|
|
465
|
-
_$effect(_$p => _$setProp(_el$
|
|
466
|
-
return _el$
|
|
656
|
+
var _el$26 = _$createElement("text"),
|
|
657
|
+
_el$27 = _$createTextNode(` session(s) were deleted when their run ended.`);
|
|
658
|
+
_$insertNode(_el$26, _el$27);
|
|
659
|
+
_$insert(_el$26, () => model().deleted, _el$27);
|
|
660
|
+
_$effect(_$p => _$setProp(_el$26, "fg", palette().muted, _$p));
|
|
661
|
+
return _el$26;
|
|
467
662
|
}
|
|
468
663
|
}), null);
|
|
469
|
-
return _el$
|
|
664
|
+
return _el$23;
|
|
470
665
|
}
|
|
471
666
|
}), null);
|
|
472
|
-
_$insert(_el$
|
|
667
|
+
_$insert(_el$22, _$createComponent(Show, {
|
|
473
668
|
get when() {
|
|
474
669
|
return model().markdown;
|
|
475
670
|
},
|
|
476
671
|
get fallback() {
|
|
477
672
|
return (() => {
|
|
478
|
-
var _el$
|
|
479
|
-
_$insert(_el$
|
|
673
|
+
var _el$34 = _$createElement("text");
|
|
674
|
+
_$insert(_el$34, (() => {
|
|
480
675
|
var _c$ = _$memo(() => !!model().loading);
|
|
481
|
-
return () => _c$() ? "Loading the report…" : _$memo(() => !!model().inbox)() ? "The report is in its session: open it above." : model().run ? "No report or preview yet." : "No AZPR run in this conversation yet.";
|
|
676
|
+
return () => _c$() ? "Loading the report…" : _$memo(() => !!model().inbox)() ? "The report is in its session: open it above." : _$memo(() => !!model().run)() ? ended() ? "This run ended with no report or preview to show." : "No report or preview yet." : "No AZPR run in this conversation yet.";
|
|
482
677
|
})());
|
|
483
|
-
_$effect(_$p => _$setProp(_el$
|
|
484
|
-
return _el$
|
|
678
|
+
_$effect(_$p => _$setProp(_el$34, "fg", palette().muted, _$p));
|
|
679
|
+
return _el$34;
|
|
485
680
|
})();
|
|
486
681
|
},
|
|
487
682
|
get children() {
|
|
@@ -490,29 +685,29 @@ function Panel(props) {
|
|
|
490
685
|
return model().documentHead;
|
|
491
686
|
},
|
|
492
687
|
get children() {
|
|
493
|
-
var _el$
|
|
494
|
-
_$setProp(_el$
|
|
495
|
-
_$setProp(_el$
|
|
496
|
-
_$insert(_el$
|
|
497
|
-
_$effect(_$p => _$setProp(_el$
|
|
498
|
-
return _el$
|
|
688
|
+
var _el$28 = _$createElement("text");
|
|
689
|
+
_$setProp(_el$28, "flexShrink", 0);
|
|
690
|
+
_$setProp(_el$28, "paddingBottom", 1);
|
|
691
|
+
_$insert(_el$28, () => model().documentHead);
|
|
692
|
+
_$effect(_$p => _$setProp(_el$28, "fg", palette().muted, _$p));
|
|
693
|
+
return _el$28;
|
|
499
694
|
}
|
|
500
695
|
}), (() => {
|
|
501
|
-
var _el$
|
|
502
|
-
_$setProp(_el$
|
|
503
|
-
_$setProp(_el$
|
|
696
|
+
var _el$29 = _$createElement("markdown");
|
|
697
|
+
_$setProp(_el$29, "conceal", true);
|
|
698
|
+
_$setProp(_el$29, "tableOptions", {
|
|
504
699
|
style: "grid",
|
|
505
700
|
cellPaddingX: 1
|
|
506
701
|
});
|
|
507
702
|
_$effect(_p$ => {
|
|
508
|
-
var _v$
|
|
509
|
-
_v$
|
|
510
|
-
_v$
|
|
511
|
-
_v$
|
|
512
|
-
_v$
|
|
513
|
-
_v$
|
|
514
|
-
_v$
|
|
515
|
-
_v$
|
|
703
|
+
var _v$1 = syntax(),
|
|
704
|
+
_v$10 = model().markdown,
|
|
705
|
+
_v$11 = palette().text,
|
|
706
|
+
_v$12 = palette().surface;
|
|
707
|
+
_v$1 !== _p$.e && (_p$.e = _$setProp(_el$29, "syntaxStyle", _v$1, _p$.e));
|
|
708
|
+
_v$10 !== _p$.t && (_p$.t = _$setProp(_el$29, "content", _v$10, _p$.t));
|
|
709
|
+
_v$11 !== _p$.a && (_p$.a = _$setProp(_el$29, "fg", _v$11, _p$.a));
|
|
710
|
+
_v$12 !== _p$.o && (_p$.o = _$setProp(_el$29, "bg", _v$12, _p$.o));
|
|
516
711
|
return _p$;
|
|
517
712
|
}, {
|
|
518
713
|
e: undefined,
|
|
@@ -520,25 +715,80 @@ function Panel(props) {
|
|
|
520
715
|
a: undefined,
|
|
521
716
|
o: undefined
|
|
522
717
|
});
|
|
523
|
-
return _el$
|
|
718
|
+
return _el$29;
|
|
524
719
|
})()];
|
|
525
720
|
}
|
|
526
721
|
}), null);
|
|
722
|
+
_$insert(_el$9, _$createComponent(Show, {
|
|
723
|
+
get when() {
|
|
724
|
+
return steps().length > 0;
|
|
725
|
+
},
|
|
726
|
+
get children() {
|
|
727
|
+
var _el$30 = _$createElement("box"),
|
|
728
|
+
_el$31 = _$createElement("box"),
|
|
729
|
+
_el$32 = _$createElement("box");
|
|
730
|
+
_$insertNode(_el$30, _el$31);
|
|
731
|
+
_$insertNode(_el$30, _el$32);
|
|
732
|
+
_$setProp(_el$30, "flexDirection", "column");
|
|
733
|
+
_$setProp(_el$30, "flexShrink", 0);
|
|
734
|
+
_$setProp(_el$31, "height", 1);
|
|
735
|
+
_$setProp(_el$31, "flexShrink", 0);
|
|
736
|
+
_$setProp(_el$31, "border", ["top"]);
|
|
737
|
+
_$setProp(_el$32, "flexDirection", "row");
|
|
738
|
+
_$setProp(_el$32, "flexWrap", "wrap");
|
|
739
|
+
_$setProp(_el$32, "columnGap", 3);
|
|
740
|
+
_$setProp(_el$32, "flexShrink", 0);
|
|
741
|
+
_$setProp(_el$32, "paddingLeft", 2);
|
|
742
|
+
_$setProp(_el$32, "paddingRight", 2);
|
|
743
|
+
_$insert(_el$32, _$createComponent(For, {
|
|
744
|
+
get each() {
|
|
745
|
+
return steps();
|
|
746
|
+
},
|
|
747
|
+
children: id => _$createComponent(Button, {
|
|
748
|
+
get item() {
|
|
749
|
+
return step(id);
|
|
750
|
+
},
|
|
751
|
+
get colors() {
|
|
752
|
+
return palette();
|
|
753
|
+
},
|
|
754
|
+
get live() {
|
|
755
|
+
return props.panel.focused;
|
|
756
|
+
},
|
|
757
|
+
press: press,
|
|
758
|
+
lift: lift,
|
|
759
|
+
forget: forget
|
|
760
|
+
})
|
|
761
|
+
}));
|
|
762
|
+
_$insert(_el$30, _$createComponent(Show, {
|
|
763
|
+
get when() {
|
|
764
|
+
return props.panel.presentation !== "fullscreen";
|
|
765
|
+
},
|
|
766
|
+
get children() {
|
|
767
|
+
var _el$33 = _$createElement("box");
|
|
768
|
+
_$setProp(_el$33, "height", 1);
|
|
769
|
+
_$setProp(_el$33, "flexShrink", 0);
|
|
770
|
+
return _el$33;
|
|
771
|
+
}
|
|
772
|
+
}), null);
|
|
773
|
+
_$effect(_$p => _$setProp(_el$31, "borderColor", palette().rule, _$p));
|
|
774
|
+
return _el$30;
|
|
775
|
+
}
|
|
776
|
+
}), null);
|
|
527
777
|
_$effect(_p$ => {
|
|
528
|
-
var _v$
|
|
529
|
-
_v$
|
|
530
|
-
_v$
|
|
531
|
-
_v$
|
|
778
|
+
var _v$13 = palette().base,
|
|
779
|
+
_v$14 = palette().muted;
|
|
780
|
+
_v$13 !== _p$.e && (_p$.e = _$setProp(_el$10, "fg", _v$13, _p$.e));
|
|
781
|
+
_v$14 !== _p$.t && (_p$.t = _$setProp(_el$18, "fg", _v$14, _p$.t));
|
|
532
782
|
return _p$;
|
|
533
783
|
}, {
|
|
534
784
|
e: undefined,
|
|
535
785
|
t: undefined
|
|
536
786
|
});
|
|
537
|
-
return _el$
|
|
787
|
+
return _el$9;
|
|
538
788
|
})();
|
|
539
789
|
}
|
|
540
790
|
|
|
541
|
-
/** The review panel: opens by itself or with /pr-panel
|
|
791
|
+
/** The review panel: opens by itself or with /pr-panel. Returns its cleanup, or nothing on a host without a place for it. */
|
|
542
792
|
function panelPart(context) {
|
|
543
793
|
// A host without these parts of the plugin API has no place for the panel: stay out of its way.
|
|
544
794
|
const needed = [context?.ui?.slot, context?.ui?.panel?.open, context?.ui?.router?.navigate, context?.keymap?.layer, context?.data?.listen, context?.data?.session?.pending?.list];
|
|
@@ -583,10 +833,24 @@ function panelPart(context) {
|
|
|
583
833
|
let unasked;
|
|
584
834
|
// The session in which another plugin's panel is open; the host shows one panel at a time.
|
|
585
835
|
let occupied;
|
|
836
|
+
// The steps at the panel's foot send a command of the server part, as the host's own prompt does for one
|
|
837
|
+
// that is typed. A host without that, or without the dialogs that ask first, shows no such steps.
|
|
838
|
+
const actions = typeof context.client?.session?.command === "function" && typeof context.ui?.dialog?.select === "function" && typeof context.ui?.toast?.show === "function" ? createActions({
|
|
839
|
+
dialog: context.ui.dialog,
|
|
840
|
+
toast: options => {
|
|
841
|
+
if (!disposed) context.ui.toast.show(options);
|
|
842
|
+
},
|
|
843
|
+
send: (sessionID, command) => context.client.session.command({
|
|
844
|
+
sessionID,
|
|
845
|
+
name: command.name,
|
|
846
|
+
text: command.text
|
|
847
|
+
})
|
|
848
|
+
}) : undefined;
|
|
586
849
|
const state = {
|
|
587
850
|
source,
|
|
588
851
|
known,
|
|
589
852
|
read,
|
|
853
|
+
actions,
|
|
590
854
|
titles: new Map(),
|
|
591
855
|
lookup: reader.lookup,
|
|
592
856
|
readInbox: reader.readInbox,
|
|
@@ -714,6 +978,8 @@ function panelPart(context) {
|
|
|
714
978
|
}));
|
|
715
979
|
return () => {
|
|
716
980
|
disposed = true;
|
|
981
|
+
// An action that is open ends at its next step: nothing is sent by a part that was unloaded.
|
|
982
|
+
actions?.stop();
|
|
717
983
|
reader.dispose();
|
|
718
984
|
stop?.();
|
|
719
985
|
};
|
|
@@ -796,66 +1062,66 @@ function Secret(props) {
|
|
|
796
1062
|
value = "";
|
|
797
1063
|
});
|
|
798
1064
|
return (() => {
|
|
799
|
-
var _el$
|
|
800
|
-
_el$
|
|
801
|
-
_el$
|
|
802
|
-
_el$
|
|
803
|
-
_el$
|
|
804
|
-
_el$
|
|
805
|
-
_el$
|
|
806
|
-
_$insertNode(_el$
|
|
807
|
-
_$insertNode(_el$
|
|
808
|
-
_$insertNode(_el$
|
|
809
|
-
_$insertNode(_el$
|
|
810
|
-
_$setProp(_el$
|
|
811
|
-
_$setProp(_el$
|
|
812
|
-
_$setProp(_el$
|
|
813
|
-
_$setProp(_el$
|
|
814
|
-
_$setProp(_el$
|
|
815
|
-
_$setProp(_el$
|
|
816
|
-
_$insertNode(_el$
|
|
817
|
-
_$insert(_el$
|
|
818
|
-
_$insert(_el$
|
|
1065
|
+
var _el$35 = _$createElement("box"),
|
|
1066
|
+
_el$36 = _$createElement("text"),
|
|
1067
|
+
_el$37 = _$createElement("b"),
|
|
1068
|
+
_el$39 = _$createElement("text"),
|
|
1069
|
+
_el$40 = _$createElement("box"),
|
|
1070
|
+
_el$41 = _$createElement("text"),
|
|
1071
|
+
_el$42 = _$createElement("text");
|
|
1072
|
+
_$insertNode(_el$35, _el$36);
|
|
1073
|
+
_$insertNode(_el$35, _el$39);
|
|
1074
|
+
_$insertNode(_el$35, _el$40);
|
|
1075
|
+
_$insertNode(_el$35, _el$42);
|
|
1076
|
+
_$setProp(_el$35, "flexDirection", "column");
|
|
1077
|
+
_$setProp(_el$35, "paddingLeft", 2);
|
|
1078
|
+
_$setProp(_el$35, "paddingRight", 2);
|
|
1079
|
+
_$setProp(_el$35, "paddingTop", 1);
|
|
1080
|
+
_$setProp(_el$35, "paddingBottom", 1);
|
|
1081
|
+
_$setProp(_el$35, "gap", 1);
|
|
1082
|
+
_$insertNode(_el$36, _el$37);
|
|
1083
|
+
_$insert(_el$37, () => props.options.title);
|
|
1084
|
+
_$insert(_el$35, _$createComponent(Show, {
|
|
819
1085
|
get when() {
|
|
820
1086
|
return props.options.problem;
|
|
821
1087
|
},
|
|
822
1088
|
get children() {
|
|
823
|
-
var _el$
|
|
824
|
-
_$insert(_el$
|
|
825
|
-
_$effect(_$p => _$setProp(_el$
|
|
826
|
-
return _el$
|
|
1089
|
+
var _el$38 = _$createElement("text");
|
|
1090
|
+
_$insert(_el$38, () => props.options.problem);
|
|
1091
|
+
_$effect(_$p => _$setProp(_el$38, "fg", palette().failed, _$p));
|
|
1092
|
+
return _el$38;
|
|
827
1093
|
}
|
|
828
|
-
}), _el$
|
|
829
|
-
_$insert(_el$
|
|
830
|
-
_$insertNode(_el$
|
|
1094
|
+
}), _el$39);
|
|
1095
|
+
_$insert(_el$39, () => props.options.description);
|
|
1096
|
+
_$insertNode(_el$40, _el$41);
|
|
831
1097
|
_$use(node => {
|
|
832
1098
|
field = node;
|
|
833
|
-
}, _el$
|
|
834
|
-
_$setProp(_el$
|
|
835
|
-
_$setProp(_el$
|
|
836
|
-
_$setProp(_el$
|
|
837
|
-
_$setProp(_el$
|
|
1099
|
+
}, _el$40);
|
|
1100
|
+
_$setProp(_el$40, "focusable", true);
|
|
1101
|
+
_$setProp(_el$40, "onKeyDown", key);
|
|
1102
|
+
_$setProp(_el$40, "onPaste", paste);
|
|
1103
|
+
_$setProp(_el$40, "onMouseDown", () => {
|
|
838
1104
|
if (field && !field.isDestroyed) field.focus();
|
|
839
1105
|
});
|
|
840
|
-
_$setProp(_el$
|
|
841
|
-
_$setProp(_el$
|
|
842
|
-
_$setProp(_el$
|
|
843
|
-
_$insert(_el$
|
|
1106
|
+
_$setProp(_el$40, "height", 1);
|
|
1107
|
+
_$setProp(_el$40, "paddingLeft", 1);
|
|
1108
|
+
_$setProp(_el$40, "flexShrink", 0);
|
|
1109
|
+
_$insert(_el$41, (() => {
|
|
844
1110
|
var _c$2 = _$memo(() => !!length());
|
|
845
1111
|
return () => _c$2() ? `${"•".repeat(Math.min(length(), 16))} (${length()} characters, hidden)` : "Paste the token here; it is not shown";
|
|
846
1112
|
})());
|
|
847
|
-
_$insertNode(_el$
|
|
1113
|
+
_$insertNode(_el$42, _$createTextNode(`enter save · ctrl+u clear · esc leave`));
|
|
848
1114
|
_$effect(_p$ => {
|
|
849
|
-
var _v$
|
|
850
|
-
_v$
|
|
851
|
-
_v$
|
|
852
|
-
_v$
|
|
853
|
-
_v$
|
|
854
|
-
_v$
|
|
855
|
-
_v$
|
|
856
|
-
_v$
|
|
857
|
-
_v$
|
|
858
|
-
_v$
|
|
1115
|
+
var _v$15 = palette().base,
|
|
1116
|
+
_v$16 = palette().muted,
|
|
1117
|
+
_v$17 = palette().hover ?? palette().surface,
|
|
1118
|
+
_v$18 = length() ? palette().base : palette().muted,
|
|
1119
|
+
_v$19 = palette().muted;
|
|
1120
|
+
_v$15 !== _p$.e && (_p$.e = _$setProp(_el$36, "fg", _v$15, _p$.e));
|
|
1121
|
+
_v$16 !== _p$.t && (_p$.t = _$setProp(_el$39, "fg", _v$16, _p$.t));
|
|
1122
|
+
_v$17 !== _p$.a && (_p$.a = _$setProp(_el$40, "backgroundColor", _v$17, _p$.a));
|
|
1123
|
+
_v$18 !== _p$.o && (_p$.o = _$setProp(_el$41, "fg", _v$18, _p$.o));
|
|
1124
|
+
_v$19 !== _p$.i && (_p$.i = _$setProp(_el$42, "fg", _v$19, _p$.i));
|
|
859
1125
|
return _p$;
|
|
860
1126
|
}, {
|
|
861
1127
|
e: undefined,
|
|
@@ -864,7 +1130,7 @@ function Secret(props) {
|
|
|
864
1130
|
o: undefined,
|
|
865
1131
|
i: undefined
|
|
866
1132
|
});
|
|
867
|
-
return _el$
|
|
1133
|
+
return _el$35;
|
|
868
1134
|
})();
|
|
869
1135
|
}
|
|
870
1136
|
|