@muwi/herdr-app 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/muwi/main.js +114 -7
- package/package.json +3 -3
package/app/muwi/main.js
CHANGED
|
@@ -186,6 +186,8 @@ const SAMPLE = (() => {
|
|
|
186
186
|
{ ...work, work: "between", title: "다음 노드를 준비하는 작업", state: "doing", between: "working", past: false, active: [] },
|
|
187
187
|
{ ...work, work: "quiet", title: "세션이 멈춘 작업", state: "waiting", quiet: "stopped", past: false, active: [{ id: "y", title: "하던 일", status: "doing", quiet: "stopped" }] },
|
|
188
188
|
{ ...work, work: "old", title: "지난 작업", state: "done", past: true, active: [] },
|
|
189
|
+
{ ...work, work: "finished", title: "끝난 작업", state: "done", past: false, active: [] },
|
|
190
|
+
{ ...work, work: "shelved", title: "보관한 작업", state: "done", archived: true, past: false, active: [] },
|
|
189
191
|
],
|
|
190
192
|
errors: [],
|
|
191
193
|
sessions: [{ key: "s1", terminal: "t1", work: "sample", seenAt: "2026-01-01T00:00:00.000Z" }],
|
|
@@ -240,6 +242,13 @@ export default class Muwi extends View {
|
|
|
240
242
|
this.focusKey = null;
|
|
241
243
|
this.stale = false;
|
|
242
244
|
this.showPast = false;
|
|
245
|
+
/** 보관한 작업 묶음을 펼쳤는가, 마우스가 올라간 작업 줄 (보관 버튼을 보여 준다), 보관하거나 꺼내는 중 */
|
|
246
|
+
this.showShelf = false;
|
|
247
|
+
this.hoverRow = null;
|
|
248
|
+
this.shelving = false;
|
|
249
|
+
/** 목록 아래의 알림: 보관·꺼내기의 결과와 되돌리기, 못 했을 때의 까닭. 잠시 뒤에 사라진다 */
|
|
250
|
+
this.shelfToast = null;
|
|
251
|
+
this.toastSeq = 0;
|
|
243
252
|
/** 접어 둔 묶음 (작업 목록의 "응답 대기" 같은 것) */
|
|
244
253
|
this.folded = new Set();
|
|
245
254
|
/** 키보드가 있는 터미널과 그 작업. 바뀔 때만 따라간다 (사람이 고른 것을 덮어쓰지 않게) */
|
|
@@ -277,6 +286,9 @@ export default class Muwi extends View {
|
|
|
277
286
|
this.data = SAMPLE;
|
|
278
287
|
this.node = "impl";
|
|
279
288
|
this.tab = "node";
|
|
289
|
+
// herdr-app check는 견본으로 보관함과 알림 줄까지 그려 본다
|
|
290
|
+
this.showShelf = true;
|
|
291
|
+
this.shelfToast = { id: 0, text: "1개 보관했어요. 목록 맨 아래 \"보관\"에 있어요", undo: { works: ["finished"], on: false } };
|
|
280
292
|
return;
|
|
281
293
|
}
|
|
282
294
|
this.load(cx);
|
|
@@ -954,7 +966,8 @@ export default class Muwi extends View {
|
|
|
954
966
|
*/
|
|
955
967
|
groups(t, works, links) {
|
|
956
968
|
const c = this.colors(t);
|
|
957
|
-
|
|
969
|
+
// 보관한 작업은 맨 아래 "보관"에만 둔다
|
|
970
|
+
const current = works.filter((w) => !w.past && !w.archived);
|
|
958
971
|
const open = new Set(current.filter((w) => w.state !== "done").map((w) => w.work));
|
|
959
972
|
const byWork = new Map();
|
|
960
973
|
const free = [];
|
|
@@ -988,17 +1001,22 @@ export default class Muwi extends View {
|
|
|
988
1001
|
}
|
|
989
1002
|
|
|
990
1003
|
/**
|
|
991
|
-
* 작업 목록: 묶음 머리와 줄들. 끝났거나 멈춘 채로 오래된 작업(past)은 맨 아래에 "지난 작업 N개"로 접어 둔다.
|
|
1004
|
+
* 작업 목록: 묶음 머리와 줄들. 끝났거나 멈춘 채로 오래된 작업(past)은 맨 아래에 "지난 작업 N개"로 접어 둔다.
|
|
1005
|
+
* 사람이 보관한 작업(muwi archive)은 그 아래 "보관 N개"로 접어 둔다. 둘 다 지우지는 않는다.
|
|
992
1006
|
* compact: 사이드바를 좁혀 아이콘만 보일 때
|
|
993
1007
|
*/
|
|
994
1008
|
list(t, works, groups, selected, now, fill, compact) {
|
|
995
1009
|
const c = this.colors(t);
|
|
996
1010
|
const box = fill ? v_flex().flex_1().min_h(0) : v_flex().flex_none();
|
|
1011
|
+
const outer = fill ? v_flex().flex_1().min_h(0) : v_flex().flex_none();
|
|
997
1012
|
const row = (item) => (item.kind === "work" ? this.workRow(t, c, item, selected, now, compact) : this.agentRow(t, item.a, compact));
|
|
998
1013
|
const past = works.filter((w) => w.past);
|
|
1014
|
+
const shelf = works.filter((w) => w.archived);
|
|
999
1015
|
// 접어 둔 작업을 보고 있으면 펼쳐 둔다
|
|
1000
1016
|
const open = this.showPast || past.some((w) => w.work === selected);
|
|
1001
|
-
|
|
1017
|
+
// 보관함은 사람이 펼칠 때만 연다 (모두 보관한 뒤에 수십 줄이 한꺼번에 펼쳐지지 않게). 어디로 갔는지는 알림이 알려 준다
|
|
1018
|
+
const openShelf = this.showShelf;
|
|
1019
|
+
return outer.child(box.id("works").overflow_y_scrollbar().px(compact ? 4 : 8).pb(8).gap(1)
|
|
1002
1020
|
.children(groups.flatMap((g) => [
|
|
1003
1021
|
...(compact ? [] : [this.groupHead(t, g)]),
|
|
1004
1022
|
...(this.folded.has(g.id) && !compact ? [] : g.items.map(row)),
|
|
@@ -1009,7 +1027,82 @@ export default class Muwi extends View {
|
|
|
1009
1027
|
.on_click((_e, cx) => { this.showPast = !open; cx.notify(); })
|
|
1010
1028
|
.child(div().w(14).flex_none().text_size(10).text_color(t.dim).child(open ? "▾" : "▸"))
|
|
1011
1029
|
.child(div().flex_1().text_size(11).text_color(t.dim).child(`지난 작업 ${past.length}개`)))
|
|
1012
|
-
.when(open, (el2) => el2.children(past.map((w) => row({ kind: "work", w, agents: [], ask: false })))))
|
|
1030
|
+
.when(open, (el2) => el2.children(past.map((w) => row({ kind: "work", w, agents: [], ask: false })))))
|
|
1031
|
+
.when(shelf.length > 0 && !compact, (el) => el
|
|
1032
|
+
.child(h_flex().id("shelf-toggle").px(8).py(6).mt(4).gap(8).items_center().rounded(7).cursor_pointer()
|
|
1033
|
+
.hover((s) => s.bg(t.hover))
|
|
1034
|
+
.on_click((_e, cx) => { this.showShelf = !openShelf; cx.notify(); })
|
|
1035
|
+
.child(div().w(14).flex_none().text_size(10).text_color(t.dim).child(openShelf ? "▾" : "▸"))
|
|
1036
|
+
.child(div().flex_1().text_size(11).text_color(t.dim).child(`보관 ${shelf.length}개`)))
|
|
1037
|
+
.when(openShelf, (el2) => el2.children(shelf.map((w) => row({ kind: "work", w, agents: [], ask: false }))))))
|
|
1038
|
+
// 알림은 스크롤 밖, 목록 아래에 붙인다 (목록이 길어도 보인다)
|
|
1039
|
+
.when(Boolean(this.shelfToast) && !compact, (el) => el.child(this.toastBar(t)));
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/** 목록 아래의 알림 줄: 결과, 되돌리기, 닫기 */
|
|
1043
|
+
toastBar(t) {
|
|
1044
|
+
const n = this.shelfToast;
|
|
1045
|
+
return h_flex().id("shelf-toast").flex_none().mx(8).mb(8).px(10).py(7).gap(8).items_center().rounded(7)
|
|
1046
|
+
.bg(t.surface).border_1().border_color(n.error ? t.blocked : t.border).text_size(11)
|
|
1047
|
+
.child(div().flex_1().min_w(0).text_color(n.error ? t.blocked : t.foreground).child(n.text))
|
|
1048
|
+
.when(Boolean(n.undo), (el) => el.child(div().id("shelf-undo").flex_none().px(6).py(2).rounded(5).font_medium().text_color(t.accent).cursor_pointer()
|
|
1049
|
+
.hover((s) => s.bg(t.hover))
|
|
1050
|
+
.on_click((_e, cx) => { const u = n.undo; this.shelfToast = null; this.shelve(u.works, u.on, cx); })
|
|
1051
|
+
.child("되돌리기")))
|
|
1052
|
+
.child(div().id("shelf-toast-close").flex_none().px(4).text_color(t.dim).cursor_pointer()
|
|
1053
|
+
.hover((s) => s.text_color(t.foreground))
|
|
1054
|
+
.tooltip("닫기")
|
|
1055
|
+
.on_click((_e, cx) => { this.shelfToast = null; cx.notify(); })
|
|
1056
|
+
.child("×"));
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* 작업을 보관하거나 꺼낸다 (muwi archive·unarchive). 기록을 바꾸는 것은 muwi 명령이 하고, 이 칸은 다시 읽을 뿐이다.
|
|
1061
|
+
* args: 작업 이름들, 또는 ["--done"] (끝난 작업 모두)
|
|
1062
|
+
*/
|
|
1063
|
+
shelve(args, on, cx) {
|
|
1064
|
+
if (this.shelving) return;
|
|
1065
|
+
this.shelving = true;
|
|
1066
|
+
cx.notify();
|
|
1067
|
+
cx.spawn(async (cx) => {
|
|
1068
|
+
const r = await runMuwi([on ? "archive" : "unarchive", ...args], { timeout: 10000 }).catch((e) => ({ code: 1, stderr: String(e?.message ?? e) }));
|
|
1069
|
+
this.shelving = false;
|
|
1070
|
+
this.stale = true;
|
|
1071
|
+
let toast;
|
|
1072
|
+
if (r?.code !== 0) toast = { text: `${on ? "보관" : "꺼내기"}하지 못했어요: ${(r?.stderr || r?.stdout || "").trim().split("\n")[0]}`, error: true };
|
|
1073
|
+
else {
|
|
1074
|
+
// muwi가 실제로 보관하거나 꺼낸 작업들. 되돌리기는 이 작업들만 되돌린다
|
|
1075
|
+
const moved = (r.stdout ?? "").split("\n").map((l) => /^(.+?): (보관했어요|목록으로 꺼냈어요)/.exec(l)?.[1]).filter(Boolean);
|
|
1076
|
+
toast = moved.length
|
|
1077
|
+
? { text: on ? `${moved.length}개 보관했어요. 목록 맨 아래 "보관"에 있어요` : `${moved.length}개를 목록으로 꺼냈어요`, undo: { works: moved, on: !on } }
|
|
1078
|
+
: { text: (r.stdout ?? "").trim().split("\n")[0] || "바뀐 것이 없어요" };
|
|
1079
|
+
}
|
|
1080
|
+
const id = ++this.toastSeq;
|
|
1081
|
+
this.shelfToast = { ...toast, id };
|
|
1082
|
+
cx.notify();
|
|
1083
|
+
// 잠시 뒤에 사라진다. 그 사이에 다른 알림이 떴으면 그대로 둔다
|
|
1084
|
+
await cx.sleep(toast.error ? 10000 : 6000);
|
|
1085
|
+
if (this.shelfToast?.id === id) {
|
|
1086
|
+
this.shelfToast = null;
|
|
1087
|
+
cx.notify();
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* 끝났거나 멈춘 작업 줄의 버튼: 보관 (보관한 작업은 꺼내기). 마우스를 올린 줄과 고른 줄에 보인다.
|
|
1094
|
+
* 줄 오른쪽 위에 겹쳐 띄워서 줄의 모양이 흔들리지 않게 한다
|
|
1095
|
+
*/
|
|
1096
|
+
shelveButton(t, w, selected) {
|
|
1097
|
+
const on = !w.archived;
|
|
1098
|
+
return div().id(`shelve-${w.work}`).absolute().top(5).right(6).px(7).py(2).rounded(5).text_size(10.5).text_color(t.muted).cursor_pointer()
|
|
1099
|
+
.bg(selected ? t.selected : t.hover).border_1().border_color(t.border)
|
|
1100
|
+
.hover((s) => s.text_color(t.foreground).bg(t.surface))
|
|
1101
|
+
.tooltip(on ? "목록에서 치워요. 기록은 그대로예요 (다시 시작하면 돌아와요)" : "목록으로 꺼내요")
|
|
1102
|
+
// 줄을 누른 것으로 치지 않는다 (그 작업을 고르지 않는다)
|
|
1103
|
+
.on_mouse_down("left", (_e, cx) => cx.stop_propagation())
|
|
1104
|
+
.on_click((_e, cx) => { cx.stop_propagation(); this.shelve([w.work], on, cx); })
|
|
1105
|
+
.child(on ? "보관" : "꺼내기");
|
|
1013
1106
|
}
|
|
1014
1107
|
|
|
1015
1108
|
/** 묶음 머리. 누르면 접는다 */
|
|
@@ -1021,6 +1114,13 @@ export default class Muwi extends View {
|
|
|
1021
1114
|
.child(div().truncate().text_color(g.color).child(g.label))
|
|
1022
1115
|
.child(div().text_color(t.dim).child(String(g.items.length)))
|
|
1023
1116
|
.child(div().flex_1())
|
|
1117
|
+
// 끝난 작업을 한 번에 보관한다
|
|
1118
|
+
.when(g.id === "done", (el) => el.child(div().id("shelve-done").flex_none().px(7).py(2).rounded(5).text_size(10.5).font_normal().text_color(t.dim).cursor_pointer()
|
|
1119
|
+
.hover((s) => s.text_color(t.foreground).bg(t.hover))
|
|
1120
|
+
.tooltip(`끝난 작업 ${g.items.length}개를 모두 보관해요. 목록에서만 빠지고 기록은 그대로예요 (되돌릴 수 있어요)`)
|
|
1121
|
+
.on_mouse_down("left", (_e, cx) => cx.stop_propagation())
|
|
1122
|
+
.on_click((_e, cx) => { cx.stop_propagation(); this.shelve(["--done"], true, cx); })
|
|
1123
|
+
.child(this.shelving ? "보관하는 중…" : "모두 보관")))
|
|
1024
1124
|
.when(!open, (el) => el.child(div().text_size(10).text_color(t.dim).child("▸")));
|
|
1025
1125
|
}
|
|
1026
1126
|
|
|
@@ -1080,9 +1180,15 @@ export default class Muwi extends View {
|
|
|
1080
1180
|
: first ? `${first.title}${w.active.length > 1 ? ` 외 ${w.active.length - 1}` : ""}${first.closed ? " · 세션이 닫힘" : w.quiet ? ` · ${QUIET_NAME[w.quiet]}` : first.note ? ` · ${first.note}` : ""}`
|
|
1081
1181
|
// 하는 노드가 없다 (몇 단계째인지는 오른쪽에 나온다)
|
|
1082
1182
|
: (w.between && BETWEEN_NAME[w.between]) || "다음 노드 전";
|
|
1083
|
-
|
|
1183
|
+
// 끝났거나 멈춘 작업(과 보관한 작업)은 마우스를 올리면 보관(꺼내기) 버튼이 나온다
|
|
1184
|
+
const shelvable = w.archived || w.state === "done" || w.state === "stalled";
|
|
1185
|
+
return h_flex().id(`work-${w.work}`).relative().px(8).py(6).gap(8).items_center().rounded(7)
|
|
1084
1186
|
.bg(on ? t.selected : t.chrome).hover((s) => s.bg(on ? t.selected : t.hover)).cursor_pointer()
|
|
1085
1187
|
.on_click(click)
|
|
1188
|
+
.when(shelvable, (el) => el.on_hover((hovered, cx) => {
|
|
1189
|
+
const next = hovered ? w.work : this.hoverRow === w.work ? null : this.hoverRow;
|
|
1190
|
+
if (next !== this.hoverRow) { this.hoverRow = next; cx.notify(); }
|
|
1191
|
+
}))
|
|
1086
1192
|
.child(this.workMark(t, w, c, item.ask))
|
|
1087
1193
|
.child(v_flex().flex_1().min_w(0).gap(1)
|
|
1088
1194
|
.child(div().truncate().text_size(12).text_color(on || w.unread ? t.foreground : t.muted).when(on || w.unread, (el) => el.font_medium()).child(w.title ?? w.work))
|
|
@@ -1090,7 +1196,8 @@ export default class Muwi extends View {
|
|
|
1090
1196
|
.child(div().flex_1().min_w(0).truncate().text_color(item.ask ? c.waiting : c[w.state] ?? t.dim).child(line))
|
|
1091
1197
|
// 끝나지 않은 작업은 몇 단계째인지: 끝난 노드 / 전체
|
|
1092
1198
|
// 오른쪽: 몇 단계째인지와 작업 시간 (노드들이 작업한 시간의 합. 작업 중이면 초마다 늘어난다). 끝난 작업은 작업 시간과 끝난 때
|
|
1093
|
-
.child(div().flex_none().text_color(t.dim).child(this.rowMeta(w, now)))))
|
|
1199
|
+
.child(div().flex_none().text_color(t.dim).child(this.rowMeta(w, now)))))
|
|
1200
|
+
.when(shelvable && (this.hoverRow === w.work || on), (el) => el.child(this.shelveButton(t, w, on)));
|
|
1094
1201
|
}
|
|
1095
1202
|
|
|
1096
1203
|
/** 계획 없이 일하는 세션 한 줄 (Herdr의 Agents 칸과 같은 모양). 누르면 그 터미널로 간다 */
|
|
@@ -1220,7 +1327,7 @@ export default class Muwi extends View {
|
|
|
1220
1327
|
chips(t, works, selected, links) {
|
|
1221
1328
|
const c = this.colors(t);
|
|
1222
1329
|
return h_flex().id("chips").flex_none().h(34).px(10).gap(6).items_center().overflow_x_hidden().border_b(1).border_color(t.border)
|
|
1223
|
-
.children([...works.filter((w) => !w.past), ...works.filter((w) => w.past)].slice(0, 8).map((w) => {
|
|
1330
|
+
.children([...works.filter((w) => !w.past && !w.archived), ...works.filter((w) => w.past)].slice(0, 8).map((w) => {
|
|
1224
1331
|
const on = w.work === selected;
|
|
1225
1332
|
return h_flex().id(`chip-${w.work}`).h(22).px(8).gap(5).flex_none().items_center().rounded(11)
|
|
1226
1333
|
.bg(on ? t.selected : t.surface).border_1().border_color(on ? t.accent : t.border).cursor_pointer()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muwi/herdr-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "muwi를 Herdr 앱에서 보기: 작업 목록과 그래프 칸, 레이아웃",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"./package.json": "./package.json"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@muwi/core": "0.
|
|
16
|
-
"@muwi/herdr": "0.
|
|
15
|
+
"@muwi/core": "0.9.0",
|
|
16
|
+
"@muwi/herdr": "0.9.0"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=24"
|