@sealant/mend 0.35.1 → 0.36.0-next.1006
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/README.md +39 -7
- package/dist/{chunk-SMH65F6Z.js → chunk-5VCZGIDO.js} +1179 -11
- package/dist/{dashboard-MGR4YUFD.js → dashboard-6LXBWCM5.js} +1345 -348
- package/dist/main.js +11069 -1959
- package/man/mend-accounts.1 +1 -1
- package/man/mend-adopt.1 +4 -4
- package/man/mend-agent-logins.1 +20 -0
- package/man/mend-attach.1 +1 -1
- package/man/mend-codex.1 +9 -7
- package/man/mend-completions.1 +1 -1
- package/man/mend-connect-pi.1 +28 -0
- package/man/mend-connect.1 +6 -2
- package/man/mend-continue.1 +1 -1
- package/man/mend-doctor.1 +2 -2
- package/man/mend-dotfiles-repo.1 +1 -1
- package/man/mend-dotfiles-sync.1 +1 -1
- package/man/mend-dotfiles.1 +1 -1
- package/man/mend-env-cluster.1 +1 -1
- package/man/mend-env-load.1 +1 -1
- package/man/mend-env-show.1 +1 -1
- package/man/mend-folder-create.1 +1 -1
- package/man/mend-folder-list.1 +1 -1
- package/man/mend-folder-push.1 +1 -1
- package/man/mend-folder-rm.1 +1 -1
- package/man/mend-git-author.1 +1 -1
- package/man/mend-help.1 +1 -1
- package/man/mend-invite.1 +1 -1
- package/man/mend-keys-init.1 +1 -1
- package/man/mend-keys-mode.1 +1 -1
- package/man/mend-keys-share.1 +1 -1
- package/man/mend-keys-show.1 +1 -1
- package/man/mend-land.1 +1 -1
- package/man/mend-login.1 +10 -2
- package/man/mend-logout.1 +1 -1
- package/man/mend-logs.1 +37 -0
- package/man/mend-man.1 +1 -1
- package/man/mend-members.1 +1 -1
- package/man/mend-memory-import.1 +23 -0
- package/man/mend-memory-rm.1 +15 -0
- package/man/mend-memory-show.1 +15 -0
- package/man/mend-memory.1 +32 -0
- package/man/mend-models.1 +22 -0
- package/man/mend-operator-exposure.1 +2 -2
- package/man/mend-operator-gate.1 +1 -1
- package/man/mend-operator-grant-owner.1 +1 -1
- package/man/mend-operator-org-create.1 +1 -1
- package/man/mend-operator-org-invite-owner.1 +1 -1
- package/man/mend-operator-org-list.1 +1 -1
- package/man/mend-operator-org-rename.1 +1 -1
- package/man/mend-operator-reset-link.1 +1 -1
- package/man/mend-pair.1 +3 -1
- package/man/mend-projects.1 +10 -2
- package/man/mend-pull.1 +6 -3
- package/man/mend-refresh.1 +1 -1
- package/man/mend-rejoin.1 +1 -1
- package/man/mend-resume.1 +1 -1
- package/man/mend-run.1 +37 -4
- package/man/mend-secrets-add.1 +24 -0
- package/man/mend-secrets-rm.1 +14 -0
- package/man/mend-secrets.1 +18 -0
- package/man/mend-server-logs.1 +1 -1
- package/man/mend-server-restart.1 +1 -1
- package/man/mend-server-setup.1 +125 -8
- package/man/mend-server-start.1 +1 -1
- package/man/mend-server-status.1 +7 -3
- package/man/mend-server-stop.1 +3 -3
- package/man/mend-server-upgrade.1 +14 -2
- package/man/mend-server.1 +1 -1
- package/man/mend-service-add.1 +1 -1
- package/man/mend-service-connect.1 +1 -1
- package/man/mend-service-init.1 +1 -1
- package/man/mend-service-list.1 +10 -4
- package/man/mend-service-logs.1 +3 -1
- package/man/mend-service-restart.1 +1 -1
- package/man/mend-service-run.1 +16 -4
- package/man/mend-service-stop.1 +1 -1
- package/man/mend-session-share.1 +13 -3
- package/man/mend-sessions.1 +3 -1
- package/man/mend-shell.1 +1 -1
- package/man/mend-skills-push.1 +1 -1
- package/man/mend-skills.1 +1 -1
- package/man/mend-snake.1 +2 -2
- package/man/mend-ssh-keys-remove.1 +18 -0
- package/man/mend-ssh-keys.1 +15 -0
- package/man/mend-ssh-setup.1 +2 -2
- package/man/mend-ssh.1 +13 -4
- package/man/mend-stop.1 +1 -1
- package/man/mend-ui.1 +4 -2
- package/man/mend-uninstall.1 +9 -3
- package/man/mend-version.1 +1 -1
- package/man/mend-wait.1 +28 -0
- package/man/mend-workspace-replace.1 +24 -0
- package/man/mend-worktrees-rm.1 +29 -0
- package/man/mend-worktrees.1 +2 -2
- package/man/mend.1 +61 -7
- package/package.json +21 -40
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ADOPT_MODE_ORDER,
|
|
2
3
|
HARNESS_COMMANDS,
|
|
3
4
|
LIVE_STATUSES,
|
|
4
|
-
RepositoryCloneUrl,
|
|
5
5
|
agentIsLive,
|
|
6
6
|
agentOutcome,
|
|
7
7
|
captureLineOf,
|
|
8
|
+
checkpointSourceWords,
|
|
8
9
|
createSseParser,
|
|
9
10
|
cwdFacts,
|
|
11
|
+
deriveAdoptOffer,
|
|
10
12
|
eventFamilies,
|
|
13
|
+
hasPersonFacts,
|
|
11
14
|
isPendingId,
|
|
15
|
+
launchPhaseOf,
|
|
12
16
|
matchProjectByCwd,
|
|
13
17
|
mayStillBeWorking,
|
|
18
|
+
noReviewFollowUpLine,
|
|
14
19
|
normalizeProjectName,
|
|
15
20
|
pendingId,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
refusedAdoptOffer,
|
|
22
|
+
resumesOwnHarness,
|
|
23
|
+
serviceViewHostPort,
|
|
24
|
+
serviceViewStatus,
|
|
25
|
+
servicesHoldLine,
|
|
26
|
+
sessionWorkspaceLines,
|
|
27
|
+
submitDashboardAdoption,
|
|
28
|
+
takesReviewFollowUp,
|
|
29
|
+
withoutLaunchPhase,
|
|
30
|
+
workspaceLineList,
|
|
31
|
+
workspaceReadsOf,
|
|
32
|
+
worktreeJoinLine,
|
|
33
|
+
wrapWords
|
|
34
|
+
} from "./chunk-5VCZGIDO.js";
|
|
19
35
|
|
|
20
36
|
// src/dashboard.tsx
|
|
21
37
|
import { CliRenderEvents, createCliRenderer } from "@opentui/core";
|
|
@@ -29,28 +45,16 @@ import {
|
|
|
29
45
|
} from "@tanstack/react-query";
|
|
30
46
|
import { useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState3, useSyncExternalStore } from "react";
|
|
31
47
|
|
|
32
|
-
// src/dashboard-adoption.ts
|
|
33
|
-
var deriveAdoptOffer = (facts) => {
|
|
34
|
-
if (facts.repoRoot === null || facts.originUrl === null || repositoryCloneUrlIssue(facts.originUrl) !== null)
|
|
35
|
-
return null;
|
|
36
|
-
return {
|
|
37
|
-
source: RepositoryCloneUrl.make(facts.originUrl),
|
|
38
|
-
name: normalizeProjectName(facts.repoRoot.split("/").at(-1) ?? "project"),
|
|
39
|
-
modeIndex: 0
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
var submitDashboardAdoption = async (api, input) => {
|
|
43
|
-
const issue = repositoryCloneUrlIssue(input.source);
|
|
44
|
-
if (issue !== null) return { kind: "invalid-source", message: issue };
|
|
45
|
-
const project = await api("POST", "/projects", {
|
|
46
|
-
name: input.name,
|
|
47
|
-
source: RepositoryCloneUrl.make(input.source),
|
|
48
|
-
gitAuthMode: input.gitAuthMode
|
|
49
|
-
});
|
|
50
|
-
return { kind: "adopted", project };
|
|
51
|
-
};
|
|
52
|
-
|
|
53
48
|
// src/dashboard-model.ts
|
|
49
|
+
var serviceRowOf = (view) => ({
|
|
50
|
+
id: view.service.id,
|
|
51
|
+
sessionId: view.service.sessionId,
|
|
52
|
+
label: view.service.name,
|
|
53
|
+
status: serviceViewStatus(view),
|
|
54
|
+
workspacePort: view.service.workspacePort,
|
|
55
|
+
protocol: view.service.transport,
|
|
56
|
+
hostPort: serviceViewHostPort(view)
|
|
57
|
+
});
|
|
54
58
|
var worktreeName = (branch) => branch.startsWith("mend/") ? branch.slice("mend/".length) : branch;
|
|
55
59
|
var worktreeDisplayName = (session) => {
|
|
56
60
|
const name = worktreeName(session.branch);
|
|
@@ -67,7 +71,7 @@ var fetchWorkbench = async (ctx) => {
|
|
|
67
71
|
ctx.api("GET", "/services")
|
|
68
72
|
]);
|
|
69
73
|
const servicesBySession = /* @__PURE__ */ new Map();
|
|
70
|
-
for (const service of services) {
|
|
74
|
+
for (const service of services.map(serviceRowOf)) {
|
|
71
75
|
const bucket = servicesBySession.get(service.sessionId) ?? [];
|
|
72
76
|
bucket.push(service);
|
|
73
77
|
servicesBySession.set(service.sessionId, bucket);
|
|
@@ -127,8 +131,9 @@ var deriveProjects = (data) => (data?.projects ?? []).map((project) => {
|
|
|
127
131
|
const detail = data?.details.get(project.id);
|
|
128
132
|
const sessions = detail?.sessions ?? [];
|
|
129
133
|
const live = sessions.filter((s) => LIVE_STATUSES.has(s.status)).length;
|
|
134
|
+
const stopping = sessions.filter((s) => s.status === "stopping").length;
|
|
130
135
|
const open = (detail?.annotations ?? []).reduce((sum, a) => sum + a.openComments, 0);
|
|
131
|
-
return { project, total: sessions.length, live, open };
|
|
136
|
+
return { project, total: sessions.length, live, stopping, open };
|
|
132
137
|
});
|
|
133
138
|
var bySessionRecency = (a, b) => {
|
|
134
139
|
const aLive = LIVE_STATUSES.has(a.status) ? 1 : 0;
|
|
@@ -142,7 +147,10 @@ var toSessionItem = (data, detail) => (session) => ({
|
|
|
142
147
|
services: data.servicesBySession.get(session.id) ?? [],
|
|
143
148
|
processes: data.processesBySession.get(session.id) ?? []
|
|
144
149
|
});
|
|
145
|
-
var isDeadEnd = (session) =>
|
|
150
|
+
var isDeadEnd = (session) => (
|
|
151
|
+
// A stopping session may still be saving, or kept for recovery: never hidden (story S23).
|
|
152
|
+
!LIVE_STATUSES.has(session.status) && session.status !== "stopping" && session.hasTranscript === false
|
|
153
|
+
);
|
|
146
154
|
var deriveWorktrees = (data, projectId) => {
|
|
147
155
|
if (data === void 0 || projectId === null) return [];
|
|
148
156
|
const detail = data.details.get(projectId);
|
|
@@ -192,29 +200,33 @@ var pseudoGroup = (session, item) => ({
|
|
|
192
200
|
live: LIVE_STATUSES.has(session.status) ? 1 : 0,
|
|
193
201
|
annotation: item(session).annotation
|
|
194
202
|
});
|
|
195
|
-
var deriveHarnesses = (resuming) => {
|
|
203
|
+
var deriveHarnesses = (resuming, joining = null) => {
|
|
196
204
|
if (resuming !== null) {
|
|
197
205
|
const others = Object.keys(HARNESS_COMMANDS).filter((h) => h !== resuming.harness);
|
|
198
|
-
|
|
206
|
+
const same2 = resumesOwnHarness(resuming.harness) ? [
|
|
199
207
|
{
|
|
200
208
|
harness: null,
|
|
201
209
|
label: resuming.harness,
|
|
202
|
-
hint: "same harness \
|
|
203
|
-
}
|
|
210
|
+
hint: "same harness \xB7 native resume, conversation intact"
|
|
211
|
+
}
|
|
212
|
+
] : [];
|
|
213
|
+
return [
|
|
214
|
+
...same2,
|
|
204
215
|
...others.map(
|
|
205
216
|
(harness) => ({
|
|
206
217
|
harness,
|
|
207
218
|
label: harness,
|
|
208
|
-
hint: harness === "shell" ? "a bash in the worktree \
|
|
219
|
+
hint: harness === "shell" ? "a bash in the worktree \xB7 resume either agent from inside" : "the conversation crosses as a distilled prompt"
|
|
209
220
|
})
|
|
210
221
|
)
|
|
211
222
|
];
|
|
212
223
|
}
|
|
224
|
+
const where = joining === null ? "new worktree" : `joins ${joining}`;
|
|
213
225
|
return Object.keys(HARNESS_COMMANDS).map(
|
|
214
226
|
(harness) => ({
|
|
215
227
|
harness,
|
|
216
228
|
label: harness,
|
|
217
|
-
hint: harness === "shell" ?
|
|
229
|
+
hint: harness === "shell" ? `a plain bash session \xB7 ${where}, recorded` : `mend ${harness} \xB7 ${where}, recorded session`
|
|
218
230
|
})
|
|
219
231
|
);
|
|
220
232
|
};
|
|
@@ -233,11 +245,89 @@ var groupActivityAt = (group) => group.sessions.reduce(
|
|
|
233
245
|
group.createdAt
|
|
234
246
|
);
|
|
235
247
|
var foldGroupStatus = (group) => {
|
|
236
|
-
const statuses = group.sessions.map((item) => item.session.status);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return
|
|
248
|
+
const statuses = new Set(group.sessions.map((item) => item.session.status));
|
|
249
|
+
for (const word of ["waiting", "running", "starting", "stopping", "idle"]) {
|
|
250
|
+
if (statuses.has(word)) return word;
|
|
251
|
+
}
|
|
252
|
+
return "settled";
|
|
253
|
+
};
|
|
254
|
+
var liveCountWords = (live, stopping) => {
|
|
255
|
+
const words = [
|
|
256
|
+
...live > 0 ? [`${live} live`] : [],
|
|
257
|
+
...stopping > 0 ? [`${stopping} stopping`] : []
|
|
258
|
+
];
|
|
259
|
+
return words.length === 0 ? "settled" : words.join(" \xB7 ");
|
|
260
|
+
};
|
|
261
|
+
var elapsedWords = (iso, now = Date.now()) => {
|
|
262
|
+
const ms = now - new Date(iso).getTime();
|
|
263
|
+
if (!Number.isFinite(ms) || ms < 0) return null;
|
|
264
|
+
const minutes = Math.floor(ms / 6e4);
|
|
265
|
+
if (minutes < 1) return "<1m";
|
|
266
|
+
if (minutes < 60) return `${minutes}m`;
|
|
267
|
+
const hours = Math.floor(minutes / 60);
|
|
268
|
+
if (hours < 24) return `${hours}h`;
|
|
269
|
+
return `${Math.floor(hours / 24)}d`;
|
|
270
|
+
};
|
|
271
|
+
var startingWordsOf = (session) => {
|
|
272
|
+
if (isPendingId(session.id)) return "launching";
|
|
273
|
+
const phase = launchPhaseOf(session.summary);
|
|
274
|
+
if (phase === null) return "launching";
|
|
275
|
+
switch (phase.kind) {
|
|
276
|
+
case "waiting-previous":
|
|
277
|
+
return phase.words.endsWith("is saving") ? "waiting for the previous save" : "waiting for the previous session";
|
|
278
|
+
case "booting":
|
|
279
|
+
return "booting";
|
|
280
|
+
case "queued":
|
|
281
|
+
return "queued";
|
|
282
|
+
case "building":
|
|
283
|
+
return "building the image";
|
|
284
|
+
case "preparing":
|
|
285
|
+
return "preparing the workspace";
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
var startingExplanationOf = (session) => {
|
|
289
|
+
const phase = isPendingId(session.id) ? null : launchPhaseOf(session.summary);
|
|
290
|
+
if (phase === null) return "launching";
|
|
291
|
+
switch (phase.kind) {
|
|
292
|
+
case "waiting-previous":
|
|
293
|
+
return phase.words.endsWith("is saving") ? "the previous session in this worktree is still saving \xB7 this one starts from its save" : phase.words;
|
|
294
|
+
case "booting":
|
|
295
|
+
return "the workspace is booting \xB7 the agent starts when it is up";
|
|
296
|
+
case "queued":
|
|
297
|
+
return "the launch waits for a worker \xB7 it starts when one takes it";
|
|
298
|
+
case "building":
|
|
299
|
+
return `${phase.words} \xB7 the agent starts once it is built and booted`;
|
|
300
|
+
case "preparing":
|
|
301
|
+
return "the workspace has no runtime yet \xB7 after an update, building its image takes about 8 minutes";
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
var sessionTimeWords = (item, now = Date.now()) => {
|
|
305
|
+
const { session } = item;
|
|
306
|
+
if (session.status === "starting" || session.status === "stopping") return null;
|
|
307
|
+
const agent = item.annotation?.currentAgent ?? null;
|
|
308
|
+
const created = elapsedWords(session.createdAt, now);
|
|
309
|
+
const createdWords = created === null ? null : `created ${agoWords(created)}`;
|
|
310
|
+
if (LIVE_STATUSES.has(session.status)) {
|
|
311
|
+
if (agent === null || agent.createdAt === void 0) return createdWords;
|
|
312
|
+
if (agent.exitedAt !== null) {
|
|
313
|
+
const ended2 = elapsedWords(agent.exitedAt, now);
|
|
314
|
+
return ended2 === null ? createdWords : `agent ended ${agoWords(ended2)}`;
|
|
315
|
+
}
|
|
316
|
+
const up = elapsedWords(agent.createdAt, now);
|
|
317
|
+
if (up === null) return createdWords;
|
|
318
|
+
if (agent.kind === "agent-external") return `activity seen ${agoWords(up)}`;
|
|
319
|
+
return session.harness === "shell" ? `shell up ${up}` : `up ${up}`;
|
|
320
|
+
}
|
|
321
|
+
const settledAt = session.settledAt ?? null;
|
|
322
|
+
const ended = settledAt === null ? null : elapsedWords(settledAt, now);
|
|
323
|
+
return ended === null ? createdWords : `ended ${agoWords(ended)}`;
|
|
324
|
+
};
|
|
325
|
+
var agoWords = (elapsed) => elapsed === "<1m" ? "just now" : `${elapsed} ago`;
|
|
326
|
+
var sessionStateWords = (item, now = Date.now()) => {
|
|
327
|
+
const hold = sessionHold(item);
|
|
328
|
+
if (hold !== null) return hold;
|
|
329
|
+
if (item.session.status === "starting") return startingWordsOf(item.session);
|
|
330
|
+
return sessionTimeWords(item, now);
|
|
241
331
|
};
|
|
242
332
|
var liveShellOf = (processes) => processes.findLast((process2) => process2.kind === "shell" && process2.exitedAt === null) ?? null;
|
|
243
333
|
var liveProtocolOf = (processes) => processes.find((process2) => process2.kind === "agent-protocol" && process2.exitedAt === null) ?? null;
|
|
@@ -249,6 +339,26 @@ var planAttach = (session) => {
|
|
|
249
339
|
if (session.status === "starting") return { kind: "starting", session };
|
|
250
340
|
return { kind: "attach", session };
|
|
251
341
|
};
|
|
342
|
+
var findWorkbenchSession = (data, id) => {
|
|
343
|
+
for (const detail of data.details.values()) {
|
|
344
|
+
const found = detail.sessions.find((session) => session.id === id);
|
|
345
|
+
if (found !== void 0) return found;
|
|
346
|
+
}
|
|
347
|
+
return null;
|
|
348
|
+
};
|
|
349
|
+
var startProgress = (data, watch) => {
|
|
350
|
+
if (watch.sessionId === null) return { kind: "starting" };
|
|
351
|
+
const plan = planAttach(findWorkbenchSession(data, watch.sessionId));
|
|
352
|
+
switch (plan.kind) {
|
|
353
|
+
case "attach":
|
|
354
|
+
return { kind: "ready", session: plan.session };
|
|
355
|
+
case "settled":
|
|
356
|
+
case "stopping":
|
|
357
|
+
return { kind: "ended", session: plan.session };
|
|
358
|
+
default:
|
|
359
|
+
return { kind: "starting" };
|
|
360
|
+
}
|
|
361
|
+
};
|
|
252
362
|
var planResume = (session) => {
|
|
253
363
|
if (session === null) return { kind: "none" };
|
|
254
364
|
if (isPendingId(session.id)) return { kind: "pending", session };
|
|
@@ -276,7 +386,14 @@ var markSessionStopped = (data, sessionId) => {
|
|
|
276
386
|
return {
|
|
277
387
|
...mapWorkbenchSessions(
|
|
278
388
|
data,
|
|
279
|
-
(session) =>
|
|
389
|
+
(session) => (
|
|
390
|
+
// Asked, not observed (story S28): `stopping` until the server says how it ended. A stop
|
|
391
|
+
// leaves Services running, so a session with Services reads as stopped with what holds it.
|
|
392
|
+
session.id === sessionId ? {
|
|
393
|
+
...session,
|
|
394
|
+
status: (data.servicesBySession.get(sessionId) ?? []).length > 0 ? "stopped" : "stopping"
|
|
395
|
+
} : session
|
|
396
|
+
)
|
|
280
397
|
),
|
|
281
398
|
processesBySession
|
|
282
399
|
};
|
|
@@ -290,6 +407,13 @@ var AGENT_WORKING = /* @__PURE__ */ new Set(["starting", "running", "waiting"]);
|
|
|
290
407
|
var sessionHold = (item) => {
|
|
291
408
|
const capture = captureLineOf(item.session);
|
|
292
409
|
if (capture !== null) return capture;
|
|
410
|
+
if (item.session.status === "stopping") {
|
|
411
|
+
const agent = item.annotation?.currentAgent ?? null;
|
|
412
|
+
return agent !== null && agent.exitedAt !== null ? "agent ended \xB7 workspace end not confirmed" : "workspace end not confirmed";
|
|
413
|
+
}
|
|
414
|
+
return servicesHoldOf(item);
|
|
415
|
+
};
|
|
416
|
+
var servicesHoldOf = (item) => {
|
|
293
417
|
const agent = item.annotation?.currentAgent ?? null;
|
|
294
418
|
const agentProcessLive = item.processes.some(
|
|
295
419
|
(process2) => process2.kind !== "shell" && process2.exitedAt === null
|
|
@@ -300,6 +424,24 @@ var sessionHold = (item) => {
|
|
|
300
424
|
liveServices: Math.max(item.annotation?.liveServices ?? 0, item.services.length)
|
|
301
425
|
});
|
|
302
426
|
};
|
|
427
|
+
var sessionRowFacts = (item, width, now = Date.now()) => {
|
|
428
|
+
const agents = item.processes.filter((process2) => process2.kind !== "shell").length;
|
|
429
|
+
const shells = item.processes.filter((process2) => process2.kind === "shell").length;
|
|
430
|
+
const services = item.services.length;
|
|
431
|
+
const state = sessionStateWords(item, now);
|
|
432
|
+
const stateWidth = width > 40 ? width - 9 : width - 2;
|
|
433
|
+
return fitHints(
|
|
434
|
+
[
|
|
435
|
+
...state === null ? [] : [cut(state, stateWidth)],
|
|
436
|
+
item.session.harness,
|
|
437
|
+
...shells > 0 ? [`${shells} shell`] : [],
|
|
438
|
+
...agents > 0 ? [`${agents} agent`] : [],
|
|
439
|
+
...services > 0 && servicesHoldOf(item) === null ? [`${services} service`] : []
|
|
440
|
+
],
|
|
441
|
+
width
|
|
442
|
+
);
|
|
443
|
+
};
|
|
444
|
+
var cut = (text, width) => text.length <= width ? text : `${text.slice(0, Math.max(0, width - 1))}\u2026`;
|
|
303
445
|
var removeWorktreeGroup = (data, projectId, group) => {
|
|
304
446
|
const memberIds = new Set(group.sessions.map((item) => item.session.id));
|
|
305
447
|
const detail = data.details.get(projectId);
|
|
@@ -344,12 +486,12 @@ var filterBranches = (branches, query) => {
|
|
|
344
486
|
};
|
|
345
487
|
var baseStepNotice = (state) => {
|
|
346
488
|
if (state.branchError !== null) {
|
|
347
|
-
return `branches unreadable \
|
|
489
|
+
return `branches unreadable \xB7 ${state.branchError} \xB7 enter uses the default`;
|
|
348
490
|
}
|
|
349
491
|
if (state.branches === null) return "reading branches\u2026";
|
|
350
|
-
if (state.branches.length === 0) return "no branches read \
|
|
492
|
+
if (state.branches.length === 0) return "no branches read \xB7 enter uses the default branch";
|
|
351
493
|
if (filterBranches(state.branches, state.query).length === 0) {
|
|
352
|
-
return "no branch matches \
|
|
494
|
+
return "no branch matches \xB7 enter uses the default branch";
|
|
353
495
|
}
|
|
354
496
|
return null;
|
|
355
497
|
};
|
|
@@ -364,8 +506,35 @@ var advanceFromBase = (current) => {
|
|
|
364
506
|
var COLUMNS = ["projects", "worktrees", "sessions", "detail"];
|
|
365
507
|
var NAV_SECTIONS = ["projects", "worktrees", "sessions"];
|
|
366
508
|
var isNavSection = (column) => column !== "detail";
|
|
509
|
+
var PANE_NUMBER = {
|
|
510
|
+
projects: "1",
|
|
511
|
+
worktrees: "2",
|
|
512
|
+
sessions: "3",
|
|
513
|
+
detail: "0"
|
|
514
|
+
};
|
|
515
|
+
var paneForDigit = (digit) => COLUMNS.find((column) => PANE_NUMBER[column] === digit) ?? null;
|
|
516
|
+
var numberedTitle = (column, title) => `[${PANE_NUMBER[column]}] ${title}`;
|
|
517
|
+
var cyclePane = (focus, delta) => {
|
|
518
|
+
const at = COLUMNS.indexOf(focus);
|
|
519
|
+
if (at === -1) return "sessions";
|
|
520
|
+
const next = ((at + delta) % COLUMNS.length + COLUMNS.length) % COLUMNS.length;
|
|
521
|
+
return COLUMNS[next] ?? focus;
|
|
522
|
+
};
|
|
523
|
+
var backFrom = (focus, lastNav) => focus === "detail" ? lastNav : stepColumn(focus, -1);
|
|
524
|
+
var SCREEN_MODES = ["normal", "half", "full"];
|
|
525
|
+
var stepScreenMode = (mode, delta) => {
|
|
526
|
+
const at = SCREEN_MODES.indexOf(mode);
|
|
527
|
+
const next = ((at + delta) % SCREEN_MODES.length + SCREEN_MODES.length) % SCREEN_MODES.length;
|
|
528
|
+
return SCREEN_MODES[next] ?? mode;
|
|
529
|
+
};
|
|
530
|
+
var matchesFilter = (query, ...fields) => {
|
|
531
|
+
const needle = query.trim().toLowerCase();
|
|
532
|
+
if (needle === "") return true;
|
|
533
|
+
return fields.some((field) => field !== null && field.toLowerCase().includes(needle));
|
|
534
|
+
};
|
|
367
535
|
var expandedSection = (focus, lastNav) => isNavSection(focus) ? focus : lastNav;
|
|
368
536
|
var SIDEBAR_SHARE = 0.25;
|
|
537
|
+
var HALF_SIDEBAR_SHARE = 0.5;
|
|
369
538
|
var MIN_SIDEBAR_WIDTH = 24;
|
|
370
539
|
var MIN_DETAIL_WIDTH = 48;
|
|
371
540
|
var SPLIT_MIN_WIDTH = MIN_SIDEBAR_WIDTH + MIN_DETAIL_WIDTH;
|
|
@@ -381,13 +550,11 @@ var stackSections = (body, open) => {
|
|
|
381
550
|
(section) => section === open ? { section, expanded: true, height: room, rows: room - 2 } : { section, expanded: false, height: MIN_SECTION_HEIGHT, rows: 1 }
|
|
382
551
|
);
|
|
383
552
|
};
|
|
384
|
-
var planLayout = (width, height, focus, lastNav) => {
|
|
385
|
-
const split = width >= SPLIT_MIN_WIDTH;
|
|
553
|
+
var planLayout = (width, height, focus, lastNav, mode = "normal") => {
|
|
554
|
+
const split = mode !== "full" && width >= SPLIT_MIN_WIDTH;
|
|
386
555
|
const navVisible = split || isNavSection(focus);
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
Math.min(width - MIN_DETAIL_WIDTH, Math.round(width * SIDEBAR_SHARE))
|
|
390
|
-
) : navVisible ? Math.max(4, width) : 0;
|
|
556
|
+
const share = mode === "half" ? HALF_SIDEBAR_SHARE : SIDEBAR_SHARE;
|
|
557
|
+
const sidebarOuter = split ? Math.max(MIN_SIDEBAR_WIDTH, Math.min(width - MIN_DETAIL_WIDTH, Math.round(width * share))) : navVisible ? Math.max(4, width) : 0;
|
|
391
558
|
const detailOuter = split ? width - sidebarOuter : navVisible ? 0 : Math.max(4, width);
|
|
392
559
|
const build = (body2, breadcrumb) => {
|
|
393
560
|
const sections = navVisible ? stackSections(body2, expandedSection(focus, lastNav)) : [];
|
|
@@ -425,6 +592,56 @@ var fitHints = (hints, width) => {
|
|
|
425
592
|
return kept.length === 0 ? "\u2026" : `${kept.join(" \xB7 ")} \u2026`;
|
|
426
593
|
};
|
|
427
594
|
var clampIndex = (length, index) => length === 0 ? 0 : Math.max(0, Math.min(length - 1, index));
|
|
595
|
+
var VIEWER_KEY = ["viewer"];
|
|
596
|
+
var viewerNeeded = (data) => data !== void 0 && [...data.details.values()].some((detail) => hasPersonFacts(detail.sessions));
|
|
597
|
+
var fetchViewer = async (ctx) => {
|
|
598
|
+
const [view, members] = await Promise.all([
|
|
599
|
+
ctx.api("GET", "/organization").catch(() => null),
|
|
600
|
+
ctx.api("GET", "/organization/members").catch(() => [])
|
|
601
|
+
]);
|
|
602
|
+
return { userId: view?.userId ?? null, members };
|
|
603
|
+
};
|
|
604
|
+
var WORKSPACE_FACTS_KEY = (sessionId, reads) => [
|
|
605
|
+
"workspace-facts",
|
|
606
|
+
sessionId,
|
|
607
|
+
reads.waiting,
|
|
608
|
+
reads.retirement
|
|
609
|
+
];
|
|
610
|
+
var fetchWorkspaceFacts = async (api, sessionId, reads) => {
|
|
611
|
+
const [wait, retirement] = await Promise.all([
|
|
612
|
+
reads.waiting ? api("GET", `/sessions/${sessionId}/waiting`).catch(() => null) : null,
|
|
613
|
+
reads.retirement ? api(
|
|
614
|
+
"GET",
|
|
615
|
+
`/sessions/${sessionId}/workspace-retirement`
|
|
616
|
+
).catch(() => null) : null
|
|
617
|
+
]);
|
|
618
|
+
return { wait, retirement };
|
|
619
|
+
};
|
|
620
|
+
var workspaceFactRows = (session, viewer, facts, width) => workspaceLineList(
|
|
621
|
+
sessionWorkspaceLines({
|
|
622
|
+
sessionId: session.id,
|
|
623
|
+
livePeople: session.livePeople ?? [],
|
|
624
|
+
viewer: viewer?.userId ?? null,
|
|
625
|
+
wait: facts?.wait ?? null,
|
|
626
|
+
retirement: facts?.retirement ?? null,
|
|
627
|
+
members: viewer?.members ?? []
|
|
628
|
+
})
|
|
629
|
+
).flatMap((line) => {
|
|
630
|
+
const indent = line.startsWith(" ") ? " " : "";
|
|
631
|
+
return wrapWords(line, width - indent.length).map((row) => `${indent}${row}`);
|
|
632
|
+
});
|
|
633
|
+
var worktreeJoinRows = (data, projectId, worktree, viewerId, width) => {
|
|
634
|
+
const detail = data?.details.get(projectId);
|
|
635
|
+
const id = "id" in worktree ? worktree.id : detail?.worktrees?.find((candidate) => candidate.name === worktree.name)?.id;
|
|
636
|
+
if (detail === void 0 || id === void 0) return [];
|
|
637
|
+
const line = worktreeJoinLine(detail.sessions, id, viewerId);
|
|
638
|
+
return line === null ? [] : wrapWords(line, width);
|
|
639
|
+
};
|
|
640
|
+
var KEY_GROUP_TITLE = {
|
|
641
|
+
navigate: "move around",
|
|
642
|
+
session: "act on the selection",
|
|
643
|
+
dashboard: "the dashboard"
|
|
644
|
+
};
|
|
428
645
|
var KEY_BINDINGS = [
|
|
429
646
|
{
|
|
430
647
|
verb: "moveUp",
|
|
@@ -435,36 +652,123 @@ var KEY_BINDINGS = [
|
|
|
435
652
|
worktrees: "\u2191\u2193 move",
|
|
436
653
|
sessions: "\u2191\u2193 move",
|
|
437
654
|
detail: "\u2191\u2193 scroll"
|
|
438
|
-
}
|
|
655
|
+
},
|
|
656
|
+
help: "up the list, or back through the record",
|
|
657
|
+
group: "navigate"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
verb: "moveDown",
|
|
661
|
+
keys: ["down", "j"],
|
|
662
|
+
shift: false,
|
|
663
|
+
hints: {},
|
|
664
|
+
help: "down the list, or toward the newest line",
|
|
665
|
+
group: "navigate"
|
|
666
|
+
},
|
|
667
|
+
{ verb: "pageUp", keys: ["pageup"], shift: false, hints: {}, help: "up ten", group: "navigate" },
|
|
668
|
+
{
|
|
669
|
+
verb: "pageDown",
|
|
670
|
+
keys: ["pagedown"],
|
|
671
|
+
shift: false,
|
|
672
|
+
hints: {},
|
|
673
|
+
help: "down ten",
|
|
674
|
+
group: "navigate"
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
verb: "jumpProjects",
|
|
678
|
+
keys: ["1"],
|
|
679
|
+
shift: false,
|
|
680
|
+
hints: {},
|
|
681
|
+
help: "jump to [1] projects",
|
|
682
|
+
group: "navigate"
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
verb: "jumpWorktrees",
|
|
686
|
+
keys: ["2"],
|
|
687
|
+
shift: false,
|
|
688
|
+
hints: {},
|
|
689
|
+
help: "jump to [2] worktrees",
|
|
690
|
+
group: "navigate"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
verb: "jumpSessions",
|
|
694
|
+
keys: ["3"],
|
|
695
|
+
shift: false,
|
|
696
|
+
hints: {},
|
|
697
|
+
help: "jump to [3] sessions",
|
|
698
|
+
group: "navigate"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
verb: "jumpDetail",
|
|
702
|
+
keys: ["0"],
|
|
703
|
+
shift: false,
|
|
704
|
+
hints: {},
|
|
705
|
+
help: "jump to [0], the session pane",
|
|
706
|
+
group: "navigate"
|
|
439
707
|
},
|
|
440
|
-
{ verb: "moveDown", keys: ["down", "j"], shift: false, hints: {} },
|
|
441
|
-
{ verb: "pageUp", keys: ["pageup"], shift: false, hints: {} },
|
|
442
|
-
{ verb: "pageDown", keys: ["pagedown"], shift: false, hints: {} },
|
|
443
708
|
{
|
|
444
709
|
verb: "columnRight",
|
|
445
|
-
keys: ["return", "linefeed", "l", "right"
|
|
710
|
+
keys: ["return", "linefeed", "l", "right"],
|
|
446
711
|
shift: false,
|
|
447
|
-
hints: { projects: "\u2192 worktrees", worktrees: "\u2190\u2192 panes", sessions: "\u2190\u2192 panes" }
|
|
712
|
+
hints: { projects: "\u2192 worktrees", worktrees: "\u2190\u2192 panes", sessions: "\u2190\u2192 panes" },
|
|
713
|
+
help: "drill in: projects, worktrees, sessions, then [0]",
|
|
714
|
+
group: "navigate"
|
|
448
715
|
},
|
|
449
716
|
{
|
|
450
717
|
verb: "columnLeft",
|
|
451
718
|
keys: ["left", "h", "-", "backspace"],
|
|
452
719
|
shift: false,
|
|
453
|
-
hints: { detail: "\u2190 sessions" }
|
|
720
|
+
hints: { detail: "\u2190 sessions" },
|
|
721
|
+
help: "one pane back up the hierarchy",
|
|
722
|
+
group: "navigate"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
verb: "nextPane",
|
|
726
|
+
keys: ["tab"],
|
|
727
|
+
shift: false,
|
|
728
|
+
hints: {},
|
|
729
|
+
help: "next pane, round to the first after the last",
|
|
730
|
+
group: "navigate"
|
|
731
|
+
},
|
|
732
|
+
{ verb: "prevPane", keys: ["backtab"], shift: "any", hints: {} },
|
|
733
|
+
{
|
|
734
|
+
verb: "prevPane",
|
|
735
|
+
keys: ["tab"],
|
|
736
|
+
shift: true,
|
|
737
|
+
hints: {},
|
|
738
|
+
help: "previous pane, round to the last before the first",
|
|
739
|
+
group: "navigate"
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
verb: "back",
|
|
743
|
+
keys: ["escape"],
|
|
744
|
+
shift: false,
|
|
745
|
+
hints: {},
|
|
746
|
+
help: "clear the filter, else back to where you came from",
|
|
747
|
+
group: "navigate"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
verb: "filter",
|
|
751
|
+
keys: ["/"],
|
|
752
|
+
shift: false,
|
|
753
|
+
hints: {},
|
|
754
|
+
help: "filter this list; enter keeps the filter, esc clears it",
|
|
755
|
+
group: "navigate"
|
|
454
756
|
},
|
|
455
|
-
{ verb: "columnLeft", keys: ["backtab"], shift: "any", hints: {} },
|
|
456
|
-
{ verb: "columnLeft", keys: ["tab"], shift: true, hints: {} },
|
|
457
757
|
{
|
|
458
758
|
verb: "attach",
|
|
459
759
|
keys: ["a"],
|
|
460
760
|
shift: false,
|
|
461
|
-
hints: { worktrees: "a attach", sessions: "a attach", detail: "a attach" }
|
|
761
|
+
hints: { worktrees: "a attach", sessions: "a attach", detail: "a attach" },
|
|
762
|
+
help: "attach this terminal to the live session",
|
|
763
|
+
group: "session"
|
|
462
764
|
},
|
|
463
765
|
{
|
|
464
766
|
verb: "resume",
|
|
465
767
|
keys: ["r"],
|
|
466
768
|
shift: false,
|
|
467
|
-
hints: { worktrees: "r resume", sessions: "r resume", detail: "r resume" }
|
|
769
|
+
hints: { worktrees: "r resume", sessions: "r resume", detail: "r resume" },
|
|
770
|
+
help: "resume the settled session, on a harness you pick",
|
|
771
|
+
group: "session"
|
|
468
772
|
},
|
|
469
773
|
{
|
|
470
774
|
verb: "newSession",
|
|
@@ -474,60 +778,166 @@ var KEY_BINDINGS = [
|
|
|
474
778
|
projects: "n/w new worktree",
|
|
475
779
|
worktrees: "n new session",
|
|
476
780
|
sessions: "n new session"
|
|
477
|
-
}
|
|
781
|
+
},
|
|
782
|
+
help: "another session in this worktree, or a new worktree",
|
|
783
|
+
group: "session"
|
|
478
784
|
},
|
|
479
785
|
{
|
|
480
786
|
verb: "newWorktree",
|
|
481
787
|
keys: ["w"],
|
|
482
788
|
shift: false,
|
|
483
|
-
hints: { worktrees: "w new worktree", sessions: "w new worktree" }
|
|
789
|
+
hints: { worktrees: "w new worktree", sessions: "w new worktree" },
|
|
790
|
+
help: "a new worktree in this project",
|
|
791
|
+
group: "session"
|
|
484
792
|
},
|
|
485
793
|
{
|
|
486
794
|
verb: "stop",
|
|
487
795
|
keys: ["k"],
|
|
488
796
|
shift: true,
|
|
489
|
-
hints: { worktrees: "\u21E7K stop all", sessions: "\u21E7K stop" }
|
|
797
|
+
hints: { worktrees: "\u21E7K stop all", sessions: "\u21E7K stop" },
|
|
798
|
+
help: "stop it, or every live session in [2] (press twice)",
|
|
799
|
+
group: "session"
|
|
490
800
|
},
|
|
491
801
|
{ verb: "stop", keys: ["x"], shift: false, hints: {} },
|
|
492
802
|
{
|
|
493
803
|
verb: "remove",
|
|
494
804
|
keys: ["d"],
|
|
495
805
|
shift: true,
|
|
496
|
-
hints: { worktrees: "\u21E7D remove worktree", sessions: "\u21E7D remove" }
|
|
806
|
+
hints: { worktrees: "\u21E7D remove worktree", sessions: "\u21E7D remove" },
|
|
807
|
+
help: "remove it, or the worktree from [2] (press twice)",
|
|
808
|
+
group: "session"
|
|
497
809
|
},
|
|
498
810
|
{
|
|
499
811
|
verb: "review",
|
|
500
812
|
keys: ["v"],
|
|
501
813
|
shift: false,
|
|
502
|
-
hints: { worktrees: "v review", sessions: "v review", detail: "v review" }
|
|
814
|
+
hints: { worktrees: "v review", sessions: "v review", detail: "v review" },
|
|
815
|
+
help: "review the change in this terminal",
|
|
816
|
+
group: "session"
|
|
503
817
|
},
|
|
504
818
|
{
|
|
505
819
|
verb: "rename",
|
|
506
820
|
keys: ["e"],
|
|
507
821
|
shift: false,
|
|
508
|
-
hints: { sessions: "e rename", detail: "e rename" }
|
|
822
|
+
hints: { sessions: "e rename", detail: "e rename" },
|
|
823
|
+
help: "label the session; empty clears it",
|
|
824
|
+
group: "session"
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
verb: "openWeb",
|
|
828
|
+
keys: ["o"],
|
|
829
|
+
shift: false,
|
|
830
|
+
hints: { sessions: "o web", detail: "o web" },
|
|
831
|
+
help: "open the session in the browser",
|
|
832
|
+
group: "session"
|
|
509
833
|
},
|
|
510
|
-
{ verb: "openWeb", keys: ["o"], shift: false, hints: { sessions: "o web", detail: "o web" } },
|
|
511
834
|
{
|
|
512
835
|
verb: "refresh",
|
|
513
836
|
keys: ["r"],
|
|
514
837
|
shift: true,
|
|
515
|
-
hints: { projects: "\u21E7R refresh", worktrees: "\u21E7R refresh", detail: "\u21E7R refresh" }
|
|
838
|
+
hints: { projects: "\u21E7R refresh", worktrees: "\u21E7R refresh", detail: "\u21E7R refresh" },
|
|
839
|
+
help: "read everything from the server again",
|
|
840
|
+
group: "dashboard"
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
verb: "nextScreenMode",
|
|
844
|
+
keys: ["+"],
|
|
845
|
+
shift: "any",
|
|
846
|
+
hints: {},
|
|
847
|
+
help: "screen mode: normal, half, full",
|
|
848
|
+
group: "dashboard"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
verb: "prevScreenMode",
|
|
852
|
+
keys: ["_"],
|
|
853
|
+
shift: "any",
|
|
854
|
+
hints: {},
|
|
855
|
+
help: "screen mode, the other way",
|
|
856
|
+
group: "dashboard"
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
verb: "help",
|
|
860
|
+
keys: ["?"],
|
|
861
|
+
shift: "any",
|
|
862
|
+
hints: {},
|
|
863
|
+
help: "this list",
|
|
864
|
+
group: "dashboard",
|
|
865
|
+
footer: "? keys"
|
|
516
866
|
},
|
|
517
867
|
{
|
|
518
868
|
verb: "quit",
|
|
519
869
|
keys: ["q"],
|
|
520
870
|
shift: false,
|
|
521
|
-
hints: { projects: "q quit", worktrees: "q quit", sessions: "q quit", detail: "q quit" }
|
|
871
|
+
hints: { projects: "q quit", worktrees: "q quit", sessions: "q quit", detail: "q quit" },
|
|
872
|
+
help: "quit; sessions keep running",
|
|
873
|
+
group: "dashboard"
|
|
522
874
|
}
|
|
523
875
|
];
|
|
876
|
+
var SYMBOL_STROKES = /* @__PURE__ */ new Set(["?", "+", "_"]);
|
|
877
|
+
var strokeName = (key) => {
|
|
878
|
+
const sequence = key.sequence ?? "";
|
|
879
|
+
return SYMBOL_STROKES.has(sequence) ? sequence : key.name ?? "";
|
|
880
|
+
};
|
|
524
881
|
var verbForKey = (name, shift) => KEY_BINDINGS.find(
|
|
525
882
|
(binding) => binding.keys.includes(name) && (binding.shift === "any" || binding.shift === shift)
|
|
526
883
|
)?.verb ?? null;
|
|
884
|
+
var gameSwallows = (verb) => verb !== null;
|
|
527
885
|
var verbHints = (focus) => KEY_BINDINGS.flatMap((binding) => {
|
|
528
886
|
const hint = binding.hints[focus];
|
|
529
887
|
return hint === void 0 ? [] : [hint];
|
|
530
888
|
});
|
|
889
|
+
var FOOTER_TAIL = KEY_BINDINGS.flatMap(
|
|
890
|
+
(binding) => binding.footer === void 0 ? [] : [binding.footer]
|
|
891
|
+
);
|
|
892
|
+
var footerHints = (focus, width) => {
|
|
893
|
+
const tail = FOOTER_TAIL.map((hint) => ` \xB7 ${hint}`).join("");
|
|
894
|
+
return `${fitHints(verbHints(focus), Math.max(1, width - tail.length))}${tail}`;
|
|
895
|
+
};
|
|
896
|
+
var KEY_LABEL = {
|
|
897
|
+
up: "\u2191",
|
|
898
|
+
down: "\u2193",
|
|
899
|
+
left: "\u2190",
|
|
900
|
+
right: "\u2192",
|
|
901
|
+
return: "enter",
|
|
902
|
+
tab: "tab",
|
|
903
|
+
backtab: "\u21E7tab",
|
|
904
|
+
escape: "esc",
|
|
905
|
+
backspace: "\u232B",
|
|
906
|
+
pageup: "PgUp",
|
|
907
|
+
pagedown: "PgDn"
|
|
908
|
+
};
|
|
909
|
+
var keyLabel = (key, shift) => {
|
|
910
|
+
const base = KEY_LABEL[key] ?? key;
|
|
911
|
+
return shift === true ? `\u21E7${base.length === 1 ? base.toUpperCase() : base}` : base;
|
|
912
|
+
};
|
|
913
|
+
var helpSections = (focus) => {
|
|
914
|
+
const rows = /* @__PURE__ */ new Map();
|
|
915
|
+
for (const binding of KEY_BINDINGS) {
|
|
916
|
+
const entry = rows.get(binding.verb) ?? { keys: [], help: "", group: null };
|
|
917
|
+
for (const key of binding.keys) {
|
|
918
|
+
if (key === "linefeed") continue;
|
|
919
|
+
const label = keyLabel(key, binding.shift);
|
|
920
|
+
if (!entry.keys.includes(label)) entry.keys.push(label);
|
|
921
|
+
}
|
|
922
|
+
if (entry.help === "" && binding.help !== void 0) entry.help = binding.help;
|
|
923
|
+
if (entry.group === null && binding.group !== void 0) entry.group = binding.group;
|
|
924
|
+
rows.set(binding.verb, entry);
|
|
925
|
+
}
|
|
926
|
+
const all = [...rows].map(([verb, entry]) => ({
|
|
927
|
+
verb,
|
|
928
|
+
keys: entry.keys.join(" "),
|
|
929
|
+
help: entry.help,
|
|
930
|
+
group: entry.group ?? "dashboard",
|
|
931
|
+
here: KEY_BINDINGS.some(
|
|
932
|
+
(binding) => binding.verb === verb && binding.hints[focus] !== void 0
|
|
933
|
+
)
|
|
934
|
+
}));
|
|
935
|
+
const groups = ["navigate", "session", "dashboard"];
|
|
936
|
+
return groups.flatMap((group) => {
|
|
937
|
+
const ordered = all.filter((row) => row.group === group);
|
|
938
|
+
return ordered.length === 0 ? [] : [{ title: KEY_GROUP_TITLE[group], rows: ordered.map(({ group: _group, ...row }) => row) }];
|
|
939
|
+
});
|
|
940
|
+
};
|
|
531
941
|
|
|
532
942
|
// src/dashboard-preview.ts
|
|
533
943
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -780,13 +1190,18 @@ var statusOf = (patch) => {
|
|
|
780
1190
|
var isLikelyGenerated = (name) => /(^|\/)(?:dist|build|generated)(?:\/|$)/i.test(name) || /(?:\.generated\.|\.min\.(?:js|css)$|(?:^|\/)(?:pnpm-lock\.yaml|package-lock\.json|yarn\.lock)$)/i.test(
|
|
781
1191
|
name
|
|
782
1192
|
);
|
|
783
|
-
var visibleWhitespace = (patch) =>
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
1193
|
+
var visibleWhitespace = (patch) => {
|
|
1194
|
+
let inHunk = false;
|
|
1195
|
+
return patch.split("\n").map((line) => {
|
|
1196
|
+
if (line.startsWith("diff --git ")) inHunk = false;
|
|
1197
|
+
if (line.startsWith("@@ ")) inHunk = true;
|
|
1198
|
+
const hunkContent = inHunk && /^[+ -]/.test(line);
|
|
1199
|
+
if (!hunkContent) return line;
|
|
1200
|
+
const prefix = line.slice(0, 1);
|
|
1201
|
+
const content = line.slice(1).replaceAll(" ", "\u2192\xB7\xB7\xB7\xB7").replaceAll(" ", "\xB7");
|
|
1202
|
+
return `${prefix}${content}`;
|
|
1203
|
+
}).join("\n");
|
|
1204
|
+
};
|
|
790
1205
|
var splitFilePatches = (diff) => {
|
|
791
1206
|
const starts = [...diff.matchAll(/^diff --git /gm)].map((match) => match.index);
|
|
792
1207
|
return starts.map((start, index) => {
|
|
@@ -818,9 +1233,9 @@ var parseRows = (patch) => {
|
|
|
818
1233
|
while (bodyIndex < patchLines.length) {
|
|
819
1234
|
const bodyLine = patchLines[bodyIndex] ?? "";
|
|
820
1235
|
if (bodyLine.startsWith("@@ ")) break;
|
|
821
|
-
if (bodyLine.startsWith("+")
|
|
1236
|
+
if (bodyLine.startsWith("+")) {
|
|
822
1237
|
body.push({ kind: "addition" });
|
|
823
|
-
} else if (bodyLine.startsWith("-")
|
|
1238
|
+
} else if (bodyLine.startsWith("-")) {
|
|
824
1239
|
body.push({ kind: "deletion" });
|
|
825
1240
|
} else if (bodyLine.startsWith(" ")) {
|
|
826
1241
|
body.push({ kind: "context" });
|
|
@@ -953,6 +1368,7 @@ var SYNTAX_FUNCTION = "#ffcd66";
|
|
|
953
1368
|
|
|
954
1369
|
// src/review.tsx
|
|
955
1370
|
import { Fragment, jsx, jsxs } from "@opentui/react/jsx-runtime";
|
|
1371
|
+
var clockOf = (iso) => new Date(iso).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: false });
|
|
956
1372
|
var REVIEW_KEY = (changeId) => ["review", changeId];
|
|
957
1373
|
var EDITOR_KEY_BINDINGS = [{ name: "return", ctrl: true, action: "submit" }];
|
|
958
1374
|
var syntaxStyle = SyntaxStyle.fromStyles({
|
|
@@ -998,6 +1414,7 @@ var fetchReview = async (ctx, changeId) => {
|
|
|
998
1414
|
sliceId: pinned.slice.id,
|
|
999
1415
|
checkpointAId: pinned.checkpointA.id,
|
|
1000
1416
|
checkpointBId: pinned.checkpointB.id,
|
|
1417
|
+
checkpointSource: pinned.checkpointB.source ?? null,
|
|
1001
1418
|
diffDigest: pinned.slice.diffDigest,
|
|
1002
1419
|
anchorFiles: pinned.anchorFiles,
|
|
1003
1420
|
files: buildReviewFiles(wire.diff, wire.files),
|
|
@@ -1511,6 +1928,10 @@ function ReviewScreen({
|
|
|
1511
1928
|
};
|
|
1512
1929
|
const openSendEditor = () => {
|
|
1513
1930
|
if (data === void 0) return;
|
|
1931
|
+
if (!takesReviewFollowUp(session.harness)) {
|
|
1932
|
+
setStatus(noReviewFollowUpLine(session.harness));
|
|
1933
|
+
return;
|
|
1934
|
+
}
|
|
1514
1935
|
const sendable = data.comments.filter(
|
|
1515
1936
|
(comment) => comment.state === "open" && comment.sentToSessionId === null && !isPendingId(comment.id)
|
|
1516
1937
|
);
|
|
@@ -1831,7 +2252,10 @@ function ReviewScreen({
|
|
|
1831
2252
|
session.id.slice(0, 8)
|
|
1832
2253
|
] }),
|
|
1833
2254
|
isFetching ? /* @__PURE__ */ jsx("span", { fg: FAINT, children: " \xB7 syncing" }) : null,
|
|
1834
|
-
/* @__PURE__ */ jsx("span", { fg: checkpointState === "failed" ? MUTED : FAINT, children: checkpointState === "recording" ? " \xB7 checkpointing" : checkpointState === "failed" ? " \xB7 checkpoint incomplete" : " \xB7 checkpoint recorded"
|
|
2255
|
+
/* @__PURE__ */ jsx("span", { fg: checkpointState === "failed" ? MUTED : FAINT, children: checkpointState === "recording" ? " \xB7 checkpointing" : checkpointState === "failed" ? " \xB7 checkpoint incomplete" : data.checkpointSource === null ? " \xB7 checkpoint recorded" : ` \xB7 checkpoint ${checkpointSourceWords(
|
|
2256
|
+
data.checkpointSource,
|
|
2257
|
+
clockOf(data.checkpointSource.observedAt)
|
|
2258
|
+
)}` })
|
|
1835
2259
|
] }),
|
|
1836
2260
|
/* @__PURE__ */ jsxs("text", { height: 1, bg: "transparent", children: [
|
|
1837
2261
|
/* @__PURE__ */ jsxs("span", { fg: FAINT, children: [
|
|
@@ -1967,15 +2391,12 @@ function ReviewScreen({
|
|
|
1967
2391
|
onSubmit: () => void submitEditor()
|
|
1968
2392
|
}
|
|
1969
2393
|
),
|
|
1970
|
-
/* @__PURE__ */ jsx("text", { height: 1, fg: status === "" ? FAINT : INK_2, bg: "transparent", children: status === "" ? ` m read \xB7 g suggest \xB7 t tour \xB7 ,/. tour stops \xB7 s draft review${data.followUp?.status === "pending" ? " \xB7 y deliver & relaunch" : ""} \xB7 o web \xB7 r refresh` : ` ${status}` }),
|
|
2394
|
+
/* @__PURE__ */ jsx("text", { height: 1, fg: status === "" ? FAINT : INK_2, bg: "transparent", children: status === "" ? ` m read \xB7 g suggest \xB7 t tour \xB7 ,/. tour stops${takesReviewFollowUp(session.harness) ? " \xB7 s draft review" : ""}${data.followUp?.status === "pending" ? " \xB7 y deliver & relaunch" : ""} \xB7 o web \xB7 r refresh` : ` ${status}` }),
|
|
1971
2395
|
/* @__PURE__ */ jsx("text", { height: 1, fg: FAINT, bg: "transparent", children: footer })
|
|
1972
2396
|
] })
|
|
1973
2397
|
);
|
|
1974
2398
|
}
|
|
1975
2399
|
|
|
1976
|
-
// src/snake.tsx
|
|
1977
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
1978
|
-
|
|
1979
2400
|
// src/snake-game.ts
|
|
1980
2401
|
var OPPOSITE = {
|
|
1981
2402
|
up: "down",
|
|
@@ -2057,94 +2478,294 @@ var render = (game) => {
|
|
|
2057
2478
|
return rows.map((row) => row.join(""));
|
|
2058
2479
|
};
|
|
2059
2480
|
|
|
2481
|
+
// src/snake-play.ts
|
|
2482
|
+
var TICK_MS = 140;
|
|
2483
|
+
var COUNTDOWN_STEP_MS = 1e3;
|
|
2484
|
+
var COUNTDOWN = { kind: "countdown", step: 3 };
|
|
2485
|
+
var RUNNING = { kind: "running" };
|
|
2486
|
+
var PAUSED = { kind: "paused" };
|
|
2487
|
+
var READY = { kind: "ready" };
|
|
2488
|
+
var newSnakePlay = (width, height, random) => ({
|
|
2489
|
+
game: newSnakeGame(width, height, random),
|
|
2490
|
+
clock: READY,
|
|
2491
|
+
focused: false,
|
|
2492
|
+
width,
|
|
2493
|
+
height
|
|
2494
|
+
});
|
|
2495
|
+
var countDown = (play, random) => ({
|
|
2496
|
+
...play,
|
|
2497
|
+
game: play.game.over ? newSnakeGame(play.width, play.height, random) : play.game,
|
|
2498
|
+
clock: COUNTDOWN
|
|
2499
|
+
});
|
|
2500
|
+
var reduceSnake = (play, event, random) => {
|
|
2501
|
+
switch (event.type) {
|
|
2502
|
+
case "focus":
|
|
2503
|
+
return play.focused ? play : { ...countDown(play, random), focused: true };
|
|
2504
|
+
case "blur": {
|
|
2505
|
+
if (!play.focused) return play;
|
|
2506
|
+
const clock = play.clock.kind === "running" ? PAUSED : play.clock.kind === "countdown" ? READY : play.clock;
|
|
2507
|
+
return { ...play, focused: false, clock };
|
|
2508
|
+
}
|
|
2509
|
+
case "resize": {
|
|
2510
|
+
if (event.width === play.width && event.height === play.height) return play;
|
|
2511
|
+
return {
|
|
2512
|
+
...play,
|
|
2513
|
+
width: event.width,
|
|
2514
|
+
height: event.height,
|
|
2515
|
+
game: newSnakeGame(event.width, event.height, random),
|
|
2516
|
+
clock: play.clock.kind === "running" ? COUNTDOWN : play.clock
|
|
2517
|
+
};
|
|
2518
|
+
}
|
|
2519
|
+
case "count": {
|
|
2520
|
+
if (!play.focused || play.clock.kind !== "countdown") return play;
|
|
2521
|
+
const { step } = play.clock;
|
|
2522
|
+
return {
|
|
2523
|
+
...play,
|
|
2524
|
+
clock: step === 0 ? RUNNING : { kind: "countdown", step: step === 3 ? 2 : step === 2 ? 1 : 0 }
|
|
2525
|
+
};
|
|
2526
|
+
}
|
|
2527
|
+
case "tick": {
|
|
2528
|
+
if (!play.focused || play.clock.kind !== "running") return play;
|
|
2529
|
+
const game = tick(play.game, random);
|
|
2530
|
+
return { ...play, game, clock: game.over ? READY : play.clock };
|
|
2531
|
+
}
|
|
2532
|
+
case "steer": {
|
|
2533
|
+
if (!play.focused) return play;
|
|
2534
|
+
if (play.game.over) return countDown(play, random);
|
|
2535
|
+
const game = turn(play.game, event.direction);
|
|
2536
|
+
return play.clock.kind === "running" || play.clock.kind === "countdown" ? { ...play, game } : { ...play, game, clock: COUNTDOWN };
|
|
2537
|
+
}
|
|
2538
|
+
case "togglePause":
|
|
2539
|
+
if (!play.focused) return play;
|
|
2540
|
+
return play.clock.kind === "running" || play.clock.kind === "countdown" ? { ...play, clock: PAUSED } : countDown(play, random);
|
|
2541
|
+
case "play":
|
|
2542
|
+
if (!play.focused || play.clock.kind === "running" || play.clock.kind === "countdown") {
|
|
2543
|
+
return play;
|
|
2544
|
+
}
|
|
2545
|
+
return countDown(play, random);
|
|
2546
|
+
}
|
|
2547
|
+
};
|
|
2548
|
+
var KEY_DIRECTIONS = {
|
|
2549
|
+
up: "up",
|
|
2550
|
+
down: "down",
|
|
2551
|
+
left: "left",
|
|
2552
|
+
right: "right",
|
|
2553
|
+
k: "up",
|
|
2554
|
+
j: "down",
|
|
2555
|
+
h: "left",
|
|
2556
|
+
l: "right"
|
|
2557
|
+
};
|
|
2558
|
+
var snakeKey = (name) => {
|
|
2559
|
+
const direction = KEY_DIRECTIONS[name];
|
|
2560
|
+
if (direction !== void 0) return { type: "steer", direction };
|
|
2561
|
+
if (name === "space" || name === "p") return { type: "togglePause" };
|
|
2562
|
+
if (name === "return" || name === "linefeed") return { type: "play" };
|
|
2563
|
+
if (name === "escape" || name === "q") return { type: "leave" };
|
|
2564
|
+
return null;
|
|
2565
|
+
};
|
|
2566
|
+
var snakeHints = (play) => play.game.over ? "enter/arrows again \xB7 esc/q leave" : play.clock.kind === "paused" || play.clock.kind === "ready" ? "enter/space resume \xB7 esc/q leave" : "\u2190\u2191\u2193\u2192/hjkl steer \xB7 space/p pause \xB7 esc/q leave";
|
|
2567
|
+
var SEGMENTS = {
|
|
2568
|
+
"1": "bc",
|
|
2569
|
+
"2": "abdeg",
|
|
2570
|
+
"3": "abcdg",
|
|
2571
|
+
G: "acdef",
|
|
2572
|
+
O: "abcdef"
|
|
2573
|
+
};
|
|
2574
|
+
var glyphPixels = (char, length, thickness) => {
|
|
2575
|
+
const lit = new Set(SEGMENTS[char] ?? "");
|
|
2576
|
+
const on = (...segments) => segments.some((segment) => lit.has(segment));
|
|
2577
|
+
const width = length + 2 * thickness;
|
|
2578
|
+
const height = 2 * length + 3 * thickness;
|
|
2579
|
+
const column = (x) => x < thickness ? "left" : x < thickness + length ? "middle" : "right";
|
|
2580
|
+
const row = (y) => y < thickness ? "top" : y < thickness + length ? "upper" : y < 2 * thickness + length ? "centre" : y < 2 * thickness + 2 * length ? "lower" : "bottom";
|
|
2581
|
+
const pixel = (x, y) => {
|
|
2582
|
+
const where = `${column(x)} ${row(y)}`;
|
|
2583
|
+
switch (where) {
|
|
2584
|
+
case "middle top":
|
|
2585
|
+
return on("a");
|
|
2586
|
+
case "middle centre":
|
|
2587
|
+
return on("g");
|
|
2588
|
+
case "middle bottom":
|
|
2589
|
+
return on("d");
|
|
2590
|
+
case "left upper":
|
|
2591
|
+
return on("f");
|
|
2592
|
+
case "right upper":
|
|
2593
|
+
return on("b");
|
|
2594
|
+
case "left lower":
|
|
2595
|
+
return on("e");
|
|
2596
|
+
case "right lower":
|
|
2597
|
+
return on("c");
|
|
2598
|
+
case "left top":
|
|
2599
|
+
return on("a", "f");
|
|
2600
|
+
case "right top":
|
|
2601
|
+
return on("a", "b");
|
|
2602
|
+
case "left centre":
|
|
2603
|
+
return on("f", "e", "g");
|
|
2604
|
+
case "right centre":
|
|
2605
|
+
return on("b", "c", "g");
|
|
2606
|
+
case "left bottom":
|
|
2607
|
+
return on("e", "d");
|
|
2608
|
+
case "right bottom":
|
|
2609
|
+
return on("c", "d");
|
|
2610
|
+
default:
|
|
2611
|
+
return false;
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2614
|
+
return Array.from(
|
|
2615
|
+
{ length: height },
|
|
2616
|
+
(_row, y) => Array.from({ length: width }, (_cell, x) => pixel(x, y))
|
|
2617
|
+
);
|
|
2618
|
+
};
|
|
2619
|
+
var halfBlocks = (pixels) => {
|
|
2620
|
+
const rows = [];
|
|
2621
|
+
for (let y = 0; y < pixels.length; y += 2) {
|
|
2622
|
+
const top = pixels[y] ?? [];
|
|
2623
|
+
const bottom = pixels[y + 1] ?? [];
|
|
2624
|
+
rows.push(
|
|
2625
|
+
top.map((upper, x) => {
|
|
2626
|
+
const lower = bottom[x] === true;
|
|
2627
|
+
return upper && lower ? "\u2588" : upper ? "\u2580" : lower ? "\u2584" : " ";
|
|
2628
|
+
}).join("")
|
|
2629
|
+
);
|
|
2630
|
+
}
|
|
2631
|
+
return rows;
|
|
2632
|
+
};
|
|
2633
|
+
var drawLabel = (label, length, thickness) => {
|
|
2634
|
+
const glyphs = [...label].map((char) => glyphPixels(char, length, thickness));
|
|
2635
|
+
const gap = Array.from({ length: thickness }, () => false);
|
|
2636
|
+
const height = 2 * length + 3 * thickness;
|
|
2637
|
+
const pixels = Array.from(
|
|
2638
|
+
{ length: height },
|
|
2639
|
+
(_, y) => glyphs.flatMap((glyph, index) => index === 0 ? glyph[y] : [...gap, ...glyph[y]])
|
|
2640
|
+
);
|
|
2641
|
+
const lit = (x) => pixels.some((line) => line[x] === true);
|
|
2642
|
+
const width = pixels[0]?.length ?? 0;
|
|
2643
|
+
let first = 0;
|
|
2644
|
+
while (first < width && !lit(first)) first += 1;
|
|
2645
|
+
let last = width - 1;
|
|
2646
|
+
while (last > first && !lit(last)) last -= 1;
|
|
2647
|
+
return halfBlocks(pixels.map((line) => line.slice(first, last + 1)));
|
|
2648
|
+
};
|
|
2649
|
+
var countdownLabel = (step) => step === 0 ? "GO" : String(step);
|
|
2650
|
+
var MAX_SEGMENT = 12;
|
|
2651
|
+
var countdownArt = (label, cols, rows) => {
|
|
2652
|
+
const marginRows = Math.floor(rows / 8);
|
|
2653
|
+
const marginCols = cols >= 12 ? 1 : 0;
|
|
2654
|
+
const fitRows = rows - 2 * marginRows;
|
|
2655
|
+
const fitCols = cols - 2 * marginCols;
|
|
2656
|
+
for (let length = MAX_SEGMENT; length >= 1; length -= 1) {
|
|
2657
|
+
const thickness = length >= 5 ? 2 : 1;
|
|
2658
|
+
const art = drawLabel(label, length, thickness);
|
|
2659
|
+
if (art.length <= fitRows && (art[0]?.length ?? 0) <= fitCols) return art;
|
|
2660
|
+
}
|
|
2661
|
+
return label.length <= cols ? [label] : [label.slice(0, Math.max(1, cols))];
|
|
2662
|
+
};
|
|
2663
|
+
var overlayArt = (board, art) => {
|
|
2664
|
+
const height = board.length;
|
|
2665
|
+
const width = [...board[0] ?? ""].length;
|
|
2666
|
+
const artWidth = Math.max(0, ...art.map((line) => [...line].length));
|
|
2667
|
+
const top = Math.floor((height - art.length) / 2);
|
|
2668
|
+
const left = Math.floor((width - artWidth) / 2);
|
|
2669
|
+
return board.map((line, y) => {
|
|
2670
|
+
const artLine = art[y - top];
|
|
2671
|
+
const artCells = artLine === void 0 ? [] : [...artLine];
|
|
2672
|
+
return [...line].map((cell, x) => {
|
|
2673
|
+
const char = artCells[x - left];
|
|
2674
|
+
return { board: cell, art: char === void 0 || char === " " ? null : char };
|
|
2675
|
+
});
|
|
2676
|
+
});
|
|
2677
|
+
};
|
|
2678
|
+
|
|
2060
2679
|
// src/snake.tsx
|
|
2680
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
2061
2681
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "@opentui/react/jsx-runtime";
|
|
2062
|
-
var TICK_MS = 140;
|
|
2063
2682
|
var useSnake = (options) => {
|
|
2064
|
-
const { width, height,
|
|
2065
|
-
const [
|
|
2066
|
-
|
|
2683
|
+
const { width, height, focused } = options;
|
|
2684
|
+
const [stored, setPlay] = useState2(() => newSnakePlay(width, height, Math.random));
|
|
2685
|
+
let play = reduceSnake(stored, { type: "resize", width, height }, Math.random);
|
|
2686
|
+
if (play.focused !== focused) {
|
|
2687
|
+
play = reduceSnake(play, { type: focused ? "focus" : "blur" }, Math.random);
|
|
2688
|
+
}
|
|
2689
|
+
if (play !== stored) setPlay(play);
|
|
2690
|
+
const { clock } = play;
|
|
2691
|
+
const step = clock.kind === "countdown" ? clock.step : null;
|
|
2067
2692
|
useEffect2(() => {
|
|
2068
|
-
if (
|
|
2069
|
-
|
|
2070
|
-
|
|
2693
|
+
if (clock.kind === "countdown") {
|
|
2694
|
+
const timer2 = setTimeout(
|
|
2695
|
+
() => setPlay((current) => reduceSnake(current, { type: "count" }, Math.random)),
|
|
2696
|
+
COUNTDOWN_STEP_MS
|
|
2697
|
+
);
|
|
2698
|
+
return () => clearTimeout(timer2);
|
|
2071
2699
|
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
return () => clearInterval(timer);
|
|
2077
|
-
}, [enabled, paused]);
|
|
2078
|
-
const steer = (direction) => {
|
|
2079
|
-
setPaused(false);
|
|
2080
|
-
setGame(
|
|
2081
|
-
(current) => current.over ? newSnakeGame(current.width, current.height, Math.random) : turn(current, direction)
|
|
2700
|
+
if (clock.kind !== "running") return;
|
|
2701
|
+
const timer = setInterval(
|
|
2702
|
+
() => setPlay((current) => reduceSnake(current, { type: "tick" }, Math.random)),
|
|
2703
|
+
TICK_MS
|
|
2082
2704
|
);
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2705
|
+
return () => clearInterval(timer);
|
|
2706
|
+
}, [clock.kind, step]);
|
|
2707
|
+
const send = (event) => setPlay((current) => reduceSnake(current, event, Math.random));
|
|
2708
|
+
return { play, send };
|
|
2086
2709
|
};
|
|
2087
|
-
var SnakeHeading = ({
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
|
|
2096
|
-
/* @__PURE__ */ jsx2("span", { fg: INK, children: "play snake while you wait" }),
|
|
2097
|
-
/* @__PURE__ */ jsx2("span", { fg: FAINT, children: " \xB7 score " }),
|
|
2098
|
-
/* @__PURE__ */ jsx2("span", { fg: game.over ? MUTED : ACCENT, children: String(game.score) }),
|
|
2099
|
-
state === null ? null : /* @__PURE__ */ jsx2("span", { fg: FAINT, children: ` \xB7 ${state}` })
|
|
2100
|
-
] }),
|
|
2101
|
-
/* @__PURE__ */ jsx2("text", { height: 1, bg: "transparent", fg: FAINT, children: ` ${hint}` })
|
|
2710
|
+
var SnakeHeading = ({ play }) => {
|
|
2711
|
+
const { game, clock } = play;
|
|
2712
|
+
const state = game.over ? "over" : clock.kind === "paused" ? "paused" : null;
|
|
2713
|
+
return /* @__PURE__ */ jsxs2("text", { height: 1, bg: "transparent", children: [
|
|
2714
|
+
/* @__PURE__ */ jsx2("span", { children: " " }),
|
|
2715
|
+
/* @__PURE__ */ jsx2("span", { fg: INK, children: "play snake while you wait" }),
|
|
2716
|
+
/* @__PURE__ */ jsx2("span", { fg: FAINT, children: " \xB7 score " }),
|
|
2717
|
+
/* @__PURE__ */ jsx2("span", { fg: game.over ? MUTED : ACCENT, children: String(game.score) }),
|
|
2718
|
+
state === null ? null : /* @__PURE__ */ jsx2("span", { fg: FAINT, children: ` \xB7 ${state}` })
|
|
2102
2719
|
] });
|
|
2103
2720
|
};
|
|
2721
|
+
var SNAKE_IDLE = "enter plays";
|
|
2722
|
+
var snakeTooSmall = (short) => `make the terminal ${short ? "taller" : "wider"} to play snake`;
|
|
2723
|
+
var SNAKE_BEHIND_DIALOG = "the countdown starts when this dialog closes";
|
|
2724
|
+
var SnakeFooter = ({
|
|
2725
|
+
play,
|
|
2726
|
+
idle
|
|
2727
|
+
}) => /* @__PURE__ */ jsx2("text", { height: 1, bg: "transparent", fg: FAINT, children: ` ${play.focused ? snakeHints(play) : idle}` });
|
|
2728
|
+
var cellColor = (cell) => cell === "\u25C6" ? ACCENT : cell === "\u2588" ? GREEN : cell === "\u25CF" ? INK : FAINT;
|
|
2729
|
+
var SnakeRows = ({ play }) => {
|
|
2730
|
+
const { game, clock } = play;
|
|
2731
|
+
const board = render(game);
|
|
2732
|
+
if (clock.kind !== "countdown") {
|
|
2733
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: board.map((row, index) => /* @__PURE__ */ jsx2("text", { height: 1, bg: "transparent", children: [...row].map((cell, x) => /* @__PURE__ */ jsx2("span", { fg: cellColor(cell), children: cell === "\xB7" ? " " : cell }, x)) }, index)) });
|
|
2734
|
+
}
|
|
2735
|
+
const cells = overlayArt(
|
|
2736
|
+
board,
|
|
2737
|
+
countdownArt(countdownLabel(clock.step), game.width, game.height)
|
|
2738
|
+
);
|
|
2739
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: cells.map((row, index) => /* @__PURE__ */ jsx2("text", { height: 1, bg: "transparent", children: row.map(
|
|
2740
|
+
(cell, x) => cell.board !== "\xB7" || cell.art === null ? /* @__PURE__ */ jsx2("span", { fg: cellColor(cell.board), children: cell.board === "\xB7" ? " " : cell.board }, x) : /* @__PURE__ */ jsx2("span", { fg: ACCENT, children: cell.art }, x)
|
|
2741
|
+
) }, index)) });
|
|
2742
|
+
};
|
|
2104
2743
|
var SnakeBoard = ({
|
|
2105
2744
|
handle,
|
|
2106
|
-
|
|
2745
|
+
idle
|
|
2107
2746
|
}) => {
|
|
2108
|
-
const {
|
|
2109
|
-
const rows = render(game);
|
|
2747
|
+
const { play } = handle;
|
|
2110
2748
|
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
2111
|
-
/* @__PURE__ */ jsx2(
|
|
2112
|
-
SnakeHeading,
|
|
2113
|
-
{
|
|
2114
|
-
handle,
|
|
2115
|
-
hint: focused ? "arrows steer \xB7 space pauses \xB7 esc puts it away" : "focus this pane to play \xB7 esc puts it away"
|
|
2116
|
-
}
|
|
2117
|
-
),
|
|
2749
|
+
/* @__PURE__ */ jsx2(SnakeHeading, { play }),
|
|
2118
2750
|
/* @__PURE__ */ jsx2(
|
|
2119
2751
|
"box",
|
|
2120
2752
|
{
|
|
2121
2753
|
border: true,
|
|
2122
2754
|
borderStyle: "rounded",
|
|
2123
|
-
borderColor: focused ? ACCENT : RULE,
|
|
2124
|
-
|
|
2125
|
-
|
|
2755
|
+
borderColor: play.focused ? ACCENT : RULE,
|
|
2756
|
+
title: " snake ",
|
|
2757
|
+
titleAlignment: "left",
|
|
2758
|
+
width: play.game.width + 2,
|
|
2759
|
+
height: play.game.height + 2,
|
|
2126
2760
|
flexShrink: 0,
|
|
2127
2761
|
marginLeft: 2,
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
{
|
|
2131
|
-
fg: cell === "\u25C6" ? ACCENT : cell === "\u2588" ? GREEN : cell === "\u25CF" ? INK : FAINT,
|
|
2132
|
-
children: cell === "\xB7" ? " " : cell
|
|
2133
|
-
},
|
|
2134
|
-
x
|
|
2135
|
-
)) }, index))
|
|
2762
|
+
flexDirection: "column",
|
|
2763
|
+
children: /* @__PURE__ */ jsx2(SnakeRows, { play })
|
|
2136
2764
|
}
|
|
2137
|
-
)
|
|
2765
|
+
),
|
|
2766
|
+
/* @__PURE__ */ jsx2(SnakeFooter, { play, idle })
|
|
2138
2767
|
] });
|
|
2139
2768
|
};
|
|
2140
|
-
var SnakeRows = ({ game }) => /* @__PURE__ */ jsx2(Fragment2, { children: render(game).map((row, index) => /* @__PURE__ */ jsx2("text", { height: 1, bg: "transparent", children: [...row].map((cell, x) => /* @__PURE__ */ jsx2(
|
|
2141
|
-
"span",
|
|
2142
|
-
{
|
|
2143
|
-
fg: cell === "\u25C6" ? ACCENT : cell === "\u2588" ? GREEN : cell === "\u25CF" ? INK : FAINT,
|
|
2144
|
-
children: cell === "\xB7" ? " " : cell
|
|
2145
|
-
},
|
|
2146
|
-
x
|
|
2147
|
-
)) }, index)) });
|
|
2148
2769
|
|
|
2149
2770
|
// src/dashboard.tsx
|
|
2150
2771
|
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "@opentui/react/jsx-runtime";
|
|
@@ -2155,7 +2776,9 @@ var STATUS_COLOR = {
|
|
|
2155
2776
|
idle: INK_2,
|
|
2156
2777
|
completed: FAINT,
|
|
2157
2778
|
failed: ERROR,
|
|
2158
|
-
stopped: FAINT
|
|
2779
|
+
stopped: FAINT,
|
|
2780
|
+
stopping: INK_2,
|
|
2781
|
+
settled: FAINT
|
|
2159
2782
|
};
|
|
2160
2783
|
var AGENT_LIVE_STATUSES = /* @__PURE__ */ new Set(["starting", "running", "waiting"]);
|
|
2161
2784
|
var timeAgo = (iso) => {
|
|
@@ -2168,14 +2791,14 @@ var timeAgo = (iso) => {
|
|
|
2168
2791
|
if (hours < 24) return `${hours}h ago`;
|
|
2169
2792
|
return `${Math.floor(hours / 24)}d ago`;
|
|
2170
2793
|
};
|
|
2171
|
-
var
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
sessions:
|
|
2177
|
-
detail: "session"
|
|
2794
|
+
var lastSessionWords = (group) => {
|
|
2795
|
+
const at = group.sessions.length === 0 ? group.createdAt : groupActivityAt(group);
|
|
2796
|
+
const elapsed = elapsedWords(at);
|
|
2797
|
+
if (elapsed === null) return [];
|
|
2798
|
+
const ago = elapsed === "<1m" ? "just now" : `${elapsed} ago`;
|
|
2799
|
+
return [group.sessions.length === 0 ? `created ${ago}` : `last session created ${ago}`];
|
|
2178
2800
|
};
|
|
2801
|
+
var fit = (text, width) => text.length <= width ? text : `${text.slice(0, Math.max(0, width - 1))}\u2026`;
|
|
2179
2802
|
var WORKTREE_ROW_HEIGHT = 2;
|
|
2180
2803
|
var SESSION_ROW_HEIGHT = 2;
|
|
2181
2804
|
var Gutter = ({ selected }) => /* @__PURE__ */ jsx3("span", { fg: selected ? ACCENT : FAINT, children: selected ? "\u258C " : " " });
|
|
@@ -2234,7 +2857,7 @@ var ProjectRow = ({
|
|
|
2234
2857
|
return /* @__PURE__ */ jsx3("box", { height: 1, flexShrink: 0, backgroundColor: selected ? WASH : "transparent", children: /* @__PURE__ */ jsxs3("text", { height: 1, bg: "transparent", children: [
|
|
2235
2858
|
/* @__PURE__ */ jsx3(Gutter, { selected }),
|
|
2236
2859
|
/* @__PURE__ */ jsx3("span", { fg: INK, children: fit(item.project.name, nameWidth).padEnd(nameWidth + 1) }),
|
|
2237
|
-
/* @__PURE__ */ jsx3("span", { fg: item.live > 0 ? MUTED : FAINT, children: item.live > 0 ? `${item.live}/${item.total}` : String(item.total) })
|
|
2860
|
+
/* @__PURE__ */ jsx3("span", { fg: item.live + item.stopping > 0 ? MUTED : FAINT, children: item.live + item.stopping > 0 ? `${item.live + item.stopping}/${item.total}` : String(item.total) })
|
|
2238
2861
|
] }) });
|
|
2239
2862
|
};
|
|
2240
2863
|
var WorktreeRow = ({
|
|
@@ -2242,18 +2865,16 @@ var WorktreeRow = ({
|
|
|
2242
2865
|
selected,
|
|
2243
2866
|
width
|
|
2244
2867
|
}) => {
|
|
2245
|
-
const
|
|
2246
|
-
const
|
|
2247
|
-
const status = live ? folded : "settled";
|
|
2248
|
-
const color = live ? STATUS_COLOR[folded] ?? MUTED : FAINT;
|
|
2868
|
+
const status = foldGroupStatus(group);
|
|
2869
|
+
const color = STATUS_COLOR[status] ?? MUTED;
|
|
2249
2870
|
const open = group.annotation?.openComments ?? 0;
|
|
2250
2871
|
const sessions = group.sessions.length;
|
|
2251
2872
|
const nameWidth = Math.max(6, width - 5 - status.length);
|
|
2252
2873
|
const factWidth = Math.max(8, width - 3);
|
|
2253
2874
|
const facts = fitHints(
|
|
2254
2875
|
[
|
|
2255
|
-
fit(groupBaseLabel(group), factWidth),
|
|
2256
|
-
|
|
2876
|
+
fit(`from ${groupBaseLabel(group)}`, Math.max(12, Math.floor(factWidth / 2))),
|
|
2877
|
+
...lastSessionWords(group),
|
|
2257
2878
|
...open > 0 ? [`${open} open`] : [],
|
|
2258
2879
|
...sessions === 0 ? ["empty"] : sessions === 1 ? [] : [`${sessions} sessions`]
|
|
2259
2880
|
],
|
|
@@ -2273,25 +2894,12 @@ var SessionRow = ({
|
|
|
2273
2894
|
selected,
|
|
2274
2895
|
width
|
|
2275
2896
|
}) => {
|
|
2276
|
-
const { session
|
|
2897
|
+
const { session } = item;
|
|
2277
2898
|
const status = session.status;
|
|
2278
2899
|
const color = STATUS_COLOR[status] ?? MUTED;
|
|
2279
|
-
const agents = processes.filter((process2) => process2.kind !== "shell").length;
|
|
2280
|
-
const shells = processes.filter((process2) => process2.kind === "shell").length;
|
|
2281
2900
|
const nameWidth = Math.max(6, width - 5 - status.length);
|
|
2282
2901
|
const factWidth = Math.max(8, width - 3);
|
|
2283
|
-
const
|
|
2284
|
-
const facts = fitHints(
|
|
2285
|
-
[
|
|
2286
|
-
...hold === null ? [] : [hold],
|
|
2287
|
-
session.harness,
|
|
2288
|
-
shortAge(session.createdAt),
|
|
2289
|
-
...shells > 0 ? [`${shells} shell`] : [],
|
|
2290
|
-
...agents > 0 ? [`${agents} agent`] : [],
|
|
2291
|
-
...hold === null && services.length > 0 ? [`${services.length} service`] : []
|
|
2292
|
-
],
|
|
2293
|
-
factWidth
|
|
2294
|
-
);
|
|
2902
|
+
const facts = sessionRowFacts(item, factWidth);
|
|
2295
2903
|
return /* @__PURE__ */ jsxs3("box", { flexShrink: 0, flexDirection: "column", backgroundColor: selected ? WASH : "transparent", children: [
|
|
2296
2904
|
/* @__PURE__ */ jsx3("box", { height: 1, flexShrink: 0, backgroundColor: "transparent", children: /* @__PURE__ */ jsxs3("text", { height: 1, bg: "transparent", children: [
|
|
2297
2905
|
/* @__PURE__ */ jsx3(Gutter, { selected }),
|
|
@@ -2304,11 +2912,12 @@ var SessionRow = ({
|
|
|
2304
2912
|
var HarnessRow = ({
|
|
2305
2913
|
item,
|
|
2306
2914
|
selected,
|
|
2307
|
-
background
|
|
2915
|
+
background,
|
|
2916
|
+
width
|
|
2308
2917
|
}) => /* @__PURE__ */ jsx3("box", { height: 1, flexShrink: 0, backgroundColor: selected ? WASH : background, children: /* @__PURE__ */ jsxs3("text", { height: 1, bg: selected ? WASH : background, children: [
|
|
2309
2918
|
/* @__PURE__ */ jsx3(Gutter, { selected }),
|
|
2310
2919
|
/* @__PURE__ */ jsx3("span", { fg: INK, children: item.label.padEnd(12) }),
|
|
2311
|
-
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: item.hint })
|
|
2920
|
+
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: fit(item.hint, Math.max(4, width - 2 - 12)) })
|
|
2312
2921
|
] }) });
|
|
2313
2922
|
var PREVIEW_GLYPH = {
|
|
2314
2923
|
user: "\u203A ",
|
|
@@ -2336,12 +2945,16 @@ var SessionFacts = ({
|
|
|
2336
2945
|
group,
|
|
2337
2946
|
item,
|
|
2338
2947
|
rows,
|
|
2339
|
-
tunnels
|
|
2948
|
+
tunnels,
|
|
2949
|
+
workspaceRows
|
|
2340
2950
|
}) => {
|
|
2341
2951
|
const { session, annotation, services } = item;
|
|
2342
2952
|
const color = STATUS_COLOR[session.status] ?? MUTED;
|
|
2343
2953
|
const hold = sessionHold(item);
|
|
2344
|
-
const
|
|
2954
|
+
const starting = session.status === "starting";
|
|
2955
|
+
const phase = starting ? startingWordsOf(session) : null;
|
|
2956
|
+
const summary = (starting ? withoutLaunchPhase(session.summary) : session.summary)?.split("\n")[0] ?? null;
|
|
2957
|
+
const when = starting ? null : sessionTimeWords(item);
|
|
2345
2958
|
const change = annotation ?? group?.annotation;
|
|
2346
2959
|
const lines = [
|
|
2347
2960
|
/* @__PURE__ */ jsxs3("text", { height: 1, bg: "transparent", children: [
|
|
@@ -2352,6 +2965,10 @@ var SessionFacts = ({
|
|
|
2352
2965
|
/* @__PURE__ */ jsxs3("text", { height: 1, bg: "transparent", children: [
|
|
2353
2966
|
/* @__PURE__ */ jsx3("span", { children: " " }),
|
|
2354
2967
|
/* @__PURE__ */ jsx3("span", { fg: color, children: session.status }),
|
|
2968
|
+
phase === null ? null : /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
2969
|
+
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: " \xB7 " }),
|
|
2970
|
+
/* @__PURE__ */ jsx3("span", { fg: INK_2, children: phase })
|
|
2971
|
+
] }),
|
|
2355
2972
|
hold === null ? null : /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
2356
2973
|
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: " \xB7 " }),
|
|
2357
2974
|
/* @__PURE__ */ jsx3("span", { fg: INK_2, children: hold })
|
|
@@ -2360,7 +2977,23 @@ var SessionFacts = ({
|
|
|
2360
2977
|
/* @__PURE__ */ jsx3("span", { fg: MUTED, children: session.branch }),
|
|
2361
2978
|
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: session.baseSha === "" ? "" : ` vs ${session.baseRef ?? session.baseSha.slice(0, 12)}` })
|
|
2362
2979
|
] }, "status"),
|
|
2363
|
-
|
|
2980
|
+
// Who else is live here, what a turn waits for, a workspace waiting to be replaced: right
|
|
2981
|
+
// under the status, before the facts a short pane may drop.
|
|
2982
|
+
...workspaceRows.map((row, index) => /* @__PURE__ */ jsx3(
|
|
2983
|
+
"text",
|
|
2984
|
+
{
|
|
2985
|
+
height: 1,
|
|
2986
|
+
bg: "transparent",
|
|
2987
|
+
fg: row.startsWith(" ") ? MUTED : INK_2,
|
|
2988
|
+
children: ` ${row}`
|
|
2989
|
+
},
|
|
2990
|
+
`workspace-${index}`
|
|
2991
|
+
)),
|
|
2992
|
+
/* @__PURE__ */ jsx3("text", { height: 1, bg: "transparent", fg: FAINT, children: [
|
|
2993
|
+
...timeAgo(session.createdAt) === "" ? [] : [`created ${timeAgo(session.createdAt)}`],
|
|
2994
|
+
isPendingId(session.id) ? "provisioning" : session.id.slice(0, 8),
|
|
2995
|
+
...when === null || when.startsWith("created ") ? [] : [when]
|
|
2996
|
+
].join(" \xB7 ").replace(/^/, " ") }, "started"),
|
|
2364
2997
|
/* @__PURE__ */ jsxs3("text", { height: 1, bg: "transparent", children: [
|
|
2365
2998
|
/* @__PURE__ */ jsx3("span", { children: " " }),
|
|
2366
2999
|
services.length === 0 ? /* @__PURE__ */ jsx3("span", { fg: FAINT, children: "no services running" }) : services.slice(0, 2).map((service, index) => {
|
|
@@ -2409,7 +3042,7 @@ var StatusLine = ({
|
|
|
2409
3042
|
}
|
|
2410
3043
|
return void 0;
|
|
2411
3044
|
}, [busy, status]);
|
|
2412
|
-
const text = busy === null ? status !== null && Date.now() - status.at < 5e3 ? ` ${status.text}` : "" : ` ${busy} ${Math.max(0, Math.round((now - busyStarted) / 1e3))}s`;
|
|
3045
|
+
const text = busy === null ? status !== null && Date.now() - status.at < 5e3 ? ` ${status.text}` : "" : ` ${busy} ${Math.max(0, Math.round((now - busyStarted) / 1e3))}s elapsed`;
|
|
2413
3046
|
return /* @__PURE__ */ jsx3("text", { height: 1, fg: INK_2, bg: "transparent", children: text });
|
|
2414
3047
|
};
|
|
2415
3048
|
var errorText = (error) => error instanceof Error ? error.message : String(error);
|
|
@@ -2421,7 +3054,8 @@ var startedOrStarting = async (start, starting) => {
|
|
|
2421
3054
|
throw error;
|
|
2422
3055
|
}
|
|
2423
3056
|
};
|
|
2424
|
-
var
|
|
3057
|
+
var stillStartingLine = (session, verb, awaited) => session.status !== "starting" ? null : `still ${verb} \xB7 ${sessionDisplayName(session)} \xB7 ${awaited ? "attaches once it runs" : "a attaches once the row reads running"}`;
|
|
3058
|
+
var HANDOVER_MS = 600;
|
|
2425
3059
|
var keepSpanVisible = (scroll, top, height, viewRows) => {
|
|
2426
3060
|
if (scroll === null || viewRows <= 0) return;
|
|
2427
3061
|
const viewH = Math.max(1, viewRows);
|
|
@@ -2430,10 +3064,23 @@ var keepSpanVisible = (scroll, top, height, viewRows) => {
|
|
|
2430
3064
|
};
|
|
2431
3065
|
var PREVIEW_MAX_LINES = 300;
|
|
2432
3066
|
var SESSION_FACT_ROWS = 6;
|
|
3067
|
+
var SNAKE_CHROME_ROWS = 5;
|
|
3068
|
+
var SNAKE_MIN_BOARD_ROWS = 4;
|
|
3069
|
+
var SNAKE_MIN_BOARD_COLS = 8;
|
|
3070
|
+
var SNAKE_MIN_PANE_ROWS = SNAKE_CHROME_ROWS + SNAKE_MIN_BOARD_ROWS;
|
|
3071
|
+
var SNAKE_MIN_PANE_COLS = SNAKE_MIN_BOARD_COLS + 4;
|
|
2433
3072
|
var noShare = () => "off";
|
|
2434
3073
|
var NO_TUNNELS = [];
|
|
2435
3074
|
var noTunnels = () => NO_TUNNELS;
|
|
2436
|
-
var
|
|
3075
|
+
var NO_FILTERS = {
|
|
3076
|
+
projects: "",
|
|
3077
|
+
worktrees: "",
|
|
3078
|
+
sessions: ""
|
|
3079
|
+
};
|
|
3080
|
+
var App = ({
|
|
3081
|
+
ctx,
|
|
3082
|
+
onQuit
|
|
3083
|
+
}) => {
|
|
2437
3084
|
const renderer = useRenderer();
|
|
2438
3085
|
const queryClient = useQueryClient2();
|
|
2439
3086
|
const { data, failureReason } = useQuery2({
|
|
@@ -2443,8 +3090,13 @@ var App = ({ ctx, onQuit }) => {
|
|
|
2443
3090
|
retry: true,
|
|
2444
3091
|
retryDelay: 1e3
|
|
2445
3092
|
});
|
|
2446
|
-
const [
|
|
3093
|
+
const [columnFocus, setFocusState] = useState3("sessions");
|
|
2447
3094
|
const [lastNav, setLastNav] = useState3("sessions");
|
|
3095
|
+
const [screenMode, setScreenMode] = useState3("normal");
|
|
3096
|
+
const [filters, setFilters] = useState3(NO_FILTERS);
|
|
3097
|
+
const [filtering, setFiltering] = useState3(null);
|
|
3098
|
+
const [helpOpen, setHelpOpen] = useState3(false);
|
|
3099
|
+
const [helpOffset, setHelpOffset] = useState3(0);
|
|
2448
3100
|
const [projectKey, setProjectKey] = useState3(null);
|
|
2449
3101
|
const [worktreeKey, setWorktreeKey] = useState3(null);
|
|
2450
3102
|
const [sessionKey, setSessionKey] = useState3(null);
|
|
@@ -2471,12 +3123,19 @@ var App = ({ ctx, onQuit }) => {
|
|
|
2471
3123
|
const adoptOfferDecided = useRef2(false);
|
|
2472
3124
|
const [reviewing, setReviewing] = useState3(null);
|
|
2473
3125
|
const lockRef = useRef2(false);
|
|
3126
|
+
const startsRef = useRef2([]);
|
|
3127
|
+
const awaitedRef = useRef2(null);
|
|
3128
|
+
const autoAttach = ctx.autoAttach !== false;
|
|
3129
|
+
const [snakeFocus, setSnakeFocus] = useState3(null);
|
|
3130
|
+
const [snakeOverlay, setSnakeOverlay] = useState3(ctx.openSnake === true);
|
|
2474
3131
|
const [gate] = useState3(createLaunchGate);
|
|
2475
3132
|
const creatingRef = useRef2(creating);
|
|
2476
3133
|
creatingRef.current = creating;
|
|
2477
3134
|
const branchRequest = useRef2(0);
|
|
2478
3135
|
const { width: terminalCols, height: terminalRows } = useTerminalDimensions2();
|
|
2479
|
-
const projectItems = deriveProjects(data)
|
|
3136
|
+
const projectItems = deriveProjects(data).filter(
|
|
3137
|
+
(item) => matchesFilter(filters.projects, item.project.name)
|
|
3138
|
+
);
|
|
2480
3139
|
const homeProject = data === void 0 ? void 0 : matchProjectByCwd(data.projects, cwdFacts(ctx.cwd));
|
|
2481
3140
|
const projectIndexRaw = projectKey === null ? -1 : projectItems.findIndex((p) => p.project.id === projectKey);
|
|
2482
3141
|
const projectIndex = projectIndexRaw === -1 ? Math.max(
|
|
@@ -2484,20 +3143,42 @@ var App = ({ ctx, onQuit }) => {
|
|
|
2484
3143
|
homeProject === void 0 ? 0 : projectItems.findIndex((p) => p.project.id === homeProject.id)
|
|
2485
3144
|
) : projectIndexRaw;
|
|
2486
3145
|
const selectedProject = projectItems[projectIndex] ?? null;
|
|
2487
|
-
const worktreeGroups = deriveWorktrees(data, selectedProject?.project.id ?? null)
|
|
3146
|
+
const worktreeGroups = deriveWorktrees(data, selectedProject?.project.id ?? null).filter(
|
|
3147
|
+
(group) => matchesFilter(filters.worktrees, group.name, groupBaseLabel(group))
|
|
3148
|
+
);
|
|
2488
3149
|
const worktreeIndexRaw = worktreeKey === null ? -1 : worktreeGroups.findIndex((group) => group.key === worktreeKey);
|
|
2489
3150
|
const sessionWorktreeIndex = worktreeGroups.findIndex(
|
|
2490
3151
|
(group) => group.sessions.some((item) => item.session.id === sessionKey)
|
|
2491
3152
|
);
|
|
2492
3153
|
const worktreeIndex = worktreeIndexRaw === -1 ? Math.max(0, sessionWorktreeIndex) : worktreeIndexRaw;
|
|
2493
3154
|
const selectedGroup = worktreeGroups[worktreeIndex] ?? null;
|
|
2494
|
-
const sessionItems = selectedGroup?.sessions ?? []
|
|
3155
|
+
const sessionItems = (selectedGroup?.sessions ?? []).filter(
|
|
3156
|
+
(item) => matchesFilter(
|
|
3157
|
+
filters.sessions,
|
|
3158
|
+
sessionDisplayName(item.session),
|
|
3159
|
+
item.session.harness,
|
|
3160
|
+
item.session.status
|
|
3161
|
+
)
|
|
3162
|
+
);
|
|
2495
3163
|
const sessionIndexRaw = sessionKey === null ? -1 : sessionItems.findIndex((item) => item.session.id === sessionKey);
|
|
2496
3164
|
const sessionIndex = sessionIndexRaw === -1 ? 0 : sessionIndexRaw;
|
|
2497
3165
|
const selectedItem = sessionItems[sessionIndex] ?? null;
|
|
2498
3166
|
const selectedSession = selectedItem?.session ?? null;
|
|
2499
|
-
const pickerItems = picker === null ? [] : deriveHarnesses(picker.session);
|
|
2500
|
-
const
|
|
3167
|
+
const pickerItems = picker === null ? [] : deriveHarnesses(picker.session, picker.worktree?.name ?? null);
|
|
3168
|
+
const waiting = selectedSession !== null && (selectedSession.status === "starting" || isPendingId(selectedSession.id));
|
|
3169
|
+
const dialogOpen = picker !== null || editing !== null || creating !== null || adoptOffer !== null || reviewing !== null || helpOpen || filtering !== null;
|
|
3170
|
+
const gameLayout = planLayout(terminalCols, terminalRows, "detail", lastNav);
|
|
3171
|
+
const snakeFits = gameLayout.detailRows >= SNAKE_MIN_PANE_ROWS && gameLayout.detailWidth >= SNAKE_MIN_PANE_COLS;
|
|
3172
|
+
const overlayFits = terminalRows >= 12 && terminalCols >= 22;
|
|
3173
|
+
const adoptFailureLines = adoptOffer?.failure === void 0 ? [] : wrapWords(adoptOffer.failure, Math.min(70, terminalCols - 4) - 6).slice(
|
|
3174
|
+
0,
|
|
3175
|
+
Math.max(1, terminalRows - 9)
|
|
3176
|
+
);
|
|
3177
|
+
const overlayOpen = snakeOverlay && !dialogOpen;
|
|
3178
|
+
const overlayFocused = overlayOpen && overlayFits;
|
|
3179
|
+
const snakeFocused = snakeFocus !== null && waiting && snakeFits && !dialogOpen && !snakeOverlay;
|
|
3180
|
+
const focus = snakeFocused ? "detail" : columnFocus;
|
|
3181
|
+
const layout = planLayout(terminalCols, terminalRows, focus, lastNav, screenMode);
|
|
2501
3182
|
const detailWidth = layout.detailWidth;
|
|
2502
3183
|
const sectionRows = (section) => layout.sections.find((entry) => entry.section === section)?.rows ?? 0;
|
|
2503
3184
|
const previewSessionId = selectedSession !== null && !isPendingId(selectedSession.id) ? selectedSession.id : null;
|
|
@@ -2518,6 +3199,28 @@ var App = ({ ctx, onQuit }) => {
|
|
|
2518
3199
|
refetchInterval: previewLive ? 8e3 : false,
|
|
2519
3200
|
retry: 1
|
|
2520
3201
|
});
|
|
3202
|
+
const viewer = useQuery2({
|
|
3203
|
+
queryKey: VIEWER_KEY,
|
|
3204
|
+
queryFn: () => fetchViewer(ctx),
|
|
3205
|
+
enabled: viewerNeeded(data),
|
|
3206
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
3207
|
+
retry: false
|
|
3208
|
+
});
|
|
3209
|
+
const workspaceReads = selectedSession === null ? { waiting: false, retirement: false } : workspaceReadsOf(selectedSession);
|
|
3210
|
+
const workspaceFacts = useQuery2({
|
|
3211
|
+
queryKey: WORKSPACE_FACTS_KEY(previewSessionId ?? "none", workspaceReads),
|
|
3212
|
+
queryFn: () => fetchWorkspaceFacts(ctx.api, previewSessionId ?? "", workspaceReads),
|
|
3213
|
+
enabled: previewSessionId !== null && previewLive && detailWidth > 0 && (workspaceReads.waiting || workspaceReads.retirement),
|
|
3214
|
+
staleTime: 3e3,
|
|
3215
|
+
refetchInterval: previewLive ? 8e3 : false,
|
|
3216
|
+
retry: 1
|
|
3217
|
+
});
|
|
3218
|
+
const workspaceRows = selectedSession === null || !previewLive || detailWidth === 0 ? [] : workspaceFactRows(
|
|
3219
|
+
selectedSession,
|
|
3220
|
+
viewer.data,
|
|
3221
|
+
workspaceFacts.data,
|
|
3222
|
+
Math.max(16, detailWidth - 4)
|
|
3223
|
+
);
|
|
2521
3224
|
const preview = useMemo2(
|
|
2522
3225
|
() => transcript.data === void 0 ? [] : previewLines(transcript.data, {
|
|
2523
3226
|
width: Math.max(16, detailWidth - 6),
|
|
@@ -2526,24 +3229,28 @@ var App = ({ ctx, onQuit }) => {
|
|
|
2526
3229
|
[transcript.data, detailWidth]
|
|
2527
3230
|
);
|
|
2528
3231
|
const [previewOffset, setPreviewOffset] = useState3(0);
|
|
2529
|
-
const
|
|
3232
|
+
const allFactRows = Math.max(
|
|
3233
|
+
0,
|
|
3234
|
+
Math.min(SESSION_FACT_ROWS + workspaceRows.length, layout.detailRows - 2)
|
|
3235
|
+
);
|
|
3236
|
+
const factRows = waiting ? Math.max(0, Math.min(allFactRows, layout.detailRows - SNAKE_MIN_PANE_ROWS - 1)) : allFactRows;
|
|
2530
3237
|
const showFactRule = factRows > 0 && layout.detailRows - factRows > 1;
|
|
2531
|
-
const
|
|
3238
|
+
const snakeRoom = {
|
|
3239
|
+
cols: detailWidth - 4,
|
|
3240
|
+
rows: layout.detailRows - factRows - (showFactRule ? 1 : 0) - SNAKE_CHROME_ROWS
|
|
3241
|
+
};
|
|
3242
|
+
const snakeShown = snakeRoom.rows >= SNAKE_MIN_BOARD_ROWS && snakeRoom.cols >= SNAKE_MIN_BOARD_COLS;
|
|
2532
3243
|
const snake = useSnake({
|
|
2533
|
-
width: Math.max(
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
enabled: waiting
|
|
3244
|
+
width: Math.max(SNAKE_MIN_BOARD_COLS, Math.min(40, snakeRoom.cols)),
|
|
3245
|
+
height: Math.max(SNAKE_MIN_BOARD_ROWS, Math.min(14, snakeRoom.rows)),
|
|
3246
|
+
focused: snakeFocused
|
|
2537
3247
|
});
|
|
2538
|
-
const [snakeAwayFor, setSnakeAwayFor] = useState3(null);
|
|
2539
|
-
const snakeShown = waiting && snakeAwayFor !== selectedSession?.id;
|
|
2540
|
-
const [snakeOverlay, setSnakeOverlay] = useState3(ctx.openSnake === true);
|
|
2541
3248
|
const overlayWidth = Math.max(16, Math.min(60, terminalCols - 8));
|
|
2542
3249
|
const overlayHeight = Math.max(6, Math.min(20, terminalRows - 10));
|
|
2543
3250
|
const overlaySnake = useSnake({
|
|
2544
3251
|
width: overlayWidth,
|
|
2545
3252
|
height: overlayHeight,
|
|
2546
|
-
|
|
3253
|
+
focused: overlayFocused
|
|
2547
3254
|
});
|
|
2548
3255
|
const previewRows = Math.max(1, layout.detailRows - factRows - (showFactRule ? 1 : 0));
|
|
2549
3256
|
const previewView = previewWindow(preview, previewRows, previewOffset);
|
|
@@ -2556,6 +3263,9 @@ var App = ({ ctx, onQuit }) => {
|
|
|
2556
3263
|
setPreviewOffset(0);
|
|
2557
3264
|
};
|
|
2558
3265
|
const say = (text) => setStatus({ text, at: Date.now() });
|
|
3266
|
+
const clearFilters = (...sections) => setFilters(
|
|
3267
|
+
(current) => sections.every((section) => current[section] === "") ? current : { ...current, ...Object.fromEntries(sections.map((section) => [section, ""])) }
|
|
3268
|
+
);
|
|
2559
3269
|
const refetch = () => void queryClient.invalidateQueries({ queryKey: WORKBENCH_KEY });
|
|
2560
3270
|
useEffect3(() => {
|
|
2561
3271
|
const share = ctx.agentShare;
|
|
@@ -2563,16 +3273,16 @@ var App = ({ ctx, onQuit }) => {
|
|
|
2563
3273
|
return share.subscribe((event) => {
|
|
2564
3274
|
if (event === null) return;
|
|
2565
3275
|
if (event.kind === "sign-requested") {
|
|
2566
|
-
say(`\u270E signature requested
|
|
3276
|
+
say(`\u270E signature requested \xB7 ${event.context} \xB7 touch your key if it blinks`);
|
|
2567
3277
|
} else if (event.kind === "signed") say(`\u2713 signed (${event.seconds.toFixed(1)}s)`);
|
|
2568
|
-
else if (event.kind === "not-signed") say(`\u2717 not signed \
|
|
3278
|
+
else if (event.kind === "not-signed") say(`\u2717 not signed \xB7 ${event.message}`);
|
|
2569
3279
|
});
|
|
2570
3280
|
}, [ctx.agentShare]);
|
|
2571
3281
|
useEffect3(() => {
|
|
2572
3282
|
if (data === void 0 || adoptOfferDecided.current) return;
|
|
2573
3283
|
if (homeProject !== void 0) return;
|
|
2574
3284
|
adoptOfferDecided.current = true;
|
|
2575
|
-
setAdoptOffer(deriveAdoptOffer(cwdFacts(ctx.cwd)));
|
|
3285
|
+
setAdoptOffer(deriveAdoptOffer(cwdFacts(ctx.cwd), ctx.gitAccessMode));
|
|
2576
3286
|
}, [data, homeProject]);
|
|
2577
3287
|
const projectScrollRef = useRef2(null);
|
|
2578
3288
|
const worktreeScrollRef = useRef2(null);
|
|
@@ -2602,6 +3312,7 @@ var App = ({ ctx, onQuit }) => {
|
|
|
2602
3312
|
const attachFlow = async (session) => {
|
|
2603
3313
|
const short = session.id.slice(0, 8);
|
|
2604
3314
|
lockRef.current = true;
|
|
3315
|
+
awaitedRef.current = null;
|
|
2605
3316
|
renderer.suspend();
|
|
2606
3317
|
const tunneled = openTunnels.filter((tunnel) => tunnel.service.sessionId === session.id).map((tunnel) => `\u25CF ${tunnel.line} \xB7 tunnel
|
|
2607
3318
|
`).join("");
|
|
@@ -2622,7 +3333,7 @@ ${tunneled}
|
|
|
2622
3333
|
const liveProtocol = liveProtocolOf(detail.processes);
|
|
2623
3334
|
const existing = liveShellOf(detail.processes);
|
|
2624
3335
|
if (liveProtocol !== null) {
|
|
2625
|
-
process.stdout.write(`taking over from the protocol session \
|
|
3336
|
+
process.stdout.write(`taking over from the protocol session \xB7 same conversation\u2026
|
|
2626
3337
|
|
|
2627
3338
|
`);
|
|
2628
3339
|
await ctx.api("POST", `/sessions/${session.id}/handoff`, { to: "pty" });
|
|
@@ -2632,12 +3343,12 @@ ${tunneled}
|
|
|
2632
3343
|
"POST",
|
|
2633
3344
|
`/sessions/${session.id}/shell`
|
|
2634
3345
|
);
|
|
2635
|
-
process.stdout.write(`no live terminal \
|
|
3346
|
+
process.stdout.write(`no live terminal \xB7 opened a shell in the workspace
|
|
2636
3347
|
|
|
2637
3348
|
`);
|
|
2638
3349
|
outcome = await ctx.attachTty(session.id, "shell", shell.id);
|
|
2639
3350
|
} else {
|
|
2640
|
-
process.stdout.write(`no live terminal \
|
|
3351
|
+
process.stdout.write(`no live terminal \xB7 rejoining the open shell
|
|
2641
3352
|
|
|
2642
3353
|
`);
|
|
2643
3354
|
outcome = await ctx.attachTty(session.id, "shell", existing.id);
|
|
@@ -2651,10 +3362,54 @@ ${tunneled}
|
|
|
2651
3362
|
lockRef.current = false;
|
|
2652
3363
|
}
|
|
2653
3364
|
say(
|
|
2654
|
-
outcome === "unavailable" ? "attach unavailable \
|
|
3365
|
+
outcome === "unavailable" ? "attach unavailable \xB7 could not connect" : outcome === "no-answer" ? `no answer \xB7 the server did not open ${short}'s terminal; it keeps running \xB7 a tries again` : outcome === "detached" || outcome === "interrupted" ? `detached \xB7 ${short} keeps running` : outcome === "dropped" ? `disconnected \xB7 ${short} \xB7 refreshing session status` : `terminal ended \xB7 ${short} \xB7 refreshing session status`
|
|
2655
3366
|
);
|
|
2656
3367
|
refetch();
|
|
2657
3368
|
};
|
|
3369
|
+
const watchStart = (id, verb) => {
|
|
3370
|
+
startsRef.current = [...startsRef.current, { id, verb, sessionId: null }];
|
|
3371
|
+
awaitedRef.current = id;
|
|
3372
|
+
};
|
|
3373
|
+
const answerStart = (id, sessionId) => {
|
|
3374
|
+
startsRef.current = startsRef.current.map(
|
|
3375
|
+
(watch) => watch.id === id ? { ...watch, sessionId } : watch
|
|
3376
|
+
);
|
|
3377
|
+
};
|
|
3378
|
+
const dropStart = (id) => {
|
|
3379
|
+
startsRef.current = startsRef.current.filter((watch) => watch.id !== id);
|
|
3380
|
+
if (awaitedRef.current === id) awaitedRef.current = null;
|
|
3381
|
+
};
|
|
3382
|
+
const stopAwaiting = () => {
|
|
3383
|
+
awaitedRef.current = null;
|
|
3384
|
+
};
|
|
3385
|
+
const handOver = (session) => {
|
|
3386
|
+
lockRef.current = true;
|
|
3387
|
+
const played = snake.play.clock.kind !== "ready" || snake.play.game.score > 0;
|
|
3388
|
+
setSnakeFocus(null);
|
|
3389
|
+
say(
|
|
3390
|
+
`ready \xB7 ${sessionDisplayName(session)} \xB7 attaching${played ? ` \xB7 snake score ${snake.play.game.score}` : ""}`
|
|
3391
|
+
);
|
|
3392
|
+
setTimeout(() => void attachFlow(session), HANDOVER_MS);
|
|
3393
|
+
};
|
|
3394
|
+
useEffect3(() => {
|
|
3395
|
+
if (data === void 0 || startsRef.current.length === 0) return;
|
|
3396
|
+
let attach = null;
|
|
3397
|
+
for (const watch of startsRef.current) {
|
|
3398
|
+
const progress = startProgress(data, watch);
|
|
3399
|
+
if (progress.kind === "starting") continue;
|
|
3400
|
+
const awaited = awaitedRef.current === watch.id;
|
|
3401
|
+
dropStart(watch.id);
|
|
3402
|
+
const name = sessionDisplayName(progress.session);
|
|
3403
|
+
if (progress.kind === "ended") {
|
|
3404
|
+
say(`${progress.session.status} \xB7 ${name} \xB7 it did not reach running`);
|
|
3405
|
+
} else if (awaited && autoAttach && !dialogOpen && !lockRef.current && selectedSession?.id === progress.session.id) {
|
|
3406
|
+
attach = progress.session;
|
|
3407
|
+
} else {
|
|
3408
|
+
say(`${watch.verb} \xB7 ${name} \xB7 a attaches`);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
if (attach !== null) handOver(attach);
|
|
3412
|
+
}, [data]);
|
|
2658
3413
|
const settleRefetch = () => {
|
|
2659
3414
|
if (queryClient.isMutating() === 1) refetch();
|
|
2660
3415
|
};
|
|
@@ -2665,8 +3420,9 @@ ${tunneled}
|
|
|
2665
3420
|
};
|
|
2666
3421
|
const launchMutation = useMutation2({
|
|
2667
3422
|
mutationFn: async (vars) => {
|
|
2668
|
-
|
|
2669
|
-
|
|
3423
|
+
if (HARNESS_COMMANDS[vars.harness] === void 0) {
|
|
3424
|
+
throw new Error(`unknown harness "${vars.harness}"`);
|
|
3425
|
+
}
|
|
2670
3426
|
const session = await ctx.api("POST", `/projects/${vars.projectId}/sessions`, {
|
|
2671
3427
|
harness: vars.harness,
|
|
2672
3428
|
label: null,
|
|
@@ -2674,7 +3430,7 @@ ${tunneled}
|
|
|
2674
3430
|
base: vars.base
|
|
2675
3431
|
});
|
|
2676
3432
|
return startedOrStarting(
|
|
2677
|
-
ctx.api("POST", `/sessions/${session.id}/launch`, {
|
|
3433
|
+
ctx.api("POST", `/sessions/${session.id}/launch`, {}),
|
|
2678
3434
|
session
|
|
2679
3435
|
);
|
|
2680
3436
|
},
|
|
@@ -2693,17 +3449,26 @@ ${tunneled}
|
|
|
2693
3449
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2694
3450
|
})
|
|
2695
3451
|
);
|
|
3452
|
+
clearFilters("worktrees", "sessions");
|
|
2696
3453
|
setWorktreeKey(vars.pendingKey);
|
|
2697
3454
|
selectSession(vars.pendingKey);
|
|
2698
|
-
setBusy(`provisioning ${vars.harness} workspace \
|
|
3455
|
+
setBusy(`provisioning ${vars.harness} workspace \xB7`);
|
|
2699
3456
|
setBusyStarted(Date.now());
|
|
2700
3457
|
},
|
|
2701
3458
|
onError: (error, vars) => {
|
|
3459
|
+
dropStart(vars.pendingKey);
|
|
2702
3460
|
patchWorkbench((current) => removeSession(current, vars.projectId, vars.pendingKey));
|
|
3461
|
+
setSnakeFocus((current) => current?.start === vars.gateKey ? null : current);
|
|
2703
3462
|
setBusy(null);
|
|
2704
3463
|
say(errorText(error));
|
|
2705
3464
|
},
|
|
2706
3465
|
onSuccess: (session, vars) => {
|
|
3466
|
+
const line = stillStartingLine(
|
|
3467
|
+
session,
|
|
3468
|
+
"starting",
|
|
3469
|
+
autoAttach && awaitedRef.current === vars.pendingKey
|
|
3470
|
+
);
|
|
3471
|
+
answerStart(vars.pendingKey, session.id);
|
|
2707
3472
|
patchWorkbench(
|
|
2708
3473
|
(current) => replaceSession(current, vars.projectId, vars.pendingKey, session)
|
|
2709
3474
|
);
|
|
@@ -2712,7 +3477,7 @@ ${tunneled}
|
|
|
2712
3477
|
);
|
|
2713
3478
|
setSessionKey((current) => current === vars.pendingKey ? session.id : current);
|
|
2714
3479
|
setBusy(null);
|
|
2715
|
-
say(
|
|
3480
|
+
if (line !== null) say(line);
|
|
2716
3481
|
},
|
|
2717
3482
|
onSettled: (_data, _error, vars) => {
|
|
2718
3483
|
gate.release(vars.gateKey);
|
|
@@ -2736,60 +3501,58 @@ ${tunneled}
|
|
|
2736
3501
|
);
|
|
2737
3502
|
selectSession(vars.session.id);
|
|
2738
3503
|
setBusy(
|
|
2739
|
-
`resuming ${sessionDisplayName(vars.session)} \
|
|
3504
|
+
`resuming ${sessionDisplayName(vars.session)} \xB7 a fresh workspace restores the saved state \xB7`
|
|
2740
3505
|
);
|
|
2741
3506
|
setBusyStarted(Date.now());
|
|
2742
3507
|
},
|
|
2743
|
-
onError: (error) => {
|
|
3508
|
+
onError: (error, vars) => {
|
|
3509
|
+
dropStart(vars.watch);
|
|
3510
|
+
setSnakeFocus((current) => current?.start === vars.gateKey ? null : current);
|
|
2744
3511
|
setBusy(null);
|
|
2745
3512
|
say(errorText(error));
|
|
2746
3513
|
refetch();
|
|
2747
3514
|
},
|
|
2748
3515
|
onSuccess: (resumed, vars) => {
|
|
3516
|
+
const line = stillStartingLine(
|
|
3517
|
+
resumed,
|
|
3518
|
+
"resuming",
|
|
3519
|
+
autoAttach && awaitedRef.current === vars.watch
|
|
3520
|
+
);
|
|
3521
|
+
answerStart(vars.watch, resumed.id);
|
|
2749
3522
|
patchWorkbench(
|
|
2750
3523
|
(current) => replaceSession(current, vars.projectId, vars.session.id, resumed)
|
|
2751
3524
|
);
|
|
2752
3525
|
setBusy(null);
|
|
2753
|
-
say(
|
|
2754
|
-
resumed.status === "starting" ? `still resuming \xB7 ${sessionDisplayName(resumed)} \u2014 a attaches once the row reads running` : `resumed \xB7 ${sessionDisplayName(resumed)} \u2014 a attaches`
|
|
2755
|
-
);
|
|
3526
|
+
if (line !== null) say(line);
|
|
2756
3527
|
},
|
|
2757
3528
|
onSettled: (_data, _error, vars) => {
|
|
2758
3529
|
gate.release(vars.gateKey);
|
|
2759
3530
|
settleRefetch();
|
|
2760
3531
|
}
|
|
2761
3532
|
});
|
|
2762
|
-
const
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
hint: "the machine's Mend deploy key \u2014 add its public half on the git host"
|
|
2772
|
-
},
|
|
2773
|
-
{
|
|
2774
|
-
mode: "bridge",
|
|
2775
|
-
label: "bridge",
|
|
2776
|
-
hint: "your OWN ssh-agent, relayed while `mend keys share` runs here"
|
|
2777
|
-
}
|
|
2778
|
-
];
|
|
3533
|
+
const ADOPT_AUTH_HINTS = {
|
|
3534
|
+
"mend-key": "your Mend key \xB7 add its public half on the git host",
|
|
3535
|
+
bridge: "your own ssh-agent, relayed while `mend keys share` runs"
|
|
3536
|
+
};
|
|
3537
|
+
const ADOPT_AUTH_MODES = ADOPT_MODE_ORDER.map((mode) => ({
|
|
3538
|
+
mode,
|
|
3539
|
+
label: mode,
|
|
3540
|
+
hint: ADOPT_AUTH_HINTS[mode]
|
|
3541
|
+
}));
|
|
2779
3542
|
const adoptMutation = useMutation2({
|
|
2780
3543
|
mutationFn: (offer) => submitDashboardAdoption(ctx.api, {
|
|
2781
3544
|
name: offer.name,
|
|
2782
3545
|
source: offer.source,
|
|
2783
|
-
gitAuthMode: ADOPT_AUTH_MODES[offer.modeIndex]?.mode ?? "
|
|
3546
|
+
gitAuthMode: ADOPT_AUTH_MODES[offer.modeIndex]?.mode ?? "mend-key"
|
|
2784
3547
|
}),
|
|
2785
3548
|
onMutate: (offer) => {
|
|
2786
3549
|
setAdoptOffer(null);
|
|
2787
|
-
setBusy(`adopting ${offer.name} \
|
|
3550
|
+
setBusy(`adopting ${offer.name} \xB7 cloning into the store \xB7`);
|
|
2788
3551
|
setBusyStarted(Date.now());
|
|
2789
3552
|
},
|
|
2790
|
-
onError: (error) => {
|
|
3553
|
+
onError: (error, offer) => {
|
|
2791
3554
|
setBusy(null);
|
|
2792
|
-
|
|
3555
|
+
setAdoptOffer(refusedAdoptOffer(offer, errorText(error)));
|
|
2793
3556
|
},
|
|
2794
3557
|
onSuccess: (result) => {
|
|
2795
3558
|
setBusy(null);
|
|
@@ -2798,7 +3561,8 @@ ${tunneled}
|
|
|
2798
3561
|
return;
|
|
2799
3562
|
}
|
|
2800
3563
|
const project = result.project;
|
|
2801
|
-
|
|
3564
|
+
clearFilters("projects");
|
|
3565
|
+
say(`adopted \xB7 ${project.name} \xB7 w starts a worktree`);
|
|
2802
3566
|
setProjectKey(project.id);
|
|
2803
3567
|
setWorktreeKey(null);
|
|
2804
3568
|
setSessionKey(null);
|
|
@@ -2833,7 +3597,7 @@ ${tunneled}
|
|
|
2833
3597
|
},
|
|
2834
3598
|
onSuccess: (result, session) => {
|
|
2835
3599
|
say(
|
|
2836
|
-
`stopped ${result.stopped} service${result.stopped === 1 ? "" : "s"} \xB7 ${sessionDisplayName(session)} \
|
|
3600
|
+
`stopped ${result.stopped} service${result.stopped === 1 ? "" : "s"} \xB7 ${sessionDisplayName(session)} \xB7 the workspace ends once nothing is live`
|
|
2837
3601
|
);
|
|
2838
3602
|
},
|
|
2839
3603
|
onError: (error) => {
|
|
@@ -2847,7 +3611,7 @@ ${tunneled}
|
|
|
2847
3611
|
onMutate: async (session) => {
|
|
2848
3612
|
await queryClient.cancelQueries({ queryKey: WORKBENCH_KEY });
|
|
2849
3613
|
patchWorkbench((current) => markSessionStopped(current, session.id));
|
|
2850
|
-
say(`stopped \xB7 ${sessionDisplayName(session)} \
|
|
3614
|
+
say(`stopped \xB7 ${sessionDisplayName(session)} \xB7 the record and review remain`);
|
|
2851
3615
|
},
|
|
2852
3616
|
onError: (error) => {
|
|
2853
3617
|
say(errorText(error));
|
|
@@ -2857,14 +3621,15 @@ ${tunneled}
|
|
|
2857
3621
|
});
|
|
2858
3622
|
const launchInWorktreeMutation = useMutation2({
|
|
2859
3623
|
mutationFn: async (vars) => {
|
|
2860
|
-
|
|
2861
|
-
|
|
3624
|
+
if (HARNESS_COMMANDS[vars.harness] === void 0) {
|
|
3625
|
+
throw new Error(`unknown harness "${vars.harness}"`);
|
|
3626
|
+
}
|
|
2862
3627
|
const session = await ctx.api("POST", `/worktrees/${vars.worktreeId}/sessions`, {
|
|
2863
3628
|
harness: vars.harness,
|
|
2864
3629
|
label: null
|
|
2865
3630
|
});
|
|
2866
3631
|
return startedOrStarting(
|
|
2867
|
-
ctx.api("POST", `/sessions/${session.id}/launch`, {
|
|
3632
|
+
ctx.api("POST", `/sessions/${session.id}/launch`, {}),
|
|
2868
3633
|
session
|
|
2869
3634
|
);
|
|
2870
3635
|
},
|
|
@@ -2884,22 +3649,31 @@ ${tunneled}
|
|
|
2884
3649
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2885
3650
|
})
|
|
2886
3651
|
);
|
|
3652
|
+
clearFilters("sessions");
|
|
2887
3653
|
selectSession(vars.pendingKey);
|
|
2888
3654
|
setBusy(`starting ${vars.harness} in the worktree \xB7`);
|
|
2889
3655
|
setBusyStarted(Date.now());
|
|
2890
3656
|
},
|
|
2891
3657
|
onError: (error, vars) => {
|
|
3658
|
+
dropStart(vars.pendingKey);
|
|
2892
3659
|
patchWorkbench((current) => removeSession(current, vars.projectId, vars.pendingKey));
|
|
3660
|
+
setSnakeFocus((current) => current?.start === vars.gateKey ? null : current);
|
|
2893
3661
|
setBusy(null);
|
|
2894
3662
|
say(errorText(error));
|
|
2895
3663
|
},
|
|
2896
3664
|
onSuccess: (session, vars) => {
|
|
3665
|
+
const line = stillStartingLine(
|
|
3666
|
+
session,
|
|
3667
|
+
"starting",
|
|
3668
|
+
autoAttach && awaitedRef.current === vars.pendingKey
|
|
3669
|
+
);
|
|
3670
|
+
answerStart(vars.pendingKey, session.id);
|
|
2897
3671
|
patchWorkbench(
|
|
2898
3672
|
(current) => replaceSession(current, vars.projectId, vars.pendingKey, session)
|
|
2899
3673
|
);
|
|
2900
3674
|
setSessionKey((current) => current === vars.pendingKey ? session.id : current);
|
|
2901
3675
|
setBusy(null);
|
|
2902
|
-
say(
|
|
3676
|
+
if (line !== null) say(line);
|
|
2903
3677
|
},
|
|
2904
3678
|
onSettled: (_data, _error, vars) => {
|
|
2905
3679
|
gate.release(vars.gateKey);
|
|
@@ -2944,7 +3718,7 @@ ${tunneled}
|
|
|
2944
3718
|
refetch();
|
|
2945
3719
|
},
|
|
2946
3720
|
onSuccess: (_result, session) => {
|
|
2947
|
-
say(`removed \xB7 ${sessionDisplayName(session)} \
|
|
3721
|
+
say(`removed \xB7 ${sessionDisplayName(session)} \xB7 the worktree remains`);
|
|
2948
3722
|
refetch();
|
|
2949
3723
|
},
|
|
2950
3724
|
onSettled: settleRefetch
|
|
@@ -2956,7 +3730,7 @@ ${tunneled}
|
|
|
2956
3730
|
if (group === null || group.sessions.some((item) => isPendingId(item.session.id))) return;
|
|
2957
3731
|
if (group.live > 0) {
|
|
2958
3732
|
say(
|
|
2959
|
-
`${group.live} session${group.live === 1 ? "" : "s"} live \
|
|
3733
|
+
`${group.live} session${group.live === 1 ? "" : "s"} live \xB7 stop them first (\u21E7K) \xB7 ${group.name}`
|
|
2960
3734
|
);
|
|
2961
3735
|
return;
|
|
2962
3736
|
}
|
|
@@ -2967,13 +3741,13 @@ ${tunneled}
|
|
|
2967
3741
|
}
|
|
2968
3742
|
setRemoveArmed(`wt:${group.key}`);
|
|
2969
3743
|
const facts = group.sessions.length === 1 ? "its session and change go with it" : `${group.sessions.length} sessions and the change go with it`;
|
|
2970
|
-
say(`press \u21E7D again to remove worktree \xB7 ${group.name} \
|
|
3744
|
+
say(`press \u21E7D again to remove worktree \xB7 ${group.name} \xB7 ${facts}`);
|
|
2971
3745
|
return;
|
|
2972
3746
|
}
|
|
2973
3747
|
const session = selectedSession;
|
|
2974
3748
|
if (session === null || isPendingId(session.id)) return;
|
|
2975
3749
|
if (AGENT_LIVE_STATUSES.has(session.status)) {
|
|
2976
|
-
say(`the agent is still working \
|
|
3750
|
+
say(`the agent is still working \xB7 stop it first (\u21E7K) \xB7 ${sessionDisplayName(session)}`);
|
|
2977
3751
|
return;
|
|
2978
3752
|
}
|
|
2979
3753
|
if (removeArmed === session.id && confirmationVisible("press \u21E7D again")) {
|
|
@@ -2983,7 +3757,7 @@ ${tunneled}
|
|
|
2983
3757
|
}
|
|
2984
3758
|
setRemoveArmed(session.id);
|
|
2985
3759
|
say(
|
|
2986
|
-
`press \u21E7D again to remove session \xB7 ${sessionDisplayName(session)} \
|
|
3760
|
+
`press \u21E7D again to remove session \xB7 ${sessionDisplayName(session)} \xB7 its record goes, the worktree stays`
|
|
2987
3761
|
);
|
|
2988
3762
|
};
|
|
2989
3763
|
const armStop = () => {
|
|
@@ -2992,7 +3766,7 @@ ${tunneled}
|
|
|
2992
3766
|
if (group === null) return;
|
|
2993
3767
|
const live = group.sessions.filter((item) => LIVE_STATUSES.has(item.session.status));
|
|
2994
3768
|
if (live.length === 0) {
|
|
2995
|
-
say("nothing to stop \
|
|
3769
|
+
say("nothing to stop \xB7 the worktree is settled");
|
|
2996
3770
|
return;
|
|
2997
3771
|
}
|
|
2998
3772
|
if (stopArmed === `wt:${group.key}` && confirmationVisible("press \u21E7K again")) {
|
|
@@ -3008,7 +3782,7 @@ ${tunneled}
|
|
|
3008
3782
|
}
|
|
3009
3783
|
const session = selectedSession;
|
|
3010
3784
|
if (session === null || isPendingId(session.id)) return;
|
|
3011
|
-
const hold = selectedItem === null ? null :
|
|
3785
|
+
const hold = selectedItem === null ? null : servicesHoldOf(selectedItem);
|
|
3012
3786
|
if (hold !== null) {
|
|
3013
3787
|
if (stopArmed === `svc:${session.id}` && confirmationVisible("press \u21E7K again")) {
|
|
3014
3788
|
setStopArmed(null);
|
|
@@ -3016,11 +3790,16 @@ ${tunneled}
|
|
|
3016
3790
|
return;
|
|
3017
3791
|
}
|
|
3018
3792
|
setStopArmed(`svc:${session.id}`);
|
|
3019
|
-
say(`press \u21E7K again to stop the services \xB7 ${sessionDisplayName(session)} \
|
|
3793
|
+
say(`press \u21E7K again to stop the services \xB7 ${sessionDisplayName(session)} \xB7 ${hold}`);
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3796
|
+
if (session.status === "stopping") {
|
|
3797
|
+
const saving = selectedItem === null ? null : sessionHold(selectedItem);
|
|
3798
|
+
say(`already stopping${saving === null ? "" : ` \xB7 ${saving}`}`);
|
|
3020
3799
|
return;
|
|
3021
3800
|
}
|
|
3022
3801
|
if (!LIVE_STATUSES.has(session.status)) {
|
|
3023
|
-
say("nothing to stop \
|
|
3802
|
+
say("nothing to stop \xB7 the session is settled");
|
|
3024
3803
|
return;
|
|
3025
3804
|
}
|
|
3026
3805
|
if (stopArmed === session.id && confirmationVisible("press \u21E7K again")) {
|
|
@@ -3072,7 +3851,7 @@ ${tunneled}
|
|
|
3072
3851
|
if (creatingRef.current?.projectId !== projectId || request !== branchRequest.current)
|
|
3073
3852
|
return;
|
|
3074
3853
|
const message = errorText(error);
|
|
3075
|
-
say(`could not read branches \
|
|
3854
|
+
say(`could not read branches \xB7 ${message}`);
|
|
3076
3855
|
setCreating(
|
|
3077
3856
|
(current) => current?.projectId === projectId ? { ...current, branches: [], branchError: message } : current
|
|
3078
3857
|
);
|
|
@@ -3107,17 +3886,20 @@ ${tunneled}
|
|
|
3107
3886
|
const gateKey = `launch:${current.projectId}:${current.name}`;
|
|
3108
3887
|
if (!gate.take(gateKey)) {
|
|
3109
3888
|
setCreating(null);
|
|
3110
|
-
say("that worktree is already starting \
|
|
3889
|
+
say("that worktree is already starting \xB7 wait for it to finish before starting another");
|
|
3111
3890
|
return;
|
|
3112
3891
|
}
|
|
3113
3892
|
setCreating(null);
|
|
3893
|
+
setSnakeFocus({ returnTo: focus, start: gateKey });
|
|
3114
3894
|
setFocus("sessions");
|
|
3895
|
+
const pendingKey = pendingId();
|
|
3896
|
+
watchStart(pendingKey, "started");
|
|
3115
3897
|
launchMutation.mutate({
|
|
3116
3898
|
projectId: current.projectId,
|
|
3117
3899
|
harness: choice.harness,
|
|
3118
3900
|
name: current.name === "" ? null : current.name,
|
|
3119
3901
|
base: current.base,
|
|
3120
|
-
pendingKey
|
|
3902
|
+
pendingKey,
|
|
3121
3903
|
gateKey
|
|
3122
3904
|
});
|
|
3123
3905
|
};
|
|
@@ -3138,11 +3920,11 @@ ${tunneled}
|
|
|
3138
3920
|
return;
|
|
3139
3921
|
case "starting":
|
|
3140
3922
|
say(
|
|
3141
|
-
`still starting \xB7 ${sessionDisplayName(plan.session)} \
|
|
3923
|
+
`still starting \xB7 ${sessionDisplayName(plan.session)} \xB7 a attaches once the row reads running`
|
|
3142
3924
|
);
|
|
3143
3925
|
return;
|
|
3144
3926
|
case "settled":
|
|
3145
|
-
say(`settled \xB7 ${sessionDisplayName(plan.session)} \
|
|
3927
|
+
say(`settled \xB7 ${sessionDisplayName(plan.session)} \xB7 r resumes it, \u21E7D removes it`);
|
|
3146
3928
|
return;
|
|
3147
3929
|
case "stopping":
|
|
3148
3930
|
say(
|
|
@@ -3150,10 +3932,10 @@ ${tunneled}
|
|
|
3150
3932
|
);
|
|
3151
3933
|
return;
|
|
3152
3934
|
case "pending":
|
|
3153
|
-
say("still provisioning \
|
|
3935
|
+
say("still provisioning \xB7 the row fills in when the workspace answers");
|
|
3154
3936
|
return;
|
|
3155
3937
|
case "none":
|
|
3156
|
-
say("no session selected \
|
|
3938
|
+
say("no session selected \xB7 n starts one");
|
|
3157
3939
|
return;
|
|
3158
3940
|
}
|
|
3159
3941
|
};
|
|
@@ -3168,13 +3950,13 @@ ${tunneled}
|
|
|
3168
3950
|
openPicker(plan.session);
|
|
3169
3951
|
return;
|
|
3170
3952
|
case "live":
|
|
3171
|
-
say(`already live \xB7 ${sessionDisplayName(plan.session)} \
|
|
3953
|
+
say(`already live \xB7 ${sessionDisplayName(plan.session)} \xB7 a attaches`);
|
|
3172
3954
|
return;
|
|
3173
3955
|
case "pending":
|
|
3174
|
-
say("still provisioning \
|
|
3956
|
+
say("still provisioning \xB7 nothing to resume yet");
|
|
3175
3957
|
return;
|
|
3176
3958
|
case "none":
|
|
3177
|
-
say("no session selected \
|
|
3959
|
+
say("no session selected \xB7 n starts one");
|
|
3178
3960
|
return;
|
|
3179
3961
|
}
|
|
3180
3962
|
};
|
|
@@ -3184,8 +3966,11 @@ ${tunneled}
|
|
|
3184
3966
|
say(`already resuming \xB7 ${sessionDisplayName(session)}`);
|
|
3185
3967
|
return;
|
|
3186
3968
|
}
|
|
3969
|
+
setSnakeFocus({ returnTo: focus, start: gateKey });
|
|
3187
3970
|
setFocus("sessions");
|
|
3188
|
-
|
|
3971
|
+
const watch = pendingId();
|
|
3972
|
+
watchStart(watch, "resumed");
|
|
3973
|
+
resumeMutation.mutate({ projectId, session, harness, gateKey, watch });
|
|
3189
3974
|
};
|
|
3190
3975
|
const newSession = () => {
|
|
3191
3976
|
const projectId = selectedProject?.project.id;
|
|
@@ -3215,12 +4000,15 @@ ${tunneled}
|
|
|
3215
4000
|
say(`already starting a session in ${group.name}`);
|
|
3216
4001
|
return;
|
|
3217
4002
|
}
|
|
4003
|
+
setSnakeFocus({ returnTo: focus, start: gateKey });
|
|
3218
4004
|
setFocus("sessions");
|
|
4005
|
+
const pendingKey = pendingId();
|
|
4006
|
+
watchStart(pendingKey, "started");
|
|
3219
4007
|
launchInWorktreeMutation.mutate({
|
|
3220
4008
|
projectId,
|
|
3221
4009
|
worktreeId: group.id,
|
|
3222
4010
|
harness,
|
|
3223
|
-
pendingKey
|
|
4011
|
+
pendingKey,
|
|
3224
4012
|
gateKey
|
|
3225
4013
|
});
|
|
3226
4014
|
};
|
|
@@ -3233,6 +4021,7 @@ ${tunneled}
|
|
|
3233
4021
|
case "projects": {
|
|
3234
4022
|
const item = projectItems[clampIndex(projectItems.length, projectIndex + delta)];
|
|
3235
4023
|
if (item === void 0) return;
|
|
4024
|
+
if (item !== selectedProject) stopAwaiting();
|
|
3236
4025
|
setProjectKey(item.project.id);
|
|
3237
4026
|
setWorktreeKey(null);
|
|
3238
4027
|
setSessionKey(null);
|
|
@@ -3242,6 +4031,7 @@ ${tunneled}
|
|
|
3242
4031
|
case "worktrees": {
|
|
3243
4032
|
const group = worktreeGroups[clampIndex(worktreeGroups.length, worktreeIndex + delta)];
|
|
3244
4033
|
if (group === void 0) return;
|
|
4034
|
+
if (group !== selectedGroup) stopAwaiting();
|
|
3245
4035
|
setWorktreeKey(group.key);
|
|
3246
4036
|
setSessionKey(null);
|
|
3247
4037
|
setPreviewOffset(0);
|
|
@@ -3250,6 +4040,7 @@ ${tunneled}
|
|
|
3250
4040
|
case "sessions": {
|
|
3251
4041
|
const item = sessionItems[clampIndex(sessionItems.length, sessionIndex + delta)];
|
|
3252
4042
|
if (item === void 0) return;
|
|
4043
|
+
if (item !== selectedItem) stopAwaiting();
|
|
3253
4044
|
selectSession(item.session.id);
|
|
3254
4045
|
return;
|
|
3255
4046
|
}
|
|
@@ -3263,34 +4054,35 @@ ${tunneled}
|
|
|
3263
4054
|
return;
|
|
3264
4055
|
}
|
|
3265
4056
|
};
|
|
3266
|
-
const
|
|
4057
|
+
const goTo = (next) => {
|
|
4058
|
+
if (next === "projects" || next === "worktrees") stopAwaiting();
|
|
4059
|
+
if (next === "detail" && waiting && snakeFits) {
|
|
4060
|
+
setSnakeFocus({ returnTo: focus, start: null });
|
|
4061
|
+
return;
|
|
4062
|
+
}
|
|
4063
|
+
setFocus(next);
|
|
4064
|
+
};
|
|
4065
|
+
const moveColumn = (delta) => goTo(stepColumn(focus, delta));
|
|
3267
4066
|
useKeyboard2((key) => {
|
|
3268
4067
|
if (reviewing !== null) return;
|
|
3269
4068
|
if (lockRef.current) return;
|
|
3270
4069
|
if (key.ctrl && key.name === "c") return onQuit();
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
if (waiting && focus === "detail" && picker === null && editing === null && creating === null) {
|
|
3282
|
-
if (snakeShown) {
|
|
3283
|
-
if (key.name === "up" || key.name === "down" || key.name === "left" || key.name === "right") {
|
|
3284
|
-
snake.steer(key.name);
|
|
3285
|
-
return;
|
|
4070
|
+
const verb = verbForKey(strokeName(key), key.shift === true);
|
|
4071
|
+
const game = overlayFocused ? overlaySnake : snakeFocused ? snake : null;
|
|
4072
|
+
if (game !== null || overlayOpen) {
|
|
4073
|
+
const action = snakeKey(key.name ?? "");
|
|
4074
|
+
if (action?.type === "leave") {
|
|
4075
|
+
if (overlayOpen) {
|
|
4076
|
+
setSnakeOverlay(false);
|
|
4077
|
+
} else if (snakeFocus !== null) {
|
|
4078
|
+
setFocus(snakeFocus.returnTo);
|
|
4079
|
+
setSnakeFocus(null);
|
|
3286
4080
|
}
|
|
3287
|
-
|
|
3288
|
-
if (key.name === "escape") return setSnakeAwayFor(selectedSession?.id ?? null);
|
|
3289
|
-
} else if (key.name === "space") {
|
|
3290
|
-
return setSnakeAwayFor(null);
|
|
4081
|
+
return;
|
|
3291
4082
|
}
|
|
4083
|
+
if (action !== null) return game?.send(action);
|
|
4084
|
+
if (gameSwallows(verb) || game === null) return;
|
|
3292
4085
|
}
|
|
3293
|
-
const verb = verbForKey(key.name ?? "", key.shift === true);
|
|
3294
4086
|
if (verb !== "stop") setStopArmed(null);
|
|
3295
4087
|
if (verb !== "remove") setRemoveArmed(null);
|
|
3296
4088
|
if (adoptOffer !== null) {
|
|
@@ -3365,6 +4157,26 @@ ${tunneled}
|
|
|
3365
4157
|
}
|
|
3366
4158
|
return;
|
|
3367
4159
|
}
|
|
4160
|
+
if (helpOpen) {
|
|
4161
|
+
if (key.name === "escape" || key.name === "q" || verb === "help") {
|
|
4162
|
+
setHelpOpen(false);
|
|
4163
|
+
} else if (verb === "moveDown" || verb === "pageDown") {
|
|
4164
|
+
setHelpOffset(
|
|
4165
|
+
(current) => Math.max(0, Math.min(helpMaxOffset, current + (verb === "pageDown" ? 10 : 1)))
|
|
4166
|
+
);
|
|
4167
|
+
} else if (verb === "moveUp" || verb === "pageUp") {
|
|
4168
|
+
setHelpOffset((current) => Math.max(0, current - (verb === "pageUp" ? 10 : 1)));
|
|
4169
|
+
}
|
|
4170
|
+
return;
|
|
4171
|
+
}
|
|
4172
|
+
if (filtering !== null) {
|
|
4173
|
+
if (key.name === "escape") {
|
|
4174
|
+
clearFilters(filtering);
|
|
4175
|
+
setFiltering(null);
|
|
4176
|
+
} else if (key.name === "down") moveSelection(1);
|
|
4177
|
+
else if (key.name === "up") moveSelection(-1);
|
|
4178
|
+
return;
|
|
4179
|
+
}
|
|
3368
4180
|
if (picker !== null) {
|
|
3369
4181
|
switch (key.name) {
|
|
3370
4182
|
case "down":
|
|
@@ -3397,9 +4209,13 @@ ${tunneled}
|
|
|
3397
4209
|
return;
|
|
3398
4210
|
}
|
|
3399
4211
|
}
|
|
4212
|
+
if (snakeFocus !== null && verb !== null) setSnakeFocus(null);
|
|
4213
|
+
if (key.name === "space" && waiting && snakeFits && focus === "detail") {
|
|
4214
|
+
return setSnakeFocus({ returnTo: focus, start: null });
|
|
4215
|
+
}
|
|
3400
4216
|
if (key.ctrl === true) return;
|
|
3401
4217
|
if (focus === "projects" && ["attach", "resume", "stop", "remove", "rename", "openWeb", "review"].includes(verb ?? "")) {
|
|
3402
|
-
say("select a session first \
|
|
4218
|
+
say("select a session first \xB7 \u2192 opens worktrees");
|
|
3403
4219
|
return;
|
|
3404
4220
|
}
|
|
3405
4221
|
switch (verb) {
|
|
@@ -3417,6 +4233,37 @@ ${tunneled}
|
|
|
3417
4233
|
return moveColumn(1);
|
|
3418
4234
|
case "columnLeft":
|
|
3419
4235
|
return moveColumn(-1);
|
|
4236
|
+
case "nextPane":
|
|
4237
|
+
return goTo(cyclePane(focus, 1));
|
|
4238
|
+
case "prevPane":
|
|
4239
|
+
return goTo(cyclePane(focus, -1));
|
|
4240
|
+
case "jumpProjects":
|
|
4241
|
+
case "jumpWorktrees":
|
|
4242
|
+
case "jumpSessions":
|
|
4243
|
+
case "jumpDetail":
|
|
4244
|
+
return goTo(paneForDigit(strokeName(key)) ?? focus);
|
|
4245
|
+
case "back":
|
|
4246
|
+
if (isNavSection(focus) && filters[focus] !== "") {
|
|
4247
|
+
clearFilters(focus);
|
|
4248
|
+
return;
|
|
4249
|
+
}
|
|
4250
|
+
return goTo(backFrom(focus, lastNav));
|
|
4251
|
+
case "filter":
|
|
4252
|
+
if (!isNavSection(focus)) {
|
|
4253
|
+
say("/ filters a list \xB7 1 2 3 jump to one");
|
|
4254
|
+
return;
|
|
4255
|
+
}
|
|
4256
|
+
return setFiltering(focus);
|
|
4257
|
+
case "nextScreenMode":
|
|
4258
|
+
case "prevScreenMode": {
|
|
4259
|
+
const next = stepScreenMode(screenMode, verb === "nextScreenMode" ? 1 : -1);
|
|
4260
|
+
setScreenMode(next);
|
|
4261
|
+
say(`screen mode \xB7 ${next}${next === "normal" ? "" : " \xB7 + and _ cycle it"}`);
|
|
4262
|
+
return;
|
|
4263
|
+
}
|
|
4264
|
+
case "help":
|
|
4265
|
+
setHelpOffset(0);
|
|
4266
|
+
return setHelpOpen(true);
|
|
3420
4267
|
case "attach":
|
|
3421
4268
|
return attachSelected();
|
|
3422
4269
|
case "resume":
|
|
@@ -3452,7 +4299,7 @@ ${tunneled}
|
|
|
3452
4299
|
const session = selectedSession;
|
|
3453
4300
|
if (session === null) return;
|
|
3454
4301
|
if (isPendingId(session.id)) {
|
|
3455
|
-
say("still provisioning \
|
|
4302
|
+
say("still provisioning \xB7 nothing to review yet");
|
|
3456
4303
|
return;
|
|
3457
4304
|
}
|
|
3458
4305
|
const target = reviewTargetForSession(
|
|
@@ -3472,22 +4319,54 @@ ${tunneled}
|
|
|
3472
4319
|
}
|
|
3473
4320
|
});
|
|
3474
4321
|
const liveTotal = projectItems.reduce((sum, item) => sum + item.live, 0);
|
|
3475
|
-
const
|
|
4322
|
+
const stoppingTotal = projectItems.reduce((sum, item) => sum + item.stopping, 0);
|
|
4323
|
+
const named = (section) => filters[section] === "" ? section : `${section} /${filters[section]}`;
|
|
4324
|
+
const columnTitle = (column) => numberedTitle(column, columnWords(column));
|
|
4325
|
+
const columnWords = (column) => {
|
|
3476
4326
|
if (column === "worktrees") {
|
|
3477
|
-
return selectedProject === null ? "worktrees" :
|
|
4327
|
+
return selectedProject === null ? named("worktrees") : `${named("worktrees")} \xB7 ${worktreeGroups.length}${selectedProject.live > 0 ? ` \xB7 ${selectedProject.live} live` : ""}`;
|
|
3478
4328
|
}
|
|
3479
4329
|
if (column === "sessions") {
|
|
3480
|
-
return selectedGroup === null ? "sessions" :
|
|
4330
|
+
return selectedGroup === null ? named("sessions") : `${named("sessions")} \xB7 ${sessionItems.length}`;
|
|
3481
4331
|
}
|
|
3482
4332
|
if (column === "detail") {
|
|
3483
4333
|
if (selectedSession === null) return "session";
|
|
3484
4334
|
return previewView.offset === 0 ? "session \xB7 read-only" : `session \xB7 read-only \xB7 ${previewView.later} newer below`;
|
|
3485
4335
|
}
|
|
3486
|
-
return
|
|
4336
|
+
return named("projects");
|
|
3487
4337
|
};
|
|
3488
|
-
const pickerTitle = picker === null ? "" : picker.worktree === void 0 ? picker.session === null ? "new session \
|
|
4338
|
+
const pickerTitle = picker === null ? "" : picker.worktree === void 0 ? picker.session === null ? "new session \xB7 pick a harness" : `resume ${sessionDisplayName(picker.session)} \xB7 pick a harness` : `new session in ${picker.worktree.name} \xB7 pick a harness`;
|
|
4339
|
+
const modalWidth = Math.min(74, terminalCols - 4);
|
|
4340
|
+
const pickerJoinRows = picker?.worktree?.id == null || selectedProject === null ? [] : worktreeJoinRows(
|
|
4341
|
+
data,
|
|
4342
|
+
selectedProject.project.id,
|
|
4343
|
+
{ id: picker.worktree.id },
|
|
4344
|
+
viewer.data?.userId ?? null,
|
|
4345
|
+
modalWidth - 4
|
|
4346
|
+
);
|
|
4347
|
+
const pickerJoinHeight = pickerJoinRows.length === 0 ? 0 : pickerJoinRows.length + 1;
|
|
4348
|
+
const creatingJoinRows = creating === null || !creating.joins ? [] : worktreeJoinRows(
|
|
4349
|
+
data,
|
|
4350
|
+
creating.projectId,
|
|
4351
|
+
{ name: creating.name },
|
|
4352
|
+
viewer.data?.userId ?? null,
|
|
4353
|
+
modalWidth - 7
|
|
4354
|
+
);
|
|
3489
4355
|
const creatingHeight = 2 + 1 + 1 + 6 + 1 + deriveHarnesses(null).length;
|
|
3490
|
-
const
|
|
4356
|
+
const modalFieldWidth = Math.max(4, modalWidth - 2 - 11 - 1);
|
|
4357
|
+
const footerText = adoptOffer === null ? editing === null ? creating === null ? picker === null ? overlayFocused || snakeFocused ? ` ${snakeHints(overlayFocused ? overlaySnake.play : snake.play)}` : ` ${footerHints(focus, Math.max(12, terminalCols - 2))}` : " \u2191\u2193 move \xB7 enter start \xB7 esc cancel" : creating.step === "name" ? " enter continue \xB7 esc cancel" : creating.step === "base" ? " type to filter \xB7 \u2191\u2193 move \xB7 enter choose base \xB7 esc back" : " \u2191\u2193 move \xB7 enter launch \xB7 esc back" : " enter save \xB7 esc cancel" : " enter adopt \xB7 \u2190\u2192 auth mode \xB7 esc not now";
|
|
4358
|
+
const helpWidth = Math.min(96, terminalCols - 4);
|
|
4359
|
+
const helpLines = helpSections(focus).flatMap((section, index) => [
|
|
4360
|
+
...index === 0 ? [] : [{ kind: "blank", key: `blank-${section.title}` }],
|
|
4361
|
+
{ kind: "title", key: `title-${section.title}`, text: section.title },
|
|
4362
|
+
...section.rows.map((row) => ({ kind: "row", key: row.verb, row }))
|
|
4363
|
+
]);
|
|
4364
|
+
const helpRows = Math.max(1, Math.min(helpLines.length, terminalRows - 6));
|
|
4365
|
+
const helpMaxOffset = Math.max(0, helpLines.length - helpRows);
|
|
4366
|
+
const helpView = helpLines.slice(
|
|
4367
|
+
Math.min(helpOffset, helpMaxOffset),
|
|
4368
|
+
Math.min(helpOffset, helpMaxOffset) + helpRows
|
|
4369
|
+
);
|
|
3491
4370
|
const loadFailure = data === void 0 && failureReason !== null ? errorText(failureReason) : null;
|
|
3492
4371
|
if (reviewing !== null) {
|
|
3493
4372
|
return /* @__PURE__ */ jsx3(
|
|
@@ -3513,11 +4392,11 @@ ${tunneled}
|
|
|
3513
4392
|
const sectionFact = (section) => {
|
|
3514
4393
|
if (section === "projects") {
|
|
3515
4394
|
if (selectedProject === null) return "";
|
|
3516
|
-
return selectedProject.live
|
|
4395
|
+
return liveCountWords(selectedProject.live, selectedProject.stopping);
|
|
3517
4396
|
}
|
|
3518
4397
|
if (section === "worktrees") {
|
|
3519
4398
|
if (selectedGroup === null) return "";
|
|
3520
|
-
return
|
|
4399
|
+
return foldGroupStatus(selectedGroup);
|
|
3521
4400
|
}
|
|
3522
4401
|
return selectedSession?.status ?? "";
|
|
3523
4402
|
};
|
|
@@ -3572,7 +4451,12 @@ ${tunneled}
|
|
|
3572
4451
|
},
|
|
3573
4452
|
item.project.id
|
|
3574
4453
|
)),
|
|
3575
|
-
data !== void 0 && projectItems.length === 0 ? /* @__PURE__ */ jsx3(
|
|
4454
|
+
data !== void 0 && projectItems.length === 0 ? /* @__PURE__ */ jsx3(
|
|
4455
|
+
EmptyNote,
|
|
4456
|
+
{
|
|
4457
|
+
text: filters.projects === "" ? "none adopted yet" : `nothing matches /${filters.projects} \xB7 esc clears`
|
|
4458
|
+
}
|
|
4459
|
+
) : null
|
|
3576
4460
|
]
|
|
3577
4461
|
}
|
|
3578
4462
|
)
|
|
@@ -3604,7 +4488,12 @@ ${tunneled}
|
|
|
3604
4488
|
},
|
|
3605
4489
|
group.key
|
|
3606
4490
|
)),
|
|
3607
|
-
data !== void 0 && worktreeGroups.length === 0 ? /* @__PURE__ */ jsx3(
|
|
4491
|
+
data !== void 0 && worktreeGroups.length === 0 ? /* @__PURE__ */ jsx3(
|
|
4492
|
+
EmptyNote,
|
|
4493
|
+
{
|
|
4494
|
+
text: filters.worktrees === "" ? "no worktrees \xB7 w starts one" : `nothing matches /${filters.worktrees} \xB7 esc clears`
|
|
4495
|
+
}
|
|
4496
|
+
) : null
|
|
3608
4497
|
]
|
|
3609
4498
|
}
|
|
3610
4499
|
)
|
|
@@ -3639,10 +4528,10 @@ ${tunneled}
|
|
|
3639
4528
|
data !== void 0 && sessionItems.length === 0 ? /* @__PURE__ */ jsx3(
|
|
3640
4529
|
EmptyNote,
|
|
3641
4530
|
{
|
|
3642
|
-
text: selectedGroup === null ? "no worktree selected" : "no sessions \
|
|
4531
|
+
text: selectedGroup === null ? "no worktree selected" : filters.sessions === "" ? "no sessions \xB7 n starts one" : `nothing matches /${filters.sessions} \xB7 esc clears`
|
|
3643
4532
|
}
|
|
3644
4533
|
) : null,
|
|
3645
|
-
loadFailure === null ? null : /* @__PURE__ */ jsx3("text", { height: 1, fg: INK_2, bg: "transparent", children: ` ${loadFailure} \
|
|
4534
|
+
loadFailure === null ? null : /* @__PURE__ */ jsx3("text", { height: 1, fg: INK_2, bg: "transparent", children: ` ${loadFailure} \xB7 retrying` })
|
|
3646
4535
|
]
|
|
3647
4536
|
}
|
|
3648
4537
|
)
|
|
@@ -3651,14 +4540,15 @@ ${tunneled}
|
|
|
3651
4540
|
);
|
|
3652
4541
|
}
|
|
3653
4542
|
};
|
|
3654
|
-
const renderDetail = () => /* @__PURE__ */ jsx3(Pane, { title: paneTitle("detail", detailWidth + 2), focused: focus === "detail", grow: true, children: selectedItem === null ? /* @__PURE__ */ jsx3(EmptyNote, { text: "no session selected \
|
|
4543
|
+
const renderDetail = () => /* @__PURE__ */ jsx3(Pane, { title: paneTitle("detail", detailWidth + 2), focused: focus === "detail", grow: true, children: selectedItem === null ? /* @__PURE__ */ jsx3(EmptyNote, { text: "no session selected \xB7 n starts one" }) : /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
3655
4544
|
/* @__PURE__ */ jsx3(
|
|
3656
4545
|
SessionFacts,
|
|
3657
4546
|
{
|
|
3658
4547
|
group: selectedGroup,
|
|
3659
4548
|
item: selectedItem,
|
|
3660
4549
|
rows: factRows,
|
|
3661
|
-
tunnels: openTunnels
|
|
4550
|
+
tunnels: openTunnels,
|
|
4551
|
+
workspaceRows
|
|
3662
4552
|
}
|
|
3663
4553
|
),
|
|
3664
4554
|
showFactRule ? /* @__PURE__ */ jsx3("text", { height: 1, bg: "transparent", fg: FAINT, children: ` ${"\u2500".repeat(Math.max(4, detailWidth - 4))}` }) : null,
|
|
@@ -3666,10 +4556,16 @@ ${tunneled}
|
|
|
3666
4556
|
/* @__PURE__ */ jsxs3("text", { height: 1, bg: "transparent", children: [
|
|
3667
4557
|
/* @__PURE__ */ jsx3("span", { children: " " }),
|
|
3668
4558
|
/* @__PURE__ */ jsx3("span", { fg: INK_2, children: "starting" }),
|
|
3669
|
-
/* @__PURE__ */ jsx3("span", { fg: FAINT, children:
|
|
4559
|
+
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: ` \xB7 ${selectedSession === null ? "launching" : startingExplanationOf(selectedSession)}` })
|
|
3670
4560
|
] }),
|
|
3671
|
-
snakeShown ? /* @__PURE__ */ jsx3(
|
|
3672
|
-
|
|
4561
|
+
snakeShown ? /* @__PURE__ */ jsx3(
|
|
4562
|
+
SnakeBoard,
|
|
4563
|
+
{
|
|
4564
|
+
handle: snake,
|
|
4565
|
+
idle: snakeFocus !== null && dialogOpen ? SNAKE_BEHIND_DIALOG : SNAKE_IDLE
|
|
4566
|
+
}
|
|
4567
|
+
) : /* @__PURE__ */ jsx3(EmptyNote, { text: snakeTooSmall(snakeRoom.rows < SNAKE_MIN_BOARD_ROWS) })
|
|
4568
|
+
] }) : previewSessionId === null ? /* @__PURE__ */ jsx3(EmptyNote, { text: "provisioning \xB7 no record yet" }) : selectedSession?.harness === "shell" ? /* @__PURE__ */ jsx3(EmptyNote, { text: "shell \xB7 no conversation record; a attaches if live" }) : transcript.isPending ? /* @__PURE__ */ jsx3(EmptyNote, { text: "reading the record\u2026" }) : transcript.error === null ? previewView.lines.length === 0 ? /* @__PURE__ */ jsx3(EmptyNote, { text: "no conversation recorded yet" }) : previewView.lines.map((line, index) => /* @__PURE__ */ jsx3(PreviewRow, { line }, `${index}-${line.kind}`)) : /* @__PURE__ */ jsx3("text", { height: 1, fg: INK_2, bg: "transparent", children: ` could not read the record \xB7 ${errorText(transcript.error)}` }) })
|
|
3673
4569
|
] }) });
|
|
3674
4570
|
const offNav = layout.offscreen.filter(isNavSection);
|
|
3675
4571
|
const detailOffscreen = layout.offscreen.includes("detail");
|
|
@@ -3688,6 +4584,13 @@ ${tunneled}
|
|
|
3688
4584
|
liveTotal,
|
|
3689
4585
|
" live"
|
|
3690
4586
|
] }),
|
|
4587
|
+
stoppingTotal > 0 ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
4588
|
+
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: " \xB7 " }),
|
|
4589
|
+
/* @__PURE__ */ jsxs3("span", { fg: INK_2, children: [
|
|
4590
|
+
stoppingTotal,
|
|
4591
|
+
" stopping"
|
|
4592
|
+
] })
|
|
4593
|
+
] }) : null,
|
|
3691
4594
|
gate.count() > 0 ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
3692
4595
|
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: " \xB7 " }),
|
|
3693
4596
|
/* @__PURE__ */ jsxs3("span", { fg: INK_2, children: [
|
|
@@ -3700,7 +4603,7 @@ ${tunneled}
|
|
|
3700
4603
|
/* @__PURE__ */ jsx3("span", { fg: shareState === "connected" ? MUTED : FAINT, children: shareState === "connected" ? "agent shared" : "agent share reconnecting" })
|
|
3701
4604
|
] })
|
|
3702
4605
|
] }),
|
|
3703
|
-
/* @__PURE__ */ jsx3("text", { height: 1, fg: FAINT, bg: "transparent", children: `${ctx.config.url} ` })
|
|
4606
|
+
/* @__PURE__ */ jsx3("text", { height: 1, fg: FAINT, bg: "transparent", children: `${screenMode === "normal" ? "" : `${screenMode} screen \xB7 `}${ctx.config.url} ` })
|
|
3704
4607
|
] }),
|
|
3705
4608
|
!layout.breadcrumb ? null : /* @__PURE__ */ jsxs3("text", { height: 1, bg: "transparent", children: [
|
|
3706
4609
|
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: " " }),
|
|
@@ -3724,37 +4627,63 @@ ${tunneled}
|
|
|
3724
4627
|
),
|
|
3725
4628
|
detailWidth === 0 ? null : renderDetail()
|
|
3726
4629
|
] }),
|
|
3727
|
-
snakeOverlay ? /* @__PURE__ */
|
|
4630
|
+
snakeOverlay && !overlayFits ? /* @__PURE__ */ jsx3(
|
|
3728
4631
|
"box",
|
|
3729
4632
|
{
|
|
3730
4633
|
position: "absolute",
|
|
3731
|
-
zIndex:
|
|
3732
|
-
left:
|
|
3733
|
-
top: Math.max(1, Math.floor((terminalRows -
|
|
3734
|
-
width:
|
|
3735
|
-
height:
|
|
4634
|
+
zIndex: 9,
|
|
4635
|
+
left: 1,
|
|
4636
|
+
top: Math.max(1, Math.floor((terminalRows - 3) / 2)),
|
|
4637
|
+
width: Math.max(4, terminalCols - 2),
|
|
4638
|
+
height: 3,
|
|
3736
4639
|
border: true,
|
|
3737
4640
|
borderStyle: "rounded",
|
|
3738
|
-
borderColor:
|
|
3739
|
-
title: " snake ",
|
|
3740
|
-
titleAlignment: "left",
|
|
4641
|
+
borderColor: RULE,
|
|
3741
4642
|
backgroundColor: SURFACE,
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
]
|
|
4643
|
+
children: /* @__PURE__ */ jsx3("text", { height: 1, bg: "transparent", fg: FAINT, children: fit(
|
|
4644
|
+
` ${snakeTooSmall(terminalRows < 12)} \xB7 esc closes`,
|
|
4645
|
+
Math.max(1, terminalCols - 4)
|
|
4646
|
+
) })
|
|
3747
4647
|
}
|
|
3748
4648
|
) : null,
|
|
3749
|
-
|
|
4649
|
+
snakeOverlay && overlayFits ? (
|
|
4650
|
+
// Under every dialog: one that opens over the game has the keyboard until it closes.
|
|
4651
|
+
/* @__PURE__ */ jsxs3(
|
|
4652
|
+
"box",
|
|
4653
|
+
{
|
|
4654
|
+
position: "absolute",
|
|
4655
|
+
zIndex: 9,
|
|
4656
|
+
left: Math.max(1, Math.floor((terminalCols - (overlayWidth + 4)) / 2)),
|
|
4657
|
+
top: Math.max(1, Math.floor((terminalRows - (overlayHeight + 4)) / 2)),
|
|
4658
|
+
width: overlayWidth + 4,
|
|
4659
|
+
height: overlayHeight + 4,
|
|
4660
|
+
border: true,
|
|
4661
|
+
borderStyle: "rounded",
|
|
4662
|
+
borderColor: overlayFocused ? ACCENT : RULE,
|
|
4663
|
+
title: " snake ",
|
|
4664
|
+
titleAlignment: "left",
|
|
4665
|
+
backgroundColor: SURFACE,
|
|
4666
|
+
flexDirection: "column",
|
|
4667
|
+
children: [
|
|
4668
|
+
/* @__PURE__ */ jsx3(SnakeHeading, { play: overlaySnake.play }),
|
|
4669
|
+
/* @__PURE__ */ jsx3("box", { marginLeft: 1, flexDirection: "column", flexShrink: 0, children: /* @__PURE__ */ jsx3(SnakeRows, { play: overlaySnake.play }) }),
|
|
4670
|
+
/* @__PURE__ */ jsx3(SnakeFooter, { play: overlaySnake.play, idle: SNAKE_BEHIND_DIALOG })
|
|
4671
|
+
]
|
|
4672
|
+
}
|
|
4673
|
+
)
|
|
4674
|
+
) : null,
|
|
4675
|
+
picker === null ? null : /* @__PURE__ */ jsxs3(
|
|
3750
4676
|
"box",
|
|
3751
4677
|
{
|
|
3752
4678
|
position: "absolute",
|
|
3753
4679
|
zIndex: 12,
|
|
3754
4680
|
left: Math.max(1, Math.floor((terminalCols - Math.min(74, terminalCols - 4)) / 2)),
|
|
3755
|
-
top: Math.max(
|
|
4681
|
+
top: Math.max(
|
|
4682
|
+
1,
|
|
4683
|
+
Math.floor((terminalRows - (2 + pickerItems.length + pickerJoinHeight)) / 2)
|
|
4684
|
+
),
|
|
3756
4685
|
width: Math.min(74, terminalCols - 4),
|
|
3757
|
-
height: 2 + pickerItems.length,
|
|
4686
|
+
height: 2 + pickerItems.length + pickerJoinHeight,
|
|
3758
4687
|
border: true,
|
|
3759
4688
|
borderStyle: "rounded",
|
|
3760
4689
|
borderColor: ACCENT,
|
|
@@ -3762,15 +4691,20 @@ ${tunneled}
|
|
|
3762
4691
|
titleAlignment: "left",
|
|
3763
4692
|
backgroundColor: SURFACE,
|
|
3764
4693
|
flexDirection: "column",
|
|
3765
|
-
children:
|
|
3766
|
-
|
|
3767
|
-
{
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
4694
|
+
children: [
|
|
4695
|
+
pickerJoinRows.map((row, index) => /* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, fg: INK_2, children: ` ${row}` }, `join-${index}`)),
|
|
4696
|
+
pickerJoinRows.length === 0 ? null : /* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, children: " " }),
|
|
4697
|
+
pickerItems.map((item, index) => /* @__PURE__ */ jsx3(
|
|
4698
|
+
HarnessRow,
|
|
4699
|
+
{
|
|
4700
|
+
item,
|
|
4701
|
+
selected: index === pickerIndex,
|
|
4702
|
+
background: SURFACE,
|
|
4703
|
+
width: modalWidth - 2
|
|
4704
|
+
},
|
|
4705
|
+
String(item.harness)
|
|
4706
|
+
))
|
|
4707
|
+
]
|
|
3774
4708
|
}
|
|
3775
4709
|
),
|
|
3776
4710
|
editing === null ? null : /* @__PURE__ */ jsx3(
|
|
@@ -3784,7 +4718,7 @@ ${tunneled}
|
|
|
3784
4718
|
border: true,
|
|
3785
4719
|
borderStyle: "rounded",
|
|
3786
4720
|
borderColor: ACCENT,
|
|
3787
|
-
title: ` label \
|
|
4721
|
+
title: ` label \xB7 ${editing.harness} ${editing.id.slice(0, 8)} `,
|
|
3788
4722
|
titleAlignment: "left",
|
|
3789
4723
|
backgroundColor: SURFACE,
|
|
3790
4724
|
height: 3,
|
|
@@ -3815,9 +4749,9 @@ ${tunneled}
|
|
|
3815
4749
|
position: "absolute",
|
|
3816
4750
|
zIndex: 11,
|
|
3817
4751
|
left: Math.max(1, Math.floor((terminalCols - Math.min(70, terminalCols - 4)) / 2)),
|
|
3818
|
-
top: Math.max(1, Math.floor((terminalRows - 7) / 2)),
|
|
4752
|
+
top: Math.max(1, Math.floor((terminalRows - 7 - adoptFailureLines.length) / 2)),
|
|
3819
4753
|
width: Math.min(70, terminalCols - 4),
|
|
3820
|
-
height: 7,
|
|
4754
|
+
height: 7 + adoptFailureLines.length,
|
|
3821
4755
|
border: true,
|
|
3822
4756
|
borderStyle: "rounded",
|
|
3823
4757
|
borderColor: ACCENT,
|
|
@@ -3840,7 +4774,8 @@ ${tunneled}
|
|
|
3840
4774
|
] }, candidate.mode))
|
|
3841
4775
|
] }),
|
|
3842
4776
|
/* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, fg: FAINT, children: ` ${ADOPT_AUTH_MODES[adoptOffer.modeIndex]?.hint ?? ""}` }),
|
|
3843
|
-
/* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, fg:
|
|
4777
|
+
adoptFailureLines.map((line, index) => /* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, fg: ERROR, children: ` ${line}` }, `failure-${index}`)),
|
|
4778
|
+
/* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, fg: FAINT, children: adoptOffer.failure === void 0 ? " enter adopt \xB7 \u2190\u2192 auth mode \xB7 esc not now" : " enter try again \xB7 \u2190\u2192 auth mode \xB7 esc not now" })
|
|
3844
4779
|
]
|
|
3845
4780
|
}
|
|
3846
4781
|
),
|
|
@@ -3856,7 +4791,7 @@ ${tunneled}
|
|
|
3856
4791
|
border: true,
|
|
3857
4792
|
borderStyle: "rounded",
|
|
3858
4793
|
borderColor: ACCENT,
|
|
3859
|
-
title: ` new worktree \
|
|
4794
|
+
title: ` new worktree \xB7 ${selectedProject?.project.name ?? "project"} `,
|
|
3860
4795
|
titleAlignment: "left",
|
|
3861
4796
|
backgroundColor: SURFACE,
|
|
3862
4797
|
flexDirection: "column",
|
|
@@ -3873,7 +4808,10 @@ ${tunneled}
|
|
|
3873
4808
|
{
|
|
3874
4809
|
focused: true,
|
|
3875
4810
|
value: creating.name,
|
|
3876
|
-
placeholder:
|
|
4811
|
+
placeholder: fit(
|
|
4812
|
+
"e.g. fix-auth (empty = auto \xB7 an existing name joins it)",
|
|
4813
|
+
modalFieldWidth
|
|
4814
|
+
),
|
|
3877
4815
|
backgroundColor: SURFACE,
|
|
3878
4816
|
focusedBackgroundColor: SURFACE,
|
|
3879
4817
|
textColor: INK,
|
|
@@ -3904,7 +4842,10 @@ ${tunneled}
|
|
|
3904
4842
|
{
|
|
3905
4843
|
focused: true,
|
|
3906
4844
|
value: "",
|
|
3907
|
-
placeholder:
|
|
4845
|
+
placeholder: fit(
|
|
4846
|
+
"filter \xB7 enter takes the highlighted branch, or the default",
|
|
4847
|
+
modalFieldWidth
|
|
4848
|
+
),
|
|
3908
4849
|
backgroundColor: SURFACE,
|
|
3909
4850
|
focusedBackgroundColor: SURFACE,
|
|
3910
4851
|
textColor: INK,
|
|
@@ -3926,6 +4867,10 @@ ${tunneled}
|
|
|
3926
4867
|
const branch = creating.joins || creating.branches === null ? void 0 : filterBranches(creating.branches, creating.query)[index];
|
|
3927
4868
|
const active = creating.step === "base";
|
|
3928
4869
|
if (branch === void 0) {
|
|
4870
|
+
const joinRow = creatingJoinRows[index];
|
|
4871
|
+
if (joinRow !== void 0) {
|
|
4872
|
+
return /* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, fg: INK_2, children: ` ${joinRow}` }, `slot-${index}`);
|
|
4873
|
+
}
|
|
3929
4874
|
const notice = creating.joins ? null : baseStepNotice(creating);
|
|
3930
4875
|
return /* @__PURE__ */ jsx3(
|
|
3931
4876
|
"text",
|
|
@@ -3933,7 +4878,7 @@ ${tunneled}
|
|
|
3933
4878
|
height: 1,
|
|
3934
4879
|
bg: SURFACE,
|
|
3935
4880
|
fg: creating.branchError === null ? FAINT : ERROR,
|
|
3936
|
-
children: index === 0 && notice !== null ? ` ${fit(notice,
|
|
4881
|
+
children: index === 0 && notice !== null ? ` ${fit(notice, modalWidth - 7)}` : " "
|
|
3937
4882
|
},
|
|
3938
4883
|
`slot-${index}`
|
|
3939
4884
|
);
|
|
@@ -3950,7 +4895,7 @@ ${tunneled}
|
|
|
3950
4895
|
/* @__PURE__ */ jsx3(Gutter, { selected: highlighted }),
|
|
3951
4896
|
/* @__PURE__ */ jsx3("span", { fg: active ? INK : FAINT, children: branch.name.slice(0, 40).padEnd(41) }),
|
|
3952
4897
|
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: branch.sha.slice(0, 8).padEnd(10) }),
|
|
3953
|
-
/* @__PURE__ */ jsx3("span", { fg: active ? MUTED : FAINT, children:
|
|
4898
|
+
/* @__PURE__ */ jsx3("span", { fg: active ? MUTED : FAINT, children: timeAgo(branch.committedAt).padEnd(9) }),
|
|
3954
4899
|
branch.isDefault ? /* @__PURE__ */ jsx3("span", { fg: FAINT, children: "default" }) : null
|
|
3955
4900
|
] })
|
|
3956
4901
|
},
|
|
@@ -3961,7 +4906,7 @@ ${tunneled}
|
|
|
3961
4906
|
/* @__PURE__ */ jsx3(Gutter, { selected: creating.step === "harness" }),
|
|
3962
4907
|
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: "harness" })
|
|
3963
4908
|
] }),
|
|
3964
|
-
deriveHarnesses(null).map((item, index) => {
|
|
4909
|
+
deriveHarnesses(null, creating.joins ? creating.name : null).map((item, index) => {
|
|
3965
4910
|
const active = creating.step === "harness";
|
|
3966
4911
|
const highlighted = active && index === creating.harnessIndex;
|
|
3967
4912
|
return /* @__PURE__ */ jsx3(
|
|
@@ -3974,7 +4919,7 @@ ${tunneled}
|
|
|
3974
4919
|
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: " " }),
|
|
3975
4920
|
/* @__PURE__ */ jsx3(Gutter, { selected: highlighted }),
|
|
3976
4921
|
/* @__PURE__ */ jsx3("span", { fg: active ? INK : FAINT, children: item.label.padEnd(12) }),
|
|
3977
|
-
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: active ? item.hint : "" })
|
|
4922
|
+
/* @__PURE__ */ jsx3("span", { fg: FAINT, children: active ? fit(item.hint, Math.max(4, modalWidth - 2 - 3 - 2 - 12)) : "" })
|
|
3978
4923
|
] })
|
|
3979
4924
|
},
|
|
3980
4925
|
String(item.harness)
|
|
@@ -3983,8 +4928,58 @@ ${tunneled}
|
|
|
3983
4928
|
]
|
|
3984
4929
|
}
|
|
3985
4930
|
),
|
|
3986
|
-
loadFailure === null ? /* @__PURE__ */ jsx3(StatusLine, { busy, busyStarted, status }) : /* @__PURE__ */ jsx3("text", { height: 1, fg: ERROR, bg: "transparent", children: ` could not load workbench \
|
|
3987
|
-
/* @__PURE__ */
|
|
4931
|
+
loadFailure === null ? /* @__PURE__ */ jsx3(StatusLine, { busy, busyStarted, status }) : /* @__PURE__ */ jsx3("text", { height: 1, fg: ERROR, bg: "transparent", children: ` could not load workbench \xB7 ${loadFailure} \xB7 retrying` }),
|
|
4932
|
+
helpOpen ? /* @__PURE__ */ jsxs3(
|
|
4933
|
+
"box",
|
|
4934
|
+
{
|
|
4935
|
+
position: "absolute",
|
|
4936
|
+
zIndex: 14,
|
|
4937
|
+
left: Math.max(1, Math.floor((terminalCols - helpWidth) / 2)),
|
|
4938
|
+
top: Math.max(1, Math.floor((terminalRows - (helpRows + 3)) / 2)),
|
|
4939
|
+
width: helpWidth,
|
|
4940
|
+
height: helpRows + 3,
|
|
4941
|
+
border: true,
|
|
4942
|
+
borderStyle: "rounded",
|
|
4943
|
+
borderColor: ACCENT,
|
|
4944
|
+
title: ` keys \xB7 ${fit(columnTitle(focus), Math.max(6, helpWidth - 14))} `,
|
|
4945
|
+
titleAlignment: "left",
|
|
4946
|
+
backgroundColor: SURFACE,
|
|
4947
|
+
flexDirection: "column",
|
|
4948
|
+
children: [
|
|
4949
|
+
helpView.map(
|
|
4950
|
+
(line) => line.kind === "blank" ? /* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, children: " " }, line.key) : line.kind === "title" ? /* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, fg: MUTED, children: ` ${line.text}` }, line.key) : /* @__PURE__ */ jsxs3("text", { height: 1, bg: SURFACE, children: [
|
|
4951
|
+
/* @__PURE__ */ jsx3("span", { fg: INK, children: ` ${fit(line.row.keys, 18).padEnd(19)}` }),
|
|
4952
|
+
/* @__PURE__ */ jsx3("span", { fg: line.row.here ? INK_2 : FAINT, children: fit(line.row.help, Math.max(8, helpWidth - 25)) })
|
|
4953
|
+
] }, line.key)
|
|
4954
|
+
),
|
|
4955
|
+
/* @__PURE__ */ jsx3("text", { height: 1, bg: SURFACE, fg: FAINT, children: ` ${helpMaxOffset > 0 ? "\u2191\u2193 scroll \xB7 " : ""}esc closes` })
|
|
4956
|
+
]
|
|
4957
|
+
}
|
|
4958
|
+
) : null,
|
|
4959
|
+
filtering === null ? /* @__PURE__ */ jsx3("text", { height: 1, fg: FAINT, bg: "transparent", children: footerText }) : /* @__PURE__ */ jsxs3("box", { height: 1, flexShrink: 0, flexDirection: "row", children: [
|
|
4960
|
+
/* @__PURE__ */ jsx3("text", { height: 1, bg: "transparent", fg: ACCENT, children: " / " }),
|
|
4961
|
+
/* @__PURE__ */ jsx3(
|
|
4962
|
+
"input",
|
|
4963
|
+
{
|
|
4964
|
+
focused: true,
|
|
4965
|
+
value: filters[filtering],
|
|
4966
|
+
placeholder: `filter ${columnTitle(filtering)} \xB7 enter keeps it \xB7 esc clears it`,
|
|
4967
|
+
backgroundColor: CANVAS,
|
|
4968
|
+
focusedBackgroundColor: CANVAS,
|
|
4969
|
+
textColor: INK,
|
|
4970
|
+
focusedTextColor: INK,
|
|
4971
|
+
placeholderColor: FAINT,
|
|
4972
|
+
cursorColor: INK,
|
|
4973
|
+
flexGrow: 1,
|
|
4974
|
+
onInput: (value) => {
|
|
4975
|
+
const section = filtering;
|
|
4976
|
+
const clean = value.replace(/\t/g, "");
|
|
4977
|
+
setFilters((current) => ({ ...current, [section]: clean }));
|
|
4978
|
+
},
|
|
4979
|
+
onSubmit: () => setFiltering(null)
|
|
4980
|
+
}
|
|
4981
|
+
)
|
|
4982
|
+
] })
|
|
3988
4983
|
] });
|
|
3989
4984
|
};
|
|
3990
4985
|
var runDashboard = async (ctx) => {
|
|
@@ -4055,5 +5050,7 @@ var runDashboard = async (ctx) => {
|
|
|
4055
5050
|
});
|
|
4056
5051
|
};
|
|
4057
5052
|
export {
|
|
5053
|
+
App,
|
|
5054
|
+
HANDOVER_MS,
|
|
4058
5055
|
runDashboard
|
|
4059
5056
|
};
|