gcf-board 0.19.1 → 0.20.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/README.md +2 -0
- package/dist/server/app.js +71 -2
- package/dist/server/events.js +99 -0
- package/dist/web/assets/index-7axl-gEt.js +95 -0
- package/dist/web/assets/{index-BrufSede.css → index-B_28Lkc9.css} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-DHyOKvbO.js +0 -94
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ A local web board for game projects on [GCF](../gcf-aif-ext): the items by statu
|
|
|
6
6
|
|
|
7
7
|
- Node.js ≥ 22.18
|
|
8
8
|
- [`ai-factory`](https://www.npmjs.com/package/ai-factory) installed globally, and in each project [`gcf-aif-ext`](../gcf-aif-ext) ≥ 0.18 (`gcf board --json` with `schema: 4`: the columns, the moves, the item's fields, the blocks and the Help terms come from it as data)
|
|
9
|
+
- for 0.20: `gcf-aif-ext` ≥ 0.22 for **Changes** (an older core shows neither the screen nor its marker)
|
|
9
10
|
- for runs: [`gcf-harness-aif-ext`](../gcf-harness-aif-ext) ≥ 0.11 (every board run opens its chat: `--chat`, `gcf-harness chat`; it waits the project's answer time) and Claude Code (`claude -p`); ≥ 0.12 to wait for the usage limit's reset and for queued runs (`--wait-limit`)
|
|
10
11
|
- for the project chat: `gcf-aif-ext` ≥ 0.12 (`domain.chat`, `agent.rules`) and Claude Code
|
|
11
12
|
- for 0.12: `gcf-aif-ext` ≥ 0.16 for the chat's proposals of moves on items and inbox entries (an older core proposes only new items) and an item's own run mode; `gcf-harness-aif-ext` ≥ 0.16 to run main and worktree side by side safely (the main run's queue in the gate, a merge that waits)
|
|
@@ -41,6 +42,7 @@ The board knows no domain by name: the project's board read gives its columns, m
|
|
|
41
42
|
- **Board**: columns ready, running, blocked, awaiting-verdict, awaiting-decision, unplayed, parked. A card shows the type, the gate, the plan progress (`2/5`), the severity, `verified`, the model, **needs N** and **needed by N**. A running card shows when its run log was last written (`active 12 s ago`), and `quiet 6 min` when the log has been silent for 5 minutes or more. A run's end report gives each item's cost when the agent reported it. Pointing at a card (or focusing it from the keyboard) lights up the cards it needs and the cards that need it, each saying how, and dims the rest. The toolbar (board 0.9.0, core 0.13.0) searches ids and titles, keeps **waiting for me**, filters by the fields the domain marks `filter` (GCF: type, gate, severity, system, milestone; several values at once, each a chip to take off) and lays the board out in lanes by a field it marks `group` (system, parent, milestone): an item with two systems stands in both lanes, one with none in **none**, a parent lane is named by the feature's title. The mouse drags the board sideways from its empty space; the wheel over a column with no scroll of its own pans it.
|
|
42
43
|
- **An item** (a window over the screen, dragged by its head; a page on a phone; board 0.14.0): its **Status** (why it is blocked or waits, its fields, its dependencies; it opens there when it is blocked or waits), its file (the front matter folded, a `key:` body by sections), its plan and its run log as it grows, its **Lessons**, and the moves the core offers for it (`items[].moves`, Methodology §4.1): run, verdict, decide, block, unblock, drop, close, submit, depends. Each move's form comes from the core; the core still checks the rest itself, and the board shows its answer. **Dependencies**: what it needs that has not ended in history (an item with its column, a design unit with its TBDs or the questions that block it, a graveyard line, an unknown id) and the items that need it, each a link; **Edit…** opens the picker of the board's items and design units (search by id and title, or type an id), and Save sends the `depends` move's adds and removes. **History** (core 0.13.0): its moves newest first, when, which, who (a run, your session, you; unknown on a commit older than the framework's marks), the commit and its subject; then its runs, as on the Runs screen. **Related**: its feature's other children, and the graveyard lines tagged with its system ("did we kill this before?"). An item that ended opens from **Ended** with its History.
|
|
43
44
|
- **Runs** (harness 0.13.0): what runs now with the run's model and effort, its last log lines, **Whole log** and **Stop**; the queue with what each item will run on; the past runs of the harness's run log, newest first, 50 at a time: start, end, mode, cost, and per item its result word, the reason word for word, cost, tokens, turns, handoffs, a broken step and what it ran on. **log** opens the part of the item's log that run wrote, **chat** that run's chat. Every start the operator asks for (Run selected, Run next, a drop on running, this screen) asks first with a model and effort picker for that run only (**default: each item's own**); the drawer's Run is one click. An older harness shows the active runs only, and the dialog has no pickers. The API: `GET /api/p/<project>/runs/past?limit=` (`gcf-harness runs --json`; 404 without a harness that keeps them), `GET …/item/<id>/history` (`{id, moves, runs}`), `GET …/log/<id>?from=&to=` (a past run's part, once: `{text, cut}`, at most its last 2 MB; without `from` and `to` the log as it grows), `POST …/run` with `model` and `effort`, `POST …/inbox/<entry>/draft` (`{thread, created}`).
|
|
45
|
+
- **Changes** (board 0.20.0, core 0.22.0): what is not committed and how it differs, view only: the agent commits. The header's `● 7 changed` counts the main checkout, and says `run writing in main` while a run works there; the screen switches between the main checkout and each run's worktree. A text file opens its diff, a picture its before and after; a binary file, the project's `no_diff:` globs (one glob a line in Settings), links, submodules, nested repositories and Git LFS files are listed and open nothing. It follows a move, a commit or an add at once, a save in an editor within 30 s.
|
|
44
46
|
- **Drag**:
|
|
45
47
|
- a ready card into **running** starts its run;
|
|
46
48
|
- a blocked or parked card into **ready** unblocks it;
|
package/dist/server/app.js
CHANGED
|
@@ -15,7 +15,7 @@ import { BOARD_SCHEMA, gatePath, runModeOf, toolOf, } from '../shared/board.js';
|
|
|
15
15
|
import { admit, cookieName, fromPage, hostAllowed, tokenInUrl } from './auth.js';
|
|
16
16
|
import { upgrade } from './ws.js';
|
|
17
17
|
import { briefError, refusalOf, runCli } from './cli.js';
|
|
18
|
-
import { broadcast, planRev, SESSION_TTL_MIN, subscribe, watchProject } from './events.js';
|
|
18
|
+
import { broadcast, planRev, SESSION_TTL_MIN, subscribe, watchChanges, watchProject, } from './events.js';
|
|
19
19
|
import { attachesUnit, CHAT_BODY_MAX, chatInput, IMAGE_EXT, talkInput, withUploads, } from './chat.js';
|
|
20
20
|
import { attachmentOf, follow, followLog, logPart, readShown, shownShape } from './files.js';
|
|
21
21
|
import { HttpError } from './http-error.js';
|
|
@@ -24,7 +24,7 @@ import { isUpload, saveUpload, UPLOAD_MAX } from './upload.js';
|
|
|
24
24
|
import { addProject, homeDir, listProjects, projectOf, removeProject, yoloFile, } from './registry.js';
|
|
25
25
|
import { allThemes } from './themes.js';
|
|
26
26
|
import { askIfDue, askUsage, configureUsage, lastUsage } from './usage.js';
|
|
27
|
-
import { adoptRuns, busyCheck, keepProjects, sweepRuns, closeReport, forgetProject, resumeQueue, runsOf, setAutopilot, startRun, unqueue, } from './runs.js';
|
|
27
|
+
import { activeRuns, adoptRuns, busyCheck, keepProjects, sweepRuns, closeReport, forgetProject, resumeQueue, runsOf, setAutopilot, startRun, unqueue, } from './runs.js';
|
|
28
28
|
import { acceptProposal, agentDefaults, agentPresets, chatCard, deniedGroupIn, lastDeniedOf, lastRunEnd, chatOf, entryTalk, listTalks, openTalk, pickTalk, prepareTalk, startDesign, startTalk, stopTalk, talkEntry, talkId, talkLive, talkSaid, talkWaits, watchTalks, writeTalk, } from './talks.js';
|
|
29
29
|
import { threadDir, threadOfEntry } from 'gcf-session';
|
|
30
30
|
const send = (res, status, body) => {
|
|
@@ -69,6 +69,11 @@ async function sendFile(res, type, file, disposition = null) {
|
|
|
69
69
|
// A read that breaks after the head is sent can only cut the answer short.
|
|
70
70
|
await pipeline(createReadStream(file), res).catch(() => res.destroy());
|
|
71
71
|
}
|
|
72
|
+
/** A Changes request's tree as the core takes it: its own word, so no value reads as a flag. */
|
|
73
|
+
const treeArgs = (url) => {
|
|
74
|
+
const tree = url.searchParams.get('tree');
|
|
75
|
+
return tree && tree !== 'main' ? [`--worktree=${tree}`] : [];
|
|
76
|
+
};
|
|
72
77
|
/** Parse the JSON a command printed, or say what it printed instead. */
|
|
73
78
|
function jsonOf(r, what) {
|
|
74
79
|
try {
|
|
@@ -971,6 +976,70 @@ export function createApp(o) {
|
|
|
971
976
|
send(res, 200, jsonOf(r, 'gcf design part'));
|
|
972
977
|
},
|
|
973
978
|
],
|
|
979
|
+
[
|
|
980
|
+
// What is uncommitted in the main checkout or a run's worktree (`gcf changes`, core 0.22).
|
|
981
|
+
'GET',
|
|
982
|
+
/^\/api\/p\/([^/]+)\/changes$/,
|
|
983
|
+
async (_req, res, m, url) => {
|
|
984
|
+
const p = await projectOf(m[1]);
|
|
985
|
+
const r = await cli(p, ['gcf', 'changes', ...treeArgs(url), '--json']);
|
|
986
|
+
if (!r.ok)
|
|
987
|
+
throw new HttpError(400, briefError(r.err || r.out));
|
|
988
|
+
send(res, 200, jsonOf(r, 'gcf changes'));
|
|
989
|
+
},
|
|
990
|
+
],
|
|
991
|
+
[
|
|
992
|
+
'GET',
|
|
993
|
+
/^\/api\/p\/([^/]+)\/changes\/diff$/,
|
|
994
|
+
async (_req, res, m, url) => {
|
|
995
|
+
const p = await projectOf(m[1]);
|
|
996
|
+
const at = `--path=${url.searchParams.get('path') ?? ''}`;
|
|
997
|
+
const r = await cli(p, ['gcf', 'changes', 'diff', at, ...treeArgs(url), '--json']);
|
|
998
|
+
if (!r.ok)
|
|
999
|
+
throw new HttpError(400, briefError(r.err || r.out));
|
|
1000
|
+
send(res, 200, jsonOf(r, 'gcf changes diff'));
|
|
1001
|
+
},
|
|
1002
|
+
],
|
|
1003
|
+
[
|
|
1004
|
+
// A picture's bytes, before or after. An svg may hold scripts: sandboxed, never sniffed.
|
|
1005
|
+
'GET',
|
|
1006
|
+
/^\/api\/p\/([^/]+)\/changes\/file$/,
|
|
1007
|
+
async (_req, res, m, url) => {
|
|
1008
|
+
const p = await projectOf(m[1]);
|
|
1009
|
+
const at = `--path=${url.searchParams.get('path') ?? ''}`;
|
|
1010
|
+
const side = `--side=${url.searchParams.get('side') ?? ''}`;
|
|
1011
|
+
const r = await cli(p, ['gcf', 'changes', 'file', at, side, ...treeArgs(url), '--json']);
|
|
1012
|
+
if (!r.ok)
|
|
1013
|
+
throw new HttpError(400, briefError(r.err || r.out));
|
|
1014
|
+
const file = jsonOf(r, 'gcf changes file');
|
|
1015
|
+
const bytes = Buffer.from(file.base64, 'base64');
|
|
1016
|
+
res.writeHead(200, {
|
|
1017
|
+
'content-type': file.type,
|
|
1018
|
+
'content-length': bytes.length,
|
|
1019
|
+
'content-disposition': 'inline',
|
|
1020
|
+
'content-security-policy': 'sandbox',
|
|
1021
|
+
'x-content-type-options': 'nosniff',
|
|
1022
|
+
'cache-control': 'no-store',
|
|
1023
|
+
});
|
|
1024
|
+
res.end(bytes);
|
|
1025
|
+
},
|
|
1026
|
+
],
|
|
1027
|
+
[
|
|
1028
|
+
// The marker of the project this page shows: a stream of its own, closed when it leaves.
|
|
1029
|
+
'GET',
|
|
1030
|
+
/^\/api\/p\/([^/]+)\/changes\/events$/,
|
|
1031
|
+
async (_req, res, m) => {
|
|
1032
|
+
const p = await projectOf(m[1]);
|
|
1033
|
+
watchChanges(p.name, res, {
|
|
1034
|
+
root: p.path,
|
|
1035
|
+
read: async () => {
|
|
1036
|
+
const r = await cli(p, ['gcf', 'changes', '--json']);
|
|
1037
|
+
return r.ok ? jsonOf(r, 'gcf changes') : null;
|
|
1038
|
+
},
|
|
1039
|
+
busy: () => activeRuns(p.name).some((run) => run.mode === 'main'),
|
|
1040
|
+
});
|
|
1041
|
+
},
|
|
1042
|
+
],
|
|
974
1043
|
[
|
|
975
1044
|
// The design as one bundle a designer edits (`gcf design export`): a download.
|
|
976
1045
|
'GET',
|
package/dist/server/events.js
CHANGED
|
@@ -26,6 +26,105 @@ export function broadcast(event) {
|
|
|
26
26
|
const line = `data: ${JSON.stringify(event)}\n\n`;
|
|
27
27
|
for (const c of clients)
|
|
28
28
|
c.write(line);
|
|
29
|
+
if (event.type === 'board')
|
|
30
|
+
signalChanges(event.project);
|
|
31
|
+
}
|
|
32
|
+
// Per project, only while a page shows it (Changes-Plan d17): `watched()` means any page at all,
|
|
33
|
+
// and a read of every project on a board with many would be paid for nothing.
|
|
34
|
+
const changesWatches = new Map();
|
|
35
|
+
/** Whether a page shows this project: the marker is read only for such a one. */
|
|
36
|
+
export const changesWatched = (project) => changesWatches.has(project);
|
|
37
|
+
function stampOf(w) {
|
|
38
|
+
return w.files
|
|
39
|
+
.map((f) => {
|
|
40
|
+
try {
|
|
41
|
+
return statSync(path.resolve(w.root, f)).mtimeMs;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return 0; // A commit replaces the file: the next poll sees the new one.
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
.join(' ');
|
|
48
|
+
}
|
|
49
|
+
/** One read in flight: a big repository's `status -uall` may take longer than the signals come. */
|
|
50
|
+
async function readChanges(project, w) {
|
|
51
|
+
if (w.reading) {
|
|
52
|
+
w.again = true;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
w.reading = true;
|
|
56
|
+
do {
|
|
57
|
+
w.again = false;
|
|
58
|
+
// A run works in the main checkout: "N changed" would blink, and is not the operator's.
|
|
59
|
+
const busy = w.busy();
|
|
60
|
+
// Taken before the read: a commit landing during it moves the stamp, and is read after it.
|
|
61
|
+
w.stamp = stampOf(w);
|
|
62
|
+
const read = busy ? null : await w.read().catch(() => null);
|
|
63
|
+
// The first read names the files: the next poll has no stamp of them, and reads once more.
|
|
64
|
+
if (read?.watch && !w.files.length)
|
|
65
|
+
w.files = [read.watch.index, read.watch.head];
|
|
66
|
+
if (busy || read) {
|
|
67
|
+
const event = { type: 'changes', count: read ? read.count : null };
|
|
68
|
+
w.last = `data: ${JSON.stringify(event)}\n\n`;
|
|
69
|
+
for (const c of w.clients)
|
|
70
|
+
c.write(w.last);
|
|
71
|
+
}
|
|
72
|
+
} while (w.again && changesWatches.get(project) === w);
|
|
73
|
+
w.reading = false;
|
|
74
|
+
}
|
|
75
|
+
/** A project's files moved, or a run began or ended: read its marker if a page shows it. */
|
|
76
|
+
export function signalChanges(project) {
|
|
77
|
+
const w = changesWatches.get(project);
|
|
78
|
+
if (w)
|
|
79
|
+
void readChanges(project, w);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A page shows `project`: `res` hears its marker until it closes, whatever closes it (a tab, a
|
|
83
|
+
* dropped socket, the page going to another project), so no unsubscribe call can be lost. The
|
|
84
|
+
* index and HEAD are polled; an IDE's save touches neither, so a slow tick reads anyway.
|
|
85
|
+
*/
|
|
86
|
+
export function watchChanges(project, res, source, { stampMs = 1500, tickMs = 30_000 } = {}) {
|
|
87
|
+
// Gone while its project was looked up: its `close` already fired, none would come to drop it.
|
|
88
|
+
if (res.destroyed)
|
|
89
|
+
return;
|
|
90
|
+
openStream(res);
|
|
91
|
+
let w = changesWatches.get(project);
|
|
92
|
+
if (!w) {
|
|
93
|
+
const made = {
|
|
94
|
+
...source,
|
|
95
|
+
clients: new Set(),
|
|
96
|
+
last: null,
|
|
97
|
+
reading: false,
|
|
98
|
+
again: false,
|
|
99
|
+
files: [],
|
|
100
|
+
stamp: '',
|
|
101
|
+
timers: [],
|
|
102
|
+
};
|
|
103
|
+
made.timers = [
|
|
104
|
+
setInterval(() => {
|
|
105
|
+
if (stampOf(made) !== made.stamp)
|
|
106
|
+
void readChanges(project, made);
|
|
107
|
+
}, stampMs),
|
|
108
|
+
setInterval(() => void readChanges(project, made), tickMs),
|
|
109
|
+
];
|
|
110
|
+
for (const t of made.timers)
|
|
111
|
+
t.unref();
|
|
112
|
+
changesWatches.set(project, made);
|
|
113
|
+
w = made;
|
|
114
|
+
}
|
|
115
|
+
const held = w;
|
|
116
|
+
held.clients.add(res);
|
|
117
|
+
res.on('close', () => {
|
|
118
|
+
held.clients.delete(res);
|
|
119
|
+
if (held.clients.size)
|
|
120
|
+
return;
|
|
121
|
+
for (const t of held.timers)
|
|
122
|
+
clearInterval(t);
|
|
123
|
+
changesWatches.delete(project);
|
|
124
|
+
});
|
|
125
|
+
if (held.last)
|
|
126
|
+
res.write(held.last);
|
|
127
|
+
void readChanges(project, held);
|
|
29
128
|
}
|
|
30
129
|
// Minutes a session mark stays fresh before the project's board read names its own
|
|
31
130
|
// (`domain.session_ttl_min`, core 0.15), and with a core older than that.
|