@gigaflow/gmux 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +654 -0
- package/LICENSE +21 -0
- package/README.md +351 -0
- package/dist/adapters/claude-code.d.ts +52 -0
- package/dist/adapters/claude-code.js +315 -0
- package/dist/adapters/claude-code.js.map +1 -0
- package/dist/adapters/codex.d.ts +39 -0
- package/dist/adapters/codex.js +233 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/adapters/jsonl.d.ts +40 -0
- package/dist/adapters/jsonl.js +92 -0
- package/dist/adapters/jsonl.js.map +1 -0
- package/dist/adapters/registry.d.ts +11 -0
- package/dist/adapters/registry.js +21 -0
- package/dist/adapters/registry.js.map +1 -0
- package/dist/adapters/types.d.ts +43 -0
- package/dist/adapters/types.js +2 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/cli/border-client.d.ts +8 -0
- package/dist/cli/border-client.js +11 -0
- package/dist/cli/border-client.js.map +1 -0
- package/dist/cli/commands/__ask-cancel.d.ts +35 -0
- package/dist/cli/commands/__ask-cancel.js +91 -0
- package/dist/cli/commands/__ask-cancel.js.map +1 -0
- package/dist/cli/commands/__ask-refresh.d.ts +40 -0
- package/dist/cli/commands/__ask-refresh.js +54 -0
- package/dist/cli/commands/__ask-refresh.js.map +1 -0
- package/dist/cli/commands/__ask-run.d.ts +43 -0
- package/dist/cli/commands/__ask-run.js +126 -0
- package/dist/cli/commands/__ask-run.js.map +1 -0
- package/dist/cli/commands/__ask-send.d.ts +50 -0
- package/dist/cli/commands/__ask-send.js +138 -0
- package/dist/cli/commands/__ask-send.js.map +1 -0
- package/dist/cli/commands/__preview-card.d.ts +31 -0
- package/dist/cli/commands/__preview-card.js +72 -0
- package/dist/cli/commands/__preview-card.js.map +1 -0
- package/dist/cli/commands/ask.d.ts +50 -0
- package/dist/cli/commands/ask.js +240 -0
- package/dist/cli/commands/ask.js.map +1 -0
- package/dist/cli/commands/auto.d.ts +12 -0
- package/dist/cli/commands/auto.js +28 -0
- package/dist/cli/commands/auto.js.map +1 -0
- package/dist/cli/commands/cockpit.d.ts +14 -0
- package/dist/cli/commands/cockpit.js +52 -0
- package/dist/cli/commands/cockpit.js.map +1 -0
- package/dist/cli/commands/daemon.d.ts +75 -0
- package/dist/cli/commands/daemon.js +258 -0
- package/dist/cli/commands/daemon.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +6 -0
- package/dist/cli/commands/doctor.js +159 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/grep.d.ts +2 -0
- package/dist/cli/commands/grep.js +52 -0
- package/dist/cli/commands/grep.js.map +1 -0
- package/dist/cli/commands/index-cmd.d.ts +2 -0
- package/dist/cli/commands/index-cmd.js +29 -0
- package/dist/cli/commands/index-cmd.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +30 -0
- package/dist/cli/commands/ls.js +95 -0
- package/dist/cli/commands/ls.js.map +1 -0
- package/dist/cli/commands/overlay.d.ts +26 -0
- package/dist/cli/commands/overlay.js +216 -0
- package/dist/cli/commands/overlay.js.map +1 -0
- package/dist/cli/commands/pick.d.ts +59 -0
- package/dist/cli/commands/pick.js +254 -0
- package/dist/cli/commands/pick.js.map +1 -0
- package/dist/cli/commands/picker-rows.d.ts +17 -0
- package/dist/cli/commands/picker-rows.js +47 -0
- package/dist/cli/commands/picker-rows.js.map +1 -0
- package/dist/cli/commands/resume.d.ts +25 -0
- package/dist/cli/commands/resume.js +88 -0
- package/dist/cli/commands/resume.js.map +1 -0
- package/dist/cli/commands/run.d.ts +13 -0
- package/dist/cli/commands/run.js +78 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +37 -0
- package/dist/cli/commands/setup.js +200 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/show.d.ts +2 -0
- package/dist/cli/commands/show.js +24 -0
- package/dist/cli/commands/show.js.map +1 -0
- package/dist/cli/commands/summarize.d.ts +2 -0
- package/dist/cli/commands/summarize.js +59 -0
- package/dist/cli/commands/summarize.js.map +1 -0
- package/dist/cli/commands/tmux.d.ts +11 -0
- package/dist/cli/commands/tmux.js +90 -0
- package/dist/cli/commands/tmux.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +2 -0
- package/dist/cli/commands/watch.js +76 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/format.d.ts +74 -0
- package/dist/cli/format.js +242 -0
- package/dist/cli/format.js.map +1 -0
- package/dist/cli/gmux-render.d.ts +11 -0
- package/dist/cli/gmux-render.js +60 -0
- package/dist/cli/gmux-render.js.map +1 -0
- package/dist/cli/main.d.ts +8 -0
- package/dist/cli/main.js +145 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/overlay-ask.d.ts +13 -0
- package/dist/cli/overlay-ask.js +32 -0
- package/dist/cli/overlay-ask.js.map +1 -0
- package/dist/cli/overlay.d.ts +26 -0
- package/dist/cli/overlay.js +149 -0
- package/dist/cli/overlay.js.map +1 -0
- package/dist/cli/picker.d.ts +308 -0
- package/dist/cli/picker.js +642 -0
- package/dist/cli/picker.js.map +1 -0
- package/dist/cli/preview.d.ts +87 -0
- package/dist/cli/preview.js +292 -0
- package/dist/cli/preview.js.map +1 -0
- package/dist/cli/tmux-label.d.ts +50 -0
- package/dist/cli/tmux-label.js +146 -0
- package/dist/cli/tmux-label.js.map +1 -0
- package/dist/core/errors.d.ts +54 -0
- package/dist/core/errors.js +91 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/fingerprint.d.ts +21 -0
- package/dist/core/fingerprint.js +59 -0
- package/dist/core/fingerprint.js.map +1 -0
- package/dist/core/gmux-types.d.ts +102 -0
- package/dist/core/gmux-types.js +13 -0
- package/dist/core/gmux-types.js.map +1 -0
- package/dist/core/pane-state.d.ts +5 -0
- package/dist/core/pane-state.js +15 -0
- package/dist/core/pane-state.js.map +1 -0
- package/dist/core/paths.d.ts +68 -0
- package/dist/core/paths.js +106 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/proc-tree.d.ts +9 -0
- package/dist/core/proc-tree.js +33 -0
- package/dist/core/proc-tree.js.map +1 -0
- package/dist/core/text.d.ts +34 -0
- package/dist/core/text.js +126 -0
- package/dist/core/text.js.map +1 -0
- package/dist/core/types.d.ts +322 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +1 -0
- package/dist/services/ask-transcript.d.ts +256 -0
- package/dist/services/ask-transcript.js +544 -0
- package/dist/services/ask-transcript.js.map +1 -0
- package/dist/services/ask.d.ts +54 -0
- package/dist/services/ask.js +161 -0
- package/dist/services/ask.js.map +1 -0
- package/dist/services/auto-summarize.d.ts +188 -0
- package/dist/services/auto-summarize.js +415 -0
- package/dist/services/auto-summarize.js.map +1 -0
- package/dist/services/concurrency.d.ts +2 -0
- package/dist/services/concurrency.js +16 -0
- package/dist/services/concurrency.js.map +1 -0
- package/dist/services/config.d.ts +131 -0
- package/dist/services/config.js +325 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/daemon-client.d.ts +9 -0
- package/dist/services/daemon-client.js +34 -0
- package/dist/services/daemon-client.js.map +1 -0
- package/dist/services/daemon-socket.d.ts +30 -0
- package/dist/services/daemon-socket.js +76 -0
- package/dist/services/daemon-socket.js.map +1 -0
- package/dist/services/daemon.d.ts +43 -0
- package/dist/services/daemon.js +106 -0
- package/dist/services/daemon.js.map +1 -0
- package/dist/services/distill.d.ts +39 -0
- package/dist/services/distill.js +93 -0
- package/dist/services/distill.js.map +1 -0
- package/dist/services/guardian.d.ts +26 -0
- package/dist/services/guardian.js +71 -0
- package/dist/services/guardian.js.map +1 -0
- package/dist/services/index-store.d.ts +36 -0
- package/dist/services/index-store.js +125 -0
- package/dist/services/index-store.js.map +1 -0
- package/dist/services/log-rotation.d.ts +3 -0
- package/dist/services/log-rotation.js +28 -0
- package/dist/services/log-rotation.js.map +1 -0
- package/dist/services/pane-links.d.ts +10 -0
- package/dist/services/pane-links.js +47 -0
- package/dist/services/pane-links.js.map +1 -0
- package/dist/services/pane-process.d.ts +95 -0
- package/dist/services/pane-process.js +183 -0
- package/dist/services/pane-process.js.map +1 -0
- package/dist/services/pane-registry.d.ts +24 -0
- package/dist/services/pane-registry.js +40 -0
- package/dist/services/pane-registry.js.map +1 -0
- package/dist/services/provider-process.d.ts +37 -0
- package/dist/services/provider-process.js +105 -0
- package/dist/services/provider-process.js.map +1 -0
- package/dist/services/providers.d.ts +76 -0
- package/dist/services/providers.js +104 -0
- package/dist/services/providers.js.map +1 -0
- package/dist/services/resolve.d.ts +3 -0
- package/dist/services/resolve.js +18 -0
- package/dist/services/resolve.js.map +1 -0
- package/dist/services/resources.d.ts +17 -0
- package/dist/services/resources.js +113 -0
- package/dist/services/resources.js.map +1 -0
- package/dist/services/search.d.ts +29 -0
- package/dist/services/search.js +135 -0
- package/dist/services/search.js.map +1 -0
- package/dist/services/semantic-gate.d.ts +13 -0
- package/dist/services/semantic-gate.js +23 -0
- package/dist/services/semantic-gate.js.map +1 -0
- package/dist/services/semantic.d.ts +113 -0
- package/dist/services/semantic.js +216 -0
- package/dist/services/semantic.js.map +1 -0
- package/dist/services/sensors.d.ts +92 -0
- package/dist/services/sensors.js +246 -0
- package/dist/services/sensors.js.map +1 -0
- package/dist/services/summarize.d.ts +84 -0
- package/dist/services/summarize.js +230 -0
- package/dist/services/summarize.js.map +1 -0
- package/dist/services/tmux-gateway.d.ts +17 -0
- package/dist/services/tmux-gateway.js +10 -0
- package/dist/services/tmux-gateway.js.map +1 -0
- package/dist/services/tmux-resolve.d.ts +54 -0
- package/dist/services/tmux-resolve.js +0 -0
- package/dist/services/tmux-resolve.js.map +1 -0
- package/dist/services/tmux.d.ts +32 -0
- package/dist/services/tmux.js +107 -0
- package/dist/services/tmux.js.map +1 -0
- package/dist/services/views.d.ts +7 -0
- package/dist/services/views.js +18 -0
- package/dist/services/views.js.map +1 -0
- package/dist/services/watch.d.ts +36 -0
- package/dist/services/watch.js +98 -0
- package/dist/services/watch.js.map +1 -0
- package/dist/services/workspace.d.ts +19 -0
- package/dist/services/workspace.js +88 -0
- package/dist/services/workspace.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/** Small pure string/time helpers. No I/O, no internal imports. */
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
/** Collapse whitespace and clip to `max`, appending an ellipsis when clipped. */
|
|
4
|
+
export function truncate(input, max) {
|
|
5
|
+
const flat = input.replace(/\s+/g, " ").trim();
|
|
6
|
+
if (flat.length <= max)
|
|
7
|
+
return flat;
|
|
8
|
+
return `${flat.slice(0, Math.max(0, max - 1))}…`;
|
|
9
|
+
}
|
|
10
|
+
/** Stable content hash used as a cache key. */
|
|
11
|
+
export function hash(input) {
|
|
12
|
+
return createHash("sha256").update(input).digest("hex").slice(0, 16);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compact relative age, e.g. "2h", "3d". Deliberately terse: it is a column in
|
|
16
|
+
* a list, not prose.
|
|
17
|
+
*/
|
|
18
|
+
export function relativeAge(iso, now = new Date()) {
|
|
19
|
+
const then = new Date(iso).getTime();
|
|
20
|
+
if (Number.isNaN(then))
|
|
21
|
+
return "?";
|
|
22
|
+
const seconds = Math.max(0, Math.floor((now.getTime() - then) / 1000));
|
|
23
|
+
if (seconds < 60)
|
|
24
|
+
return `${seconds}s`;
|
|
25
|
+
const minutes = Math.floor(seconds / 60);
|
|
26
|
+
if (minutes < 60)
|
|
27
|
+
return `${minutes}m`;
|
|
28
|
+
const hours = Math.floor(minutes / 60);
|
|
29
|
+
if (hours < 24)
|
|
30
|
+
return `${hours}h`;
|
|
31
|
+
const days = Math.floor(hours / 24);
|
|
32
|
+
if (days < 30)
|
|
33
|
+
return `${days}d`;
|
|
34
|
+
const months = Math.floor(days / 30);
|
|
35
|
+
if (months < 12)
|
|
36
|
+
return `${months}mo`;
|
|
37
|
+
return `${Math.floor(months / 12)}y`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parse a duration like "3d", "2w", "24h" into an ISO cutoff timestamp.
|
|
41
|
+
* Returns null for unparseable input.
|
|
42
|
+
*/
|
|
43
|
+
export function parseSince(input, now = new Date()) {
|
|
44
|
+
const match = /^(\d+)\s*([smhdw])$/i.exec(input.trim());
|
|
45
|
+
if (!match) {
|
|
46
|
+
const asDate = new Date(input);
|
|
47
|
+
return Number.isNaN(asDate.getTime()) ? null : asDate.toISOString();
|
|
48
|
+
}
|
|
49
|
+
const amount = Number(match[1]);
|
|
50
|
+
const unitMs = {
|
|
51
|
+
s: 1000,
|
|
52
|
+
m: 60_000,
|
|
53
|
+
h: 3_600_000,
|
|
54
|
+
d: 86_400_000,
|
|
55
|
+
w: 604_800_000,
|
|
56
|
+
};
|
|
57
|
+
const ms = unitMs[match[2].toLowerCase()];
|
|
58
|
+
return new Date(now.getTime() - amount * ms).toISOString();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Greedy word wrap. Returns at least one line, even for empty input, so callers
|
|
62
|
+
* can always render a row.
|
|
63
|
+
*
|
|
64
|
+
* A word longer than the width (a URL, a long path) is hard-split rather than
|
|
65
|
+
* allowed to overflow — overflowing is the bug this exists to fix.
|
|
66
|
+
*/
|
|
67
|
+
export function wrapText(input, width) {
|
|
68
|
+
const text = input.replace(/\s+/g, " ").trim();
|
|
69
|
+
if (text === "")
|
|
70
|
+
return [""];
|
|
71
|
+
if (!Number.isFinite(width) || width <= 0)
|
|
72
|
+
return [text];
|
|
73
|
+
const lines = [];
|
|
74
|
+
let line = "";
|
|
75
|
+
for (const word of text.split(" ")) {
|
|
76
|
+
if (line === "" && word.length > width) {
|
|
77
|
+
// Hard-split an oversized word across as many lines as it needs.
|
|
78
|
+
let rest = word;
|
|
79
|
+
while (rest.length > width) {
|
|
80
|
+
lines.push(rest.slice(0, width));
|
|
81
|
+
rest = rest.slice(width);
|
|
82
|
+
}
|
|
83
|
+
line = rest;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const candidate = line === "" ? word : `${line} ${word}`;
|
|
87
|
+
if (candidate.length <= width) {
|
|
88
|
+
line = candidate;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
lines.push(line);
|
|
92
|
+
line = word.length > width ? "" : word;
|
|
93
|
+
if (word.length > width) {
|
|
94
|
+
let rest = word;
|
|
95
|
+
while (rest.length > width) {
|
|
96
|
+
lines.push(rest.slice(0, width));
|
|
97
|
+
rest = rest.slice(width);
|
|
98
|
+
}
|
|
99
|
+
line = rest;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (line !== "")
|
|
103
|
+
lines.push(line);
|
|
104
|
+
return lines.length > 0 ? lines : [""];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Single-quote for POSIX shells, escaping any embedded single quote.
|
|
108
|
+
*
|
|
109
|
+
* Lives in core because two callers need it: `gmux resume --print` emits a line
|
|
110
|
+
* meant to be pasted into a shell, and the picker's fzf reload binding is a
|
|
111
|
+
* shell command string. In both, an unquoted path with a space silently runs
|
|
112
|
+
* the wrong thing rather than failing loudly.
|
|
113
|
+
*/
|
|
114
|
+
export function shellQuote(value) {
|
|
115
|
+
return /^[A-Za-z0-9_./:@-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
116
|
+
}
|
|
117
|
+
/** Pad or clip a cell to an exact display width. */
|
|
118
|
+
export function cell(input, width) {
|
|
119
|
+
const flat = input.replace(/\s+/g, " ").trim();
|
|
120
|
+
if (flat.length === width)
|
|
121
|
+
return flat;
|
|
122
|
+
if (flat.length < width)
|
|
123
|
+
return flat.padEnd(width, " ");
|
|
124
|
+
return `${flat.slice(0, Math.max(0, width - 1))}…`;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/core/text.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAE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K;QAAE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACxD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared vocabulary of gmux. Every layer speaks these types.
|
|
3
|
+
*
|
|
4
|
+
* `core` imports nothing internal — see docs/architecture.md for the layer rule.
|
|
5
|
+
*/
|
|
6
|
+
/** Stable identifier for a harness, e.g. "claude-code" or "codex". */
|
|
7
|
+
export type HarnessId = string;
|
|
8
|
+
/** Schema version for every `--json` payload. Bump on breaking changes. */
|
|
9
|
+
export declare const SCHEMA_VERSION = 1;
|
|
10
|
+
/** A session file located on disk, before it has been parsed. */
|
|
11
|
+
export interface SessionRef {
|
|
12
|
+
harness: HarnessId;
|
|
13
|
+
sessionId: string;
|
|
14
|
+
filePath: string;
|
|
15
|
+
/** Modification time in ms. Half of the index cache key. */
|
|
16
|
+
mtimeMs: number;
|
|
17
|
+
/** Size in bytes. The other half of the cache key. */
|
|
18
|
+
size: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One tmux pane as gmux sees it: geometry plus enough to resolve it to a
|
|
22
|
+
* session. `command` is `pane_current_command` (the foreground process, e.g.
|
|
23
|
+
* "claude", "codex", "node", "zsh") — a weak signal, since a node-based harness
|
|
24
|
+
* often shows as "node"; the cwd carries most of the resolution.
|
|
25
|
+
*/
|
|
26
|
+
export interface TmuxPane {
|
|
27
|
+
paneId: string;
|
|
28
|
+
left: number;
|
|
29
|
+
top: number;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
cwd: string;
|
|
33
|
+
command: string;
|
|
34
|
+
/** The pane's shell pid — the root for resolving which agent runs in it. */
|
|
35
|
+
pid: number;
|
|
36
|
+
/** tmux window id (`@N`), or null on tmux builds that omit it. */
|
|
37
|
+
windowId: string | null;
|
|
38
|
+
/** True when this is the active pane in its window. */
|
|
39
|
+
active: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* An exact pane→session link recorded by `gmux run`. Ephemeral runtime state: a
|
|
43
|
+
* `paneId` means nothing once the tmux server dies, so this lives in the cache
|
|
44
|
+
* and is pruned to the live pane set on every read of the overlay.
|
|
45
|
+
*/
|
|
46
|
+
export interface PaneLink {
|
|
47
|
+
paneId: string;
|
|
48
|
+
harness: HarnessId;
|
|
49
|
+
sessionId: string;
|
|
50
|
+
}
|
|
51
|
+
/** A pull request a session produced. */
|
|
52
|
+
export interface PrLink {
|
|
53
|
+
number: number;
|
|
54
|
+
url: string;
|
|
55
|
+
repository?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Hard facts about one session, extracted by an adapter.
|
|
59
|
+
*
|
|
60
|
+
* Everything here is free: no model call, no network. `title` comes from the
|
|
61
|
+
* harness and describes where the session STARTED — prefer a SessionSummary
|
|
62
|
+
* when deciding what a session ended up being about.
|
|
63
|
+
*/
|
|
64
|
+
export interface SessionRecord {
|
|
65
|
+
harness: HarnessId;
|
|
66
|
+
sessionId: string;
|
|
67
|
+
filePath: string;
|
|
68
|
+
/** Working directory the session ran in. Needed to resume in the right place. */
|
|
69
|
+
cwd: string | null;
|
|
70
|
+
/** Basename of `cwd`, for display. */
|
|
71
|
+
project: string | null;
|
|
72
|
+
gitBranch: string | null;
|
|
73
|
+
startedAt: string | null;
|
|
74
|
+
updatedAt: string;
|
|
75
|
+
messageCount: number;
|
|
76
|
+
userPromptCount: number;
|
|
77
|
+
/** Harness-provided title. Reflects the START of the session; often stale. */
|
|
78
|
+
title: string | null;
|
|
79
|
+
/** The last thing the human actually said. The single most useful hard fact. */
|
|
80
|
+
lastUserPrompt: string | null;
|
|
81
|
+
/** Recent human turns, oldest first. Feeds the summarizer. */
|
|
82
|
+
recentUserPrompts: string[];
|
|
83
|
+
/**
|
|
84
|
+
* Evenly-spaced human turns sampled across the WHOLE session, oldest first.
|
|
85
|
+
* `arcPrompts[0]` is the original ask.
|
|
86
|
+
*
|
|
87
|
+
* `recentUserPrompts` says how the work ended; this says what shape it had.
|
|
88
|
+
* Both are needed: a summary written from the tail alone has no subject, and
|
|
89
|
+
* one written from the head alone is just the stale harness title again.
|
|
90
|
+
*/
|
|
91
|
+
arcPrompts: string[];
|
|
92
|
+
/** Files the agent edited or wrote. */
|
|
93
|
+
filesTouched: string[];
|
|
94
|
+
prLinks: PrLink[];
|
|
95
|
+
/** Tail of the final assistant message. Feeds the summarizer. */
|
|
96
|
+
lastAssistantText: string | null;
|
|
97
|
+
/** Most recent failing tool call, if any. Strong signal of unfinished work. */
|
|
98
|
+
lastToolFailure: string | null;
|
|
99
|
+
/** True when the session was interrupted or ended on a failure. */
|
|
100
|
+
endedMidTask: boolean;
|
|
101
|
+
/** Subagent transcript rather than a top-level conversation. */
|
|
102
|
+
isSidechain: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* A non-interactive run (`claude -p`, `codex exec`) rather than a conversation
|
|
105
|
+
* someone sat through. Hidden by default: these are automation, not work you
|
|
106
|
+
* would context-switch back into — and gmux's own summarizer creates
|
|
107
|
+
* them, so listing them would make the tool pollute its own output.
|
|
108
|
+
*/
|
|
109
|
+
isAutomated: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A written summary of where a session LANDED, and what it is about.
|
|
113
|
+
*
|
|
114
|
+
* Generated from the session's arc — start, middle, end — so it describes the
|
|
115
|
+
* latest work without losing the thread that leads to it. Never from the head
|
|
116
|
+
* alone: that is just the stale harness title again.
|
|
117
|
+
*/
|
|
118
|
+
export interface SessionSummary {
|
|
119
|
+
harness: HarnessId;
|
|
120
|
+
sessionId: string;
|
|
121
|
+
/** Hash of the distilled input. Changes when the session changes. */
|
|
122
|
+
sourceHash: string;
|
|
123
|
+
/**
|
|
124
|
+
* SimHash of the session's narrative at summary time. Lets a watcher ask "has
|
|
125
|
+
* this diverged *enough* to re-summarise?" by bit-distance, rather than
|
|
126
|
+
* re-summarising on every keystroke. Absent on summaries written before 0.9.0.
|
|
127
|
+
*/
|
|
128
|
+
fingerprint?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Exact hash of the low-churn *significant* signals — prompt version, last tool
|
|
131
|
+
* failure, mid-task flag, files touched. These always force a refresh when they
|
|
132
|
+
* change, catching the small-but-important flips the SimHash distance would
|
|
133
|
+
* sleep through. Absent on pre-0.9.0 summaries.
|
|
134
|
+
*/
|
|
135
|
+
signalHash?: string;
|
|
136
|
+
generatedAt: string;
|
|
137
|
+
/** Provider that wrote it, e.g. "claude -p". */
|
|
138
|
+
provider: string;
|
|
139
|
+
/** One line: what this work IS. The scannable label; the top of the drilldown. */
|
|
140
|
+
headline: string;
|
|
141
|
+
/** 2-3 sentences: what the session is fundamentally about. */
|
|
142
|
+
overview: string;
|
|
143
|
+
/**
|
|
144
|
+
* A paragraph or two: the real drilldown — how the work evolved and where it
|
|
145
|
+
* stands, enough to reorient without opening the session. Absent on summaries
|
|
146
|
+
* written before 0.10.0.
|
|
147
|
+
*/
|
|
148
|
+
summary?: string;
|
|
149
|
+
/** What got done most recently. */
|
|
150
|
+
landed: string;
|
|
151
|
+
/** What is unresolved or blocked. */
|
|
152
|
+
open: string;
|
|
153
|
+
/** The concrete next action. */
|
|
154
|
+
nextStep: string;
|
|
155
|
+
}
|
|
156
|
+
/** A session paired with its summary, if one has been generated. */
|
|
157
|
+
export interface SessionView {
|
|
158
|
+
record: SessionRecord;
|
|
159
|
+
summary: SessionSummary | null;
|
|
160
|
+
}
|
|
161
|
+
/** The distilled arc of a session, as handed to a summary provider. */
|
|
162
|
+
export interface SummaryInput {
|
|
163
|
+
/**
|
|
164
|
+
* Bumped when the prompt changes shape. Part of the hash, and therefore of
|
|
165
|
+
* the cache key: a prompt edit must invalidate summaries written by the old
|
|
166
|
+
* prompt, or the change never reaches anything already on disk.
|
|
167
|
+
*/
|
|
168
|
+
promptVersion: number;
|
|
169
|
+
harness: HarnessId;
|
|
170
|
+
sessionId: string;
|
|
171
|
+
project: string | null;
|
|
172
|
+
gitBranch: string | null;
|
|
173
|
+
title: string | null;
|
|
174
|
+
recentUserPrompts: string[];
|
|
175
|
+
/** Evenly-spaced turns across the whole session. `[0]` is the original ask. */
|
|
176
|
+
arcPrompts: string[];
|
|
177
|
+
lastAssistantText: string | null;
|
|
178
|
+
filesTouched: string[];
|
|
179
|
+
lastToolFailure: string | null;
|
|
180
|
+
endedMidTask: boolean;
|
|
181
|
+
/** Stable hash of the above. The summary cache key. */
|
|
182
|
+
hash: string;
|
|
183
|
+
}
|
|
184
|
+
/** The five fields a summary provider must return. */
|
|
185
|
+
export interface SummaryFields {
|
|
186
|
+
headline: string;
|
|
187
|
+
overview: string;
|
|
188
|
+
summary: string;
|
|
189
|
+
landed: string;
|
|
190
|
+
open: string;
|
|
191
|
+
nextStep: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* A model CLI gmux may call.
|
|
195
|
+
*
|
|
196
|
+
* `command` is argv for a one-shot call: prompt on stdin, text on stdout. That
|
|
197
|
+
* is the whole contract, and it is why gmux depends on no vendor SDK.
|
|
198
|
+
*/
|
|
199
|
+
export interface ProviderChoice {
|
|
200
|
+
/** Catalog id ("claude-code", "codex"), or "custom" for a hand-written command. */
|
|
201
|
+
id: string;
|
|
202
|
+
command: string[];
|
|
203
|
+
}
|
|
204
|
+
/** Config schema version. Bump when `GmConfig` changes shape incompatibly. */
|
|
205
|
+
export declare const CONFIG_VERSION = 1;
|
|
206
|
+
/**
|
|
207
|
+
* The choices a human made, persisted.
|
|
208
|
+
*
|
|
209
|
+
* Config is NOT cache. Wiping `~/.cache/gmux` must cost you summaries,
|
|
210
|
+
* never your provider choice — which is why this lives under the config dir and
|
|
211
|
+
* is keyed by nothing.
|
|
212
|
+
*/
|
|
213
|
+
export interface GmConfig {
|
|
214
|
+
version: number;
|
|
215
|
+
/**
|
|
216
|
+
* null means "make no model calls". A supported answer, not a missing value —
|
|
217
|
+
* `gmux setup` offers it, and it is how you decline the token spend outright.
|
|
218
|
+
*/
|
|
219
|
+
provider: ProviderChoice | null;
|
|
220
|
+
/** Keep the recent window summarized in the background. */
|
|
221
|
+
autoSummarize: boolean;
|
|
222
|
+
/** gmux daemon + guardian settings. Absent on configs written before gmux. */
|
|
223
|
+
gmux?: import("./gmux-types.js").GmuxConfig;
|
|
224
|
+
}
|
|
225
|
+
/** One exchange in an `gmux ask` conversation. */
|
|
226
|
+
export interface AskTurn {
|
|
227
|
+
question: string;
|
|
228
|
+
answer: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* One record in the picker's chat thread, as it is appended to disk.
|
|
232
|
+
*
|
|
233
|
+
* Events rather than turns, and that is forced: the echo of a question must
|
|
234
|
+
* land the instant you press enter, ~9–20s before there is an answer to pair it
|
|
235
|
+
* with, and the log is append-only — so "the question, and the answer when it
|
|
236
|
+
* comes" has to be two records. `AskTurn` is what these fold *into*
|
|
237
|
+
* (`foldCompletedTurns`), which is why the two live side by side.
|
|
238
|
+
*
|
|
239
|
+
* `seq` keys everything, never file order: two writers append here (the sender
|
|
240
|
+
* writes `question`, the worker writes `chunk`/`end`), and a fold that depended
|
|
241
|
+
* on position would depend on a lock in another module.
|
|
242
|
+
*
|
|
243
|
+
* `meta` is written once, by the first sender, inside the same open that creates
|
|
244
|
+
* the file. Its reader is a human running `cat` on a transcript whose answers
|
|
245
|
+
* look wrong: `provider` is the field that says which CLI produced them — the
|
|
246
|
+
* argv, never the environment, which carries the fzf api key.
|
|
247
|
+
*/
|
|
248
|
+
export type AskEvent = {
|
|
249
|
+
t: "meta";
|
|
250
|
+
runId: string;
|
|
251
|
+
startedAt: string;
|
|
252
|
+
provider: string;
|
|
253
|
+
} | {
|
|
254
|
+
t: "question";
|
|
255
|
+
seq: number;
|
|
256
|
+
at: string;
|
|
257
|
+
focus: string | null;
|
|
258
|
+
text: string;
|
|
259
|
+
} | {
|
|
260
|
+
t: "chunk";
|
|
261
|
+
seq: number;
|
|
262
|
+
text: string;
|
|
263
|
+
} | {
|
|
264
|
+
t: "end";
|
|
265
|
+
seq: number;
|
|
266
|
+
at: string;
|
|
267
|
+
} | {
|
|
268
|
+
t: "aborted";
|
|
269
|
+
seq: number;
|
|
270
|
+
at: string;
|
|
271
|
+
} | {
|
|
272
|
+
t: "error";
|
|
273
|
+
seq: number;
|
|
274
|
+
at: string;
|
|
275
|
+
message: string;
|
|
276
|
+
};
|
|
277
|
+
/** Everything `gmux ask` knows about your sessions, before a question is asked. */
|
|
278
|
+
export interface AskContext {
|
|
279
|
+
/** The sessions the picker/list had loaded. Summaries where they exist. */
|
|
280
|
+
sessions: SessionView[];
|
|
281
|
+
/** The session the user was looking at when they hit ctrl-o, if any. */
|
|
282
|
+
focusId: string | null;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Pluggable chat provider. Mocked in tests; never called for real by them.
|
|
286
|
+
*
|
|
287
|
+
* Deliberately the same shape of contract as `SummaryProvider`: a prompt goes
|
|
288
|
+
* in, text comes out. The difference is that the CLI behind it is invoked with
|
|
289
|
+
* permission to run `gmux grep`, so the tool loop belongs to the harness rather
|
|
290
|
+
* than to us.
|
|
291
|
+
*/
|
|
292
|
+
export interface AskProvider {
|
|
293
|
+
readonly name: string;
|
|
294
|
+
isAvailable(): Promise<boolean>;
|
|
295
|
+
ask(prompt: string): Promise<string>;
|
|
296
|
+
}
|
|
297
|
+
/** Pluggable summarizer. Mocked in tests; never called for real by them. */
|
|
298
|
+
export interface SummaryProvider {
|
|
299
|
+
/** Human-readable name, recorded on the summary. */
|
|
300
|
+
readonly name: string;
|
|
301
|
+
/** True when the underlying CLI is actually installed. */
|
|
302
|
+
isAvailable(): Promise<boolean>;
|
|
303
|
+
generate(input: SummaryInput): Promise<SummaryFields>;
|
|
304
|
+
}
|
|
305
|
+
/** One hit from a full-text search, resolved back to its session. */
|
|
306
|
+
export interface SearchHit {
|
|
307
|
+
session: SessionRecord;
|
|
308
|
+
matchCount: number;
|
|
309
|
+
/** Representative matching lines, already trimmed for display. */
|
|
310
|
+
snippets: string[];
|
|
311
|
+
}
|
|
312
|
+
/** Filters shared by `ls` and the picker. */
|
|
313
|
+
export interface ListFilters {
|
|
314
|
+
harness?: string;
|
|
315
|
+
project?: string;
|
|
316
|
+
branch?: string;
|
|
317
|
+
/** ISO timestamp; sessions older than this are dropped. */
|
|
318
|
+
since?: string;
|
|
319
|
+
limit?: number;
|
|
320
|
+
includeSidechains?: boolean;
|
|
321
|
+
includeAutomated?: boolean;
|
|
322
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared vocabulary of gmux. Every layer speaks these types.
|
|
3
|
+
*
|
|
4
|
+
* `core` imports nothing internal — see docs/architecture.md for the layer rule.
|
|
5
|
+
*/
|
|
6
|
+
/** Schema version for every `--json` payload. Bump on breaking changes. */
|
|
7
|
+
export const SCHEMA_VERSION = 1;
|
|
8
|
+
/** Config schema version. Bump when `GmConfig` changes shape incompatibly. */
|
|
9
|
+
export const CONFIG_VERSION = 1;
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AA8MhC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC"}
|