opencode-copilot-delegate 0.10.0 → 0.10.1

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/tui/index.js CHANGED
@@ -15,228 +15,17 @@ var __export = (target, all) => {
15
15
  };
16
16
 
17
17
  // src/tui/index.tsx
18
- import { createComponent as _$createComponent3 } from "@opentui/solid";
19
-
20
- // src/tui/components/confirm-card.tsx
21
18
  import { createComponent as _$createComponent } from "@opentui/solid";
22
- import { effect as _$effect } from "@opentui/solid";
19
+
20
+ // src/tui/components/modal-list.tsx
23
21
  import { createTextNode as _$createTextNode } from "@opentui/solid";
24
22
  import { insertNode as _$insertNode } from "@opentui/solid";
25
23
  import { use as _$use } from "@opentui/solid";
26
- import { insert as _$insert } from "@opentui/solid";
27
24
  import { setProp as _$setProp } from "@opentui/solid";
28
25
  import { createElement as _$createElement } from "@opentui/solid";
29
26
  import { TextAttributes } from "@opentui/core";
30
27
  import { useRenderer } from "@opentui/solid";
31
28
  import { onCleanup } from "solid-js";
32
- function errorMessage(error) {
33
- if (error instanceof Error && error.message.trim().length > 0) {
34
- return error.message.trim();
35
- }
36
- return "Unknown RPC error.";
37
- }
38
- function matchesKey(key, expected) {
39
- return key.name === expected || key.sequence === expected || key.raw === expected;
40
- }
41
- function isActivateKey(key) {
42
- return matchesKey(key, "return") || matchesKey(key, "enter") || matchesKey(key, "space") || key.sequence === " " || key.raw === " ";
43
- }
44
- function isLeftKey(key) {
45
- return matchesKey(key, "left");
46
- }
47
- function isRightKey(key) {
48
- return matchesKey(key, "right");
49
- }
50
- function updateText(node, content, attributes = TextAttributes.NONE) {
51
- if (!node) {
52
- return;
53
- }
54
- node.content = content;
55
- node.attributes = attributes;
56
- node.visible = content.length > 0;
57
- }
58
- function ConfirmCard(props) {
59
- const Dialog = props.Dialog;
60
- const renderer = useRenderer();
61
- const title = `Cancel Copilot delegation ${props.task.taskId}?`;
62
- const state = {
63
- value: {
64
- kind: "confirm",
65
- focusedAction: "confirm",
66
- busy: false
67
- }
68
- };
69
- let confirmText;
70
- let cancelText;
71
- let errorText;
72
- let dismissText;
73
- const renderView = () => {
74
- const currentState = state.value;
75
- if (currentState.kind === "error") {
76
- updateText(confirmText, "");
77
- updateText(cancelText, "");
78
- updateText(errorText, `Cancel failed: ${currentState.message}`);
79
- updateText(dismissText, "Dismiss", TextAttributes.INVERSE);
80
- renderer.requestRender();
81
- return;
82
- }
83
- updateText(confirmText, "Cancel Task", currentState.focusedAction === "confirm" ? TextAttributes.INVERSE : TextAttributes.NONE);
84
- updateText(cancelText, "Keep Running", currentState.focusedAction === "cancel" ? TextAttributes.INVERSE : TextAttributes.NONE);
85
- updateText(errorText, "");
86
- updateText(dismissText, "");
87
- renderer.requestRender();
88
- };
89
- const closeToList = () => {
90
- if (state.value.kind === "error") {
91
- props.onDismissAfterError();
92
- return;
93
- }
94
- if (state.value.busy) {
95
- return;
96
- }
97
- props.onCancel();
98
- };
99
- const confirmCancel = async () => {
100
- if (state.value.kind !== "confirm" || state.value.busy) {
101
- return;
102
- }
103
- state.value = {
104
- ...state.value,
105
- busy: true
106
- };
107
- try {
108
- const response = await props.rpc.tasksCancel(props.task.taskId);
109
- if (response.cancelled) {
110
- props.onConfirm();
111
- return;
112
- }
113
- if (response.error === "no such task") {
114
- props.onConfirm();
115
- return;
116
- }
117
- state.value = {
118
- kind: "error",
119
- message: response.error ?? "Unknown RPC error."
120
- };
121
- } catch (error) {
122
- state.value = {
123
- kind: "error",
124
- message: errorMessage(error)
125
- };
126
- }
127
- renderView();
128
- };
129
- const activateFocusedAction = () => {
130
- if (state.value.kind === "error") {
131
- props.onDismissAfterError();
132
- return;
133
- }
134
- if (state.value.focusedAction === "confirm") {
135
- confirmCancel();
136
- return;
137
- }
138
- props.onCancel();
139
- };
140
- const focusConfirm = () => {
141
- if (state.value.kind !== "confirm" || state.value.busy) {
142
- return;
143
- }
144
- state.value = {
145
- ...state.value,
146
- focusedAction: "confirm"
147
- };
148
- renderView();
149
- };
150
- const focusCancel = () => {
151
- if (state.value.kind !== "confirm" || state.value.busy) {
152
- return;
153
- }
154
- state.value = {
155
- ...state.value,
156
- focusedAction: "cancel"
157
- };
158
- renderView();
159
- };
160
- const handleKeyPress = (key) => {
161
- if (matchesKey(key, "escape")) {
162
- key.preventDefault();
163
- closeToList();
164
- return;
165
- }
166
- if (state.value.kind === "confirm" && !state.value.busy) {
167
- if (isLeftKey(key)) {
168
- key.preventDefault();
169
- focusConfirm();
170
- return;
171
- }
172
- if (isRightKey(key)) {
173
- key.preventDefault();
174
- focusCancel();
175
- return;
176
- }
177
- }
178
- if (isActivateKey(key)) {
179
- key.preventDefault();
180
- activateFocusedAction();
181
- }
182
- };
183
- renderer.keyInput.on("keypress", handleKeyPress);
184
- onCleanup(() => {
185
- renderer.keyInput.off("keypress", handleKeyPress);
186
- });
187
- return _$createComponent(Dialog, {
188
- onClose: closeToList,
189
- size: "medium",
190
- get children() {
191
- var _el$ = _$createElement("box"), _el$2 = _$createElement("text"), _el$3 = _$createElement("text"), _el$5 = _$createElement("text"), _el$7 = _$createElement("text"), _el$8 = _$createElement("text");
192
- _$insertNode(_el$, _el$2);
193
- _$insertNode(_el$, _el$3);
194
- _$insertNode(_el$, _el$5);
195
- _$insertNode(_el$, _el$7);
196
- _$insertNode(_el$, _el$8);
197
- _$setProp(_el$, "flexDirection", "column");
198
- _$setProp(_el$, "gap", 1);
199
- _$setProp(_el$, "padding", 1);
200
- _$insert(_el$2, title);
201
- _$insertNode(_el$3, _$createTextNode(`Cancel Task`));
202
- var _ref$ = confirmText;
203
- typeof _ref$ === "function" ? _$use(_ref$, _el$3) : confirmText = _el$3;
204
- _$setProp(_el$3, "onMouseUp", () => {
205
- focusConfirm();
206
- confirmCancel();
207
- });
208
- _$insertNode(_el$5, _$createTextNode(`Keep Running`));
209
- var _ref$2 = cancelText;
210
- typeof _ref$2 === "function" ? _$use(_ref$2, _el$5) : cancelText = _el$5;
211
- _$setProp(_el$5, "onMouseUp", () => {
212
- focusCancel();
213
- closeToList();
214
- });
215
- var _ref$3 = errorText;
216
- typeof _ref$3 === "function" ? _$use(_ref$3, _el$7) : errorText = _el$7;
217
- _$setProp(_el$7, "visible", false);
218
- var _ref$4 = dismissText;
219
- typeof _ref$4 === "function" ? _$use(_ref$4, _el$8) : dismissText = _el$8;
220
- _$setProp(_el$8, "visible", false);
221
- _$setProp(_el$8, "onMouseUp", () => {
222
- props.onDismissAfterError();
223
- });
224
- _$effect((_$p) => _$setProp(_el$3, "attributes", TextAttributes.INVERSE, _$p));
225
- return _el$;
226
- }
227
- });
228
- }
229
-
230
- // src/tui/components/modal-list.tsx
231
- import { createComponent as _$createComponent2 } from "@opentui/solid";
232
- import { createTextNode as _$createTextNode2 } from "@opentui/solid";
233
- import { insertNode as _$insertNode2 } from "@opentui/solid";
234
- import { use as _$use2 } from "@opentui/solid";
235
- import { setProp as _$setProp2 } from "@opentui/solid";
236
- import { createElement as _$createElement2 } from "@opentui/solid";
237
- import { TextAttributes as TextAttributes2 } from "@opentui/core";
238
- import { useRenderer as useRenderer2 } from "@opentui/solid";
239
- import { onCleanup as onCleanup2 } from "solid-js";
240
29
 
241
30
  // src/tui/components/row.tsx
242
31
  function displayValue(value) {
@@ -272,8 +61,6 @@ function formatRowText(task, nowMs) {
272
61
  var LOADING_HEADER = "Loading delegations\u2026";
273
62
  var EMPTY_STATE_TITLE = "No Copilot delegations are running.";
274
63
  var EMPTY_STATE_HINT = "Start one with the copilot_delegate tool, then reopen /copilot-status.";
275
- var ERROR_STATE_TITLE = "The Copilot delegate TUI plugin is not responding.";
276
- var ERROR_STATE_HINT = "Try reloading the plugin (or run /copilot-status again).";
277
64
  var defaultClock = {
278
65
  now: () => Date.now(),
279
66
  setInterval: (fn, delayMs) => globalThis.setInterval(fn, delayMs),
@@ -281,13 +68,7 @@ var defaultClock = {
281
68
  globalThis.clearInterval(handle);
282
69
  }
283
70
  };
284
- function errorMessage2(error) {
285
- if (error instanceof Error && error.message.trim().length > 0) {
286
- return error.message.trim();
287
- }
288
- return "Unknown RPC error.";
289
- }
290
- function updateText2(node, content, attributes = TextAttributes2.NONE) {
71
+ function updateText(node, content, attributes = TextAttributes.NONE) {
291
72
  if (!node) {
292
73
  return;
293
74
  }
@@ -300,39 +81,23 @@ function updateBoxVisibility(node, visible) {
300
81
  }
301
82
  node.visible = visible;
302
83
  }
303
- function matchesKey2(key, expected) {
304
- return key.name === expected || key.sequence === expected || key.raw === expected;
305
- }
306
84
  function renderLoadingState(refs) {
307
- updateText2(refs.headerText, LOADING_HEADER);
308
- updateText2(refs.footerText, "Esc close");
309
- updateBoxVisibility(refs.emptyBox, false);
310
- updateBoxVisibility(refs.errorBox, false);
311
- updateBoxVisibility(refs.rowsBox, false);
312
- }
313
- function renderErrorState(refs, message) {
314
- updateText2(refs.headerText, "Status unavailable.");
315
- updateText2(refs.footerText, "Esc close");
85
+ updateText(refs.headerText, LOADING_HEADER);
86
+ updateText(refs.footerText, "Esc close");
316
87
  updateBoxVisibility(refs.emptyBox, false);
317
- updateBoxVisibility(refs.errorBox, true);
318
88
  updateBoxVisibility(refs.rowsBox, false);
319
- updateText2(refs.errorLineOne, ERROR_STATE_TITLE);
320
- updateText2(refs.errorLineTwo, message);
321
- updateText2(refs.errorLineThree, ERROR_STATE_HINT);
322
89
  }
323
90
  function renderEmptyView(refs) {
324
- updateText2(refs.headerText, "0 running \xB7 0 recent");
325
- updateText2(refs.footerText, "Esc close");
326
- updateBoxVisibility(refs.errorBox, false);
91
+ updateText(refs.headerText, "0 running \xB7 0 recent");
92
+ updateText(refs.footerText, "Esc close");
327
93
  updateBoxVisibility(refs.emptyBox, true);
328
94
  updateBoxVisibility(refs.rowsBox, false);
329
- updateText2(refs.emptyLineOne, EMPTY_STATE_TITLE);
330
- updateText2(refs.emptyLineTwo, EMPTY_STATE_HINT);
95
+ updateText(refs.emptyLineOne, EMPTY_STATE_TITLE);
96
+ updateText(refs.emptyLineTwo, EMPTY_STATE_HINT);
331
97
  }
332
- function renderTaskRows(refs, tasks, focusedIndex, nowMs) {
333
- updateText2(refs.headerText, `${tasks.length} running \xB7 0 recent`);
334
- updateText2(refs.footerText, "\u2191\u2193 navigate \xB7 c cancel \xB7 Esc close");
335
- updateBoxVisibility(refs.errorBox, false);
98
+ function renderTaskRows(refs, tasks, nowMs) {
99
+ updateText(refs.headerText, `${tasks.length} running \xB7 0 recent`);
100
+ updateText(refs.footerText, "Esc close");
336
101
  updateBoxVisibility(refs.emptyBox, false);
337
102
  updateBoxVisibility(refs.rowsBox, true);
338
103
  for (const [index, rowText] of refs.rowTexts.entries()) {
@@ -342,27 +107,11 @@ function renderTaskRows(refs, tasks, focusedIndex, nowMs) {
342
107
  }
343
108
  rowText.visible = task !== undefined;
344
109
  rowText.content = task ? formatRowText(task, nowMs) : "";
345
- rowText.attributes = task && index === focusedIndex ? TextAttributes2.INVERSE : TextAttributes2.NONE;
110
+ rowText.attributes = TextAttributes.NONE;
346
111
  }
347
112
  }
348
- function isReadyState(state) {
349
- return state.kind === "ready";
350
- }
351
- function previousIndex(current, total) {
352
- return current === 0 ? total - 1 : current - 1;
353
- }
354
- function nextIndex(current, total) {
355
- return current === total - 1 ? 0 : current + 1;
356
- }
357
- function isUpKey(key) {
358
- return matchesKey2(key, "up") || matchesKey2(key, "k");
359
- }
360
- function isDownKey(key) {
361
- return matchesKey2(key, "down") || matchesKey2(key, "j");
362
- }
363
113
  function ModalList(props) {
364
- const Dialog = props.Dialog;
365
- const renderer = useRenderer2();
114
+ const renderer = useRenderer();
366
115
  const clock = props.clock ?? defaultClock;
367
116
  const now = {
368
117
  value: clock.now()
@@ -372,19 +121,12 @@ function ModalList(props) {
372
121
  kind: "loading"
373
122
  }
374
123
  };
375
- const focusedIndex = {
376
- value: 0
377
- };
378
124
  let disposed = false;
379
125
  let headerText;
380
126
  let footerText;
381
127
  let emptyBox;
382
128
  let emptyLineOne;
383
129
  let emptyLineTwo;
384
- let errorBox;
385
- let errorLineOne;
386
- let errorLineTwo;
387
- let errorLineThree;
388
130
  let rowsBox;
389
131
  const rowTexts = [];
390
132
  const refs = () => ({
@@ -393,10 +135,6 @@ function ModalList(props) {
393
135
  emptyBox,
394
136
  emptyLineOne,
395
137
  emptyLineTwo,
396
- errorBox,
397
- errorLineOne,
398
- errorLineTwo,
399
- errorLineThree,
400
138
  rowsBox,
401
139
  rowTexts
402
140
  });
@@ -411,47 +149,24 @@ function ModalList(props) {
411
149
  renderer.requestRender();
412
150
  return;
413
151
  }
414
- if (currentState.kind === "error") {
415
- renderErrorState(currentRefs, currentState.message);
416
- renderer.requestRender();
417
- return;
418
- }
419
152
  const tasks = currentState.tasks;
420
153
  if (tasks.length === 0) {
421
154
  renderEmptyView(currentRefs);
422
155
  renderer.requestRender();
423
156
  return;
424
157
  }
425
- renderTaskRows(currentRefs, tasks, focusedIndex.value, now.value);
158
+ renderTaskRows(currentRefs, tasks, now.value);
426
159
  renderer.requestRender();
427
160
  };
428
161
  const loadTasks = async () => {
429
- try {
430
- const response = await props.rpc.tasksList();
431
- if (disposed) {
432
- return;
433
- }
434
- const initialIndex = props.initialTaskId ? response.tasks.findIndex((task) => task.taskId === props.initialTaskId) : -1;
435
- if (initialIndex >= 0) {
436
- focusedIndex.value = initialIndex;
437
- } else if (response.tasks.length === 0) {
438
- focusedIndex.value = 0;
439
- } else {
440
- focusedIndex.value = Math.min(focusedIndex.value, response.tasks.length - 1);
441
- }
442
- state.value = {
443
- kind: "ready",
444
- tasks: response.tasks
445
- };
446
- } catch (error) {
447
- if (disposed) {
448
- return;
449
- }
450
- state.value = {
451
- kind: "error",
452
- message: errorMessage2(error)
453
- };
162
+ const response = await props.rpc.tasksList();
163
+ if (disposed) {
164
+ return;
454
165
  }
166
+ state.value = {
167
+ kind: "ready",
168
+ tasks: response.tasks
169
+ };
455
170
  renderView();
456
171
  };
457
172
  const intervalHandle = clock.setInterval(() => {
@@ -460,115 +175,71 @@ function ModalList(props) {
460
175
  renderView();
461
176
  }
462
177
  }, 1000);
463
- loadTasks();
464
- const handleKeyPress = (key) => {
465
- if (matchesKey2(key, "escape")) {
466
- key.preventDefault();
467
- props.onClose();
468
- return;
469
- }
470
- if (!isReadyState(state.value) || state.value.tasks.length === 0) {
471
- return;
472
- }
473
- if (isUpKey(key)) {
474
- key.preventDefault();
475
- focusedIndex.value = previousIndex(focusedIndex.value, state.value.tasks.length);
476
- renderView();
477
- return;
478
- }
479
- if (isDownKey(key)) {
480
- key.preventDefault();
481
- focusedIndex.value = nextIndex(focusedIndex.value, state.value.tasks.length);
482
- renderView();
178
+ loadTasks().catch((error) => {
179
+ if (disposed) {
483
180
  return;
484
181
  }
485
- if (matchesKey2(key, "c")) {
486
- key.preventDefault();
487
- props.onCancelTask?.(state.value.tasks[focusedIndex.value]);
488
- }
489
- };
490
- renderer.keyInput.on("keypress", handleKeyPress);
491
- onCleanup2(() => {
182
+ props.onLoadError?.(error);
183
+ });
184
+ onCleanup(() => {
492
185
  disposed = true;
493
- renderer.keyInput.off("keypress", handleKeyPress);
494
186
  clock.clearInterval(intervalHandle);
495
187
  });
496
- return _$createComponent2(Dialog, {
497
- get onClose() {
498
- return props.onClose;
499
- },
500
- size: "medium",
501
- get children() {
502
- var _el$ = _$createElement2("box"), _el$2 = _$createElement2("text"), _el$4 = _$createElement2("box"), _el$5 = _$createElement2("text"), _el$6 = _$createElement2("text"), _el$7 = _$createElement2("box"), _el$8 = _$createElement2("text"), _el$9 = _$createElement2("text"), _el$0 = _$createElement2("text"), _el$1 = _$createElement2("box"), _el$10 = _$createElement2("text"), _el$11 = _$createElement2("text"), _el$12 = _$createElement2("text"), _el$13 = _$createElement2("text"), _el$14 = _$createElement2("text"), _el$15 = _$createElement2("text"), _el$16 = _$createElement2("text"), _el$17 = _$createElement2("text"), _el$18 = _$createElement2("text"), _el$19 = _$createElement2("text"), _el$20 = _$createElement2("text");
503
- _$insertNode2(_el$, _el$2);
504
- _$insertNode2(_el$, _el$4);
505
- _$insertNode2(_el$, _el$7);
506
- _$insertNode2(_el$, _el$1);
507
- _$insertNode2(_el$, _el$20);
508
- _$setProp2(_el$, "flexDirection", "column");
509
- _$setProp2(_el$, "gap", 1);
510
- _$setProp2(_el$, "padding", 1);
511
- _$insertNode2(_el$2, _$createTextNode2(`Loading delegations\u2026`));
512
- var _ref$ = headerText;
513
- typeof _ref$ === "function" ? _$use2(_ref$, _el$2) : headerText = _el$2;
514
- _$insertNode2(_el$4, _el$5);
515
- _$insertNode2(_el$4, _el$6);
516
- var _ref$2 = emptyBox;
517
- typeof _ref$2 === "function" ? _$use2(_ref$2, _el$4) : emptyBox = _el$4;
518
- _$setProp2(_el$4, "flexDirection", "column");
519
- _$setProp2(_el$4, "flexGrow", 1);
520
- _$setProp2(_el$4, "justifyContent", "center");
521
- _$setProp2(_el$4, "visible", false);
522
- var _ref$3 = emptyLineOne;
523
- typeof _ref$3 === "function" ? _$use2(_ref$3, _el$5) : emptyLineOne = _el$5;
524
- var _ref$4 = emptyLineTwo;
525
- typeof _ref$4 === "function" ? _$use2(_ref$4, _el$6) : emptyLineTwo = _el$6;
526
- _$insertNode2(_el$7, _el$8);
527
- _$insertNode2(_el$7, _el$9);
528
- _$insertNode2(_el$7, _el$0);
529
- var _ref$5 = errorBox;
530
- typeof _ref$5 === "function" ? _$use2(_ref$5, _el$7) : errorBox = _el$7;
531
- _$setProp2(_el$7, "flexDirection", "column");
532
- _$setProp2(_el$7, "flexGrow", 1);
533
- _$setProp2(_el$7, "justifyContent", "center");
534
- _$setProp2(_el$7, "visible", false);
535
- var _ref$6 = errorLineOne;
536
- typeof _ref$6 === "function" ? _$use2(_ref$6, _el$8) : errorLineOne = _el$8;
537
- var _ref$7 = errorLineTwo;
538
- typeof _ref$7 === "function" ? _$use2(_ref$7, _el$9) : errorLineTwo = _el$9;
539
- var _ref$8 = errorLineThree;
540
- typeof _ref$8 === "function" ? _$use2(_ref$8, _el$0) : errorLineThree = _el$0;
541
- _$insertNode2(_el$1, _el$10);
542
- _$insertNode2(_el$1, _el$11);
543
- _$insertNode2(_el$1, _el$12);
544
- _$insertNode2(_el$1, _el$13);
545
- _$insertNode2(_el$1, _el$14);
546
- _$insertNode2(_el$1, _el$15);
547
- _$insertNode2(_el$1, _el$16);
548
- _$insertNode2(_el$1, _el$17);
549
- _$insertNode2(_el$1, _el$18);
550
- _$insertNode2(_el$1, _el$19);
551
- var _ref$9 = rowsBox;
552
- typeof _ref$9 === "function" ? _$use2(_ref$9, _el$1) : rowsBox = _el$1;
553
- _$setProp2(_el$1, "flexDirection", "column");
554
- _$setProp2(_el$1, "flexGrow", 1);
555
- _$setProp2(_el$1, "visible", false);
556
- _$use2((node) => rowTexts[0] = node, _el$10);
557
- _$use2((node) => rowTexts[1] = node, _el$11);
558
- _$use2((node) => rowTexts[2] = node, _el$12);
559
- _$use2((node) => rowTexts[3] = node, _el$13);
560
- _$use2((node) => rowTexts[4] = node, _el$14);
561
- _$use2((node) => rowTexts[5] = node, _el$15);
562
- _$use2((node) => rowTexts[6] = node, _el$16);
563
- _$use2((node) => rowTexts[7] = node, _el$17);
564
- _$use2((node) => rowTexts[8] = node, _el$18);
565
- _$use2((node) => rowTexts[9] = node, _el$19);
566
- _$insertNode2(_el$20, _$createTextNode2(`Esc close`));
567
- var _ref$0 = footerText;
568
- typeof _ref$0 === "function" ? _$use2(_ref$0, _el$20) : footerText = _el$20;
569
- return _el$;
570
- }
571
- });
188
+ return (() => {
189
+ var _el$ = _$createElement("box"), _el$2 = _$createElement("text"), _el$4 = _$createElement("box"), _el$5 = _$createElement("text"), _el$6 = _$createElement("text"), _el$7 = _$createElement("box"), _el$8 = _$createElement("text"), _el$9 = _$createElement("text"), _el$0 = _$createElement("text"), _el$1 = _$createElement("text"), _el$10 = _$createElement("text"), _el$11 = _$createElement("text"), _el$12 = _$createElement("text"), _el$13 = _$createElement("text"), _el$14 = _$createElement("text"), _el$15 = _$createElement("text"), _el$16 = _$createElement("text");
190
+ _$insertNode(_el$, _el$2);
191
+ _$insertNode(_el$, _el$4);
192
+ _$insertNode(_el$, _el$7);
193
+ _$insertNode(_el$, _el$16);
194
+ _$setProp(_el$, "flexDirection", "column");
195
+ _$setProp(_el$, "gap", 1);
196
+ _$setProp(_el$, "padding", 1);
197
+ _$setProp(_el$, "width", "100%");
198
+ _$insertNode(_el$2, _$createTextNode(`Loading delegations\u2026`));
199
+ var _ref$ = headerText;
200
+ typeof _ref$ === "function" ? _$use(_ref$, _el$2) : headerText = _el$2;
201
+ _$insertNode(_el$4, _el$5);
202
+ _$insertNode(_el$4, _el$6);
203
+ var _ref$2 = emptyBox;
204
+ typeof _ref$2 === "function" ? _$use(_ref$2, _el$4) : emptyBox = _el$4;
205
+ _$setProp(_el$4, "flexDirection", "column");
206
+ _$setProp(_el$4, "flexGrow", 1);
207
+ _$setProp(_el$4, "justifyContent", "center");
208
+ _$setProp(_el$4, "visible", false);
209
+ var _ref$3 = emptyLineOne;
210
+ typeof _ref$3 === "function" ? _$use(_ref$3, _el$5) : emptyLineOne = _el$5;
211
+ var _ref$4 = emptyLineTwo;
212
+ typeof _ref$4 === "function" ? _$use(_ref$4, _el$6) : emptyLineTwo = _el$6;
213
+ _$insertNode(_el$7, _el$8);
214
+ _$insertNode(_el$7, _el$9);
215
+ _$insertNode(_el$7, _el$0);
216
+ _$insertNode(_el$7, _el$1);
217
+ _$insertNode(_el$7, _el$10);
218
+ _$insertNode(_el$7, _el$11);
219
+ _$insertNode(_el$7, _el$12);
220
+ _$insertNode(_el$7, _el$13);
221
+ _$insertNode(_el$7, _el$14);
222
+ _$insertNode(_el$7, _el$15);
223
+ var _ref$5 = rowsBox;
224
+ typeof _ref$5 === "function" ? _$use(_ref$5, _el$7) : rowsBox = _el$7;
225
+ _$setProp(_el$7, "flexDirection", "column");
226
+ _$setProp(_el$7, "flexGrow", 1);
227
+ _$setProp(_el$7, "visible", false);
228
+ _$use((node) => rowTexts[0] = node, _el$8);
229
+ _$use((node) => rowTexts[1] = node, _el$9);
230
+ _$use((node) => rowTexts[2] = node, _el$0);
231
+ _$use((node) => rowTexts[3] = node, _el$1);
232
+ _$use((node) => rowTexts[4] = node, _el$10);
233
+ _$use((node) => rowTexts[5] = node, _el$11);
234
+ _$use((node) => rowTexts[6] = node, _el$12);
235
+ _$use((node) => rowTexts[7] = node, _el$13);
236
+ _$use((node) => rowTexts[8] = node, _el$14);
237
+ _$use((node) => rowTexts[9] = node, _el$15);
238
+ _$insertNode(_el$16, _$createTextNode(`Esc close`));
239
+ var _ref$6 = footerText;
240
+ typeof _ref$6 === "function" ? _$use(_ref$6, _el$16) : footerText = _el$16;
241
+ return _el$;
242
+ })();
572
243
  }
573
244
 
574
245
  // src/tui/rpc-client.ts
@@ -14200,7 +13871,7 @@ function summarizeIssues(issues) {
14200
13871
  return `${path}: ${issue2.message}`;
14201
13872
  });
14202
13873
  }
14203
- function errorMessage3(error48) {
13874
+ function errorMessage(error48) {
14204
13875
  if (error48 instanceof Error && error48.message.length > 0) {
14205
13876
  return error48.message;
14206
13877
  }
@@ -14324,7 +13995,7 @@ function createRpcClient(options = {}) {
14324
13995
  signal: requestSignal.signal
14325
13996
  });
14326
13997
  } catch (error48) {
14327
- throw new RpcUnreachableError(`Failed to reach Copilot delegate RPC at ${url2}: ${errorMessage3(error48)}`, { cause: error48 });
13998
+ throw new RpcUnreachableError(`Failed to reach Copilot delegate RPC at ${url2}: ${errorMessage(error48)}`, { cause: error48 });
14328
13999
  } finally {
14329
14000
  requestSignal.cleanup();
14330
14001
  }
@@ -14377,37 +14048,39 @@ function createRpcClient(options = {}) {
14377
14048
  }
14378
14049
 
14379
14050
  // src/tui/index.tsx
14051
+ function errorMessage2(error48) {
14052
+ if (error48 instanceof Error && error48.message.trim().length > 0) {
14053
+ return error48.message.trim();
14054
+ }
14055
+ return "Unknown RPC error.";
14056
+ }
14380
14057
  var tui = async (api2) => {
14381
14058
  const rpc = createRpcClient();
14382
14059
  const closeDialog = () => {
14383
14060
  api2.ui.dialog.clear();
14384
14061
  };
14385
- const openList = (initialTaskId) => {
14062
+ const showUnavailableAlert = (error48) => {
14063
+ api2.ui.dialog.setSize("medium");
14386
14064
  api2.ui.dialog.replace(() => {
14387
- return _$createComponent3(ModalList, {
14388
- get Dialog() {
14389
- return api2.ui.Dialog;
14065
+ return _$createComponent(api2.ui.DialogAlert, {
14066
+ title: "Status unavailable.",
14067
+ get message() {
14068
+ return errorMessage2(error48);
14390
14069
  },
14391
- onClose: closeDialog,
14392
- onCancelTask: openConfirmCard,
14393
- initialTaskId,
14394
- rpc
14070
+ onConfirm: closeDialog
14395
14071
  });
14396
- }, closeDialog);
14072
+ });
14397
14073
  };
14398
- const openConfirmCard = (task) => {
14074
+ const openList = (initialTaskId) => {
14075
+ api2.ui.dialog.setSize("large");
14399
14076
  api2.ui.dialog.replace(() => {
14400
- return _$createComponent3(ConfirmCard, {
14401
- get Dialog() {
14402
- return api2.ui.Dialog;
14403
- },
14404
- task,
14405
- rpc,
14406
- onConfirm: () => openList(task.taskId),
14407
- onCancel: () => openList(task.taskId),
14408
- onDismissAfterError: () => openList(task.taskId)
14077
+ return _$createComponent(ModalList, {
14078
+ onClose: closeDialog,
14079
+ onLoadError: showUnavailableAlert,
14080
+ initialTaskId,
14081
+ rpc
14409
14082
  });
14410
- }, closeDialog);
14083
+ });
14411
14084
  };
14412
14085
  const unregister = api2.command.register(() => [{
14413
14086
  title: "Copilot Status",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-copilot-delegate",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "OpenCode plugin that delegates tasks to GitHub Copilot CLI as background subprocesses",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",