gcf-board 0.27.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/server/app.js +26 -9
- package/dist/server/chat.js +27 -1
- package/dist/server/cli.js +6 -2
- package/dist/server/desktop.js +1 -0
- package/dist/server/runs.js +34 -4
- package/dist/server/talks.js +24 -16
- package/dist/shared/board.js +45 -0
- package/dist/web/assets/index-BHNTx9zd.css +1 -0
- package/dist/web/assets/index-UBIHpB-m.js +119 -0
- package/dist/web/index.html +2 -2
- package/node_modules/gcf-session/lib/chat.js +34 -16
- package/node_modules/gcf-session/lib/proc.js +5 -1
- package/node_modules/gcf-session/lib/session.js +39 -19
- package/node_modules/gcf-session/lib/store.js +14 -9
- package/node_modules/gcf-session/lib/thread.js +9 -3
- package/node_modules/gcf-session/lib/usage.js +12 -1
- package/node_modules/gcf-session/package.json +1 -1
- package/package.json +2 -2
- package/dist/web/assets/index-BCfiz95-.css +0 -1
- package/dist/web/assets/index-Ds32enMs.js +0 -116
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ The board knows no domain by name: the project's board read gives its columns, m
|
|
|
44
44
|
|
|
45
45
|
- **Command**: **waiting for me**, what only the operator moves on (Board-PRD §1.3), by group, each a grid of tiles (board 0.16.0, the designer's final round): failed run reports and a paused queue (its tile opens Runs), a card waiting in a chat (its tile opens the chat), the decisions, the items to play and judge, to decide, to unblock (the columns the domain marks `human`), and a `paused: limit` item to resume. Beside it **Live**: the runs going on with their plan progress, **Follow** and **Stop**, the console runs and sessions, **Run next**, the queue, the run reports, and what the board did by itself.
|
|
46
46
|
- **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.
|
|
47
|
-
- **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.
|
|
47
|
+
- **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, unless you last clicked another tab: the next item opens on that one; a tuned item lists its tune notes there), 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.
|
|
48
48
|
- **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}`).
|
|
49
49
|
- **Log** (board 0.20.1, gcf-session 0.18.1): a subagent's lines say so (`subagent:`, `subagent tool:`, `subagent tool error:`), drawn as the main agent's kinds; the pulse's current action names a subagent's call as one.
|
|
50
50
|
- **Play** (board 0.24.0, core 0.26.0): a card waiting for play shows its build (one per code, `Same build as` when shared), **Play** per target of `play:` that builds first when there is none, **Stop** and **Change** (find again with agent, edit, build again), on its run's end card, in its window and on Playtest; **Set up** opens a chat thread whose agent finds the commands, **by hand** opens the form; **Play main** and **Build main** play the checkout as it is; a verdict stops the card's player and removes a build no other card holds.
|
|
@@ -74,7 +74,7 @@ The board knows no domain by name: the project's board read gives its columns, m
|
|
|
74
74
|
- **An item's chat** (its drawer's **Chat** tab; harness 0.11.1, core 0.11.1): every run the board starts keeps its agent sessions open; the project's `chat:` settings (Settings: `chat.ask`, `chat.answer_timeout_min`) say what the agent asks and how long a question waits. The tab shows the run's chat, then the item's own thread of the project chat: the talk, question cards (picks, several questions, **Submit**), the run's milestones, its sessions, the limit wait, the context share. A message goes where the server puts it: the live run (its limit wait too), else the item's thread, and the line under the box says where it went. `GET /api/p/<project>/chat/<id>` follows the item's chat from its start, in raw chunks of JSON lines (the page splits them). `POST` there sends `{type: 'say', text, images?, attach?}`, `{type: 'interrupt'}` or `{type: 'answer', request_id, answers}` through `gcf-harness chat`; with no live run a message goes to the item's thread (answer `{talk}`), else a message with no session to read it gets 409, bad input 400. `attach` (`[{kind: item | unit | file, ref}]`) goes into the message's text as a line the agent reads; a file picked on the operator's machine (`{kind: file, ref: <name>, data: <base64>}`, the composer's 📎) is written into `.gcf-session/uploads/` and goes as `file <its absolute path>`; a move's `file` field (`attach`) takes `{name, data}` the same way, its copy removed after the command; a design unit (the composer's **+ unit**, from the board read's `units`) goes as `unit <id> (<file>)`. `GET /api/p/<project>/chat/<id>/att/<file>` serves a chat picture; **attach to item…** under a picture gives it to an item (`gcf item attach`).
|
|
75
75
|
- **Functional base A** (board 0.10.0, core and harness 0.14.0; docs/Base-A-Plan.md): Settings has `session_timeout_min` and the project's `agent.model` / `agent.effort`; the drawer shows the project's model on an item without its own, "(project)". The drawer's Run is off with the run gate's reason when the gate refuses the item now, and the start dialog marks each refused item and runs the rest (`GET /api/p/<project>/gate?ids=` runs `gcf-harness gate --each`). An item's attachments and an inbox entry's pictures are links (`GET /api/p/<project>/attachment?path=`: only `gcf/work/<id>/attachments/` and `gcf/inbox/in-<hex>/attachments/`, no `..`, no link on the way, a picture shown, any other file a download, `nosniff` and `default-src 'none'`), and a picture or link in File or Plan that points there loads through it. A permission card for one MCP tool offers Always, saying it allows every call of the tool with any arguments.
|
|
76
76
|
- **Model and effort** (board 0.8.0, core 0.12.3; a closed select since board 0.15.0, Board-PRD decision 33): pickers in the New item form, in the drawer (**change** beside the model and effort, and **model / effort** under **More**), in a thread's composer and in Settings (`agent.model` / `agent.effort`). Each is one select: Default first — "Default (Opus)" / "Default (High)", or "Default - project setting (Sonnet)" when the project sets one, and "Default - each item's own" in the run dialog; Default sends `default` — then the agent's presets by name (Fable, Opus, xHigh). Nothing set anywhere runs on Opus / High (decision 36). A thread's composer has no Default row: it shows what holds, and **↺ project** takes the thread's own pick off (board 0.16.2). No own word; a value set from the console that the presets lack shows as its own row, so a form sent unchanged keeps it. An item's next run takes them; a thread's next session does (`chats/<t>/agent.json`), and its line in the chat says so.
|
|
77
|
-
- **Project chat** (the **Chat** screen; core 0.12): threads of an agent in the project's folder, listed
|
|
77
|
+
- **Project chat** (the **Chat** screen; core 0.12): threads of an agent in the project's folder, listed by their last message and filtered by their item; **Reply** on an agent message sends your words with it quoted; a new thread is made when its first message is sent. Each thread is run by the bundled session engine (`gcf-session`) through the same detached relay as runs. It asks a card before each edit, git command and framework move (**allow once**, **always** — saved in `.claude/settings.local.json`; the card says saved only when it was — or **deny**); a new item it proposes through the board's MCP server `gcf` (tool `propose_item_new`, asked with no card: the proposal card is the question), the proposal card shows every field it proposed, and the operator's **Create** makes it with `POST /move` (`proposal: {talk, id}`), **Edit…** first in the new-item form. A proposed item has no id: the server asks `gcf item new --dry-run` for it, records it, then creates the item with it, so a board that stops halfway does not make it twice. An inbox entry the agent proposed is filed with origin `agent`: the server adds `--origin=agent`, never from the request. With core 0.16 (board 0.12.0, Board-PRD decision 27) it also proposes a move on an item or an inbox entry already there — `block`, `drop`, `depends`, and the inbox's `add` (with its category), sort, Later and erase (sort and Later with core 0.18, board 0.15.0) — naming it in `id`: the card shows the item's id, title and status now (or the entry's first line), warns when the item does not take the move now or is not on the board, its button is the move's name (a drop or an erase asks first), and **Edit…** opens that move's form. A thread's list entry names the card that waits in it and its limit wait (`card`, `limit_until`); a running item names the card of its run's chat (`chat_card`). A long talk hands over to a fresh agent from a summary; an idle agent closes after `chat.answer_timeout_min` (0 means 15) and the next message resumes it. Each item has at most one thread: a message to an item with no live run goes there. `GET /api/p/<project>/talks[?item=]` lists the threads with their proposals' states; `POST` there makes one (`{item?}`); `GET /api/p/<project>/talk/<t>` follows a thread's events; `POST` there sends `say`, `interrupt`, `answer`, `allow`, `deny` or `handoff`; `POST …/talk/<t>/stop` is the composer's **close agent** (board 0.8.1): the thread's agent ends with everything it started, or its limit wait does, and what it had not taken in is dropped with a "not sent" line; the next message resumes the talk; `GET …/talk/<t>/att/<file>` serves its pictures. The files live in `.gcf-session/chats/` (docs/Chat-Plan.md §3).
|
|
78
78
|
- **Inbox** (categories since board 0.15.0, core 0.18.0; Board-PRD decision 32): add an entry (Ctrl+Enter adds, Enter breaks the line; a category of the ones you may file, Note by default, and a detail), **Sort…** it into another category, put it away to **Later** and take it **Back**, erase it, or turn it into an item (its first line the title, the rest the note). Each entry shows its category and detail, its origin, its lines and date. Search the entries, filter them by category (or "in Later") and by detail. Since board 0.16.0 each group is a panel of tiles, Needs you first; a tile opens the record in the detail window (the item window's frame); the filter takes a category, its details, the origin, an item and the text; on the Inbox `j` / `k` move between tiles, Enter opens, `s` sorts, `l` puts Later or Back, `e` erases. The decisions and the agent's assumptions are records of their own categories there too. **Draft with agent** opens a project chat thread bound to the entry and sends "Draft an item from inbox entry <id>:" with its text; a second click opens the same thread. The first proposal's **Create** takes the entry (it is erased); a later one makes an item with no entry. Off while the usage limit holds.
|
|
79
79
|
- **Design**: where a game starts and its design changes. The steps from an empty project to the first work (the design, the pillars, the open questions, a ready unit), each with what does it: **Import GDD** (a markdown file), **Review GDD first**, **Create with agent**, **Draft with agent** for the glossary, **Pillars interview**, **Name with agent** for pillars without a name; each opens a project chat thread that follows its own skill and writes the design files without a card. **Record design** commits what a thread wrote, and **Discard draft…** takes an agent's unrecorded draft back (`gcf design discard`); a form save of the drafted part takes the draft along. The pillars, the vision, the glossary, a subsystem's purpose and each unit open in a form whose fields come from the core; a save goes through the core's checks, a refusal says why. A pillar is edited by its name, its id read-only (a changed name renames the id after the save); Retire. **Add unit** asks a subsystem, a type and a title, no id, and opens the new unit. A subsystem's purpose has **Draft with agent**. A unit's Drop, the design questions with their answer box, the designer's Export and Import. Until the first work, while steps are left, Command says how many and opens Design.
|
|
80
80
|
- **Keys**: `/` search, `i` a new inbox entry, `n` a new item, `j` / `k` between cards, Enter opens one, `r` runs the focused card (it asks), `1`–`7` a column, `?` Help, `g` then a letter goes to a screen (`g c` Command, `g b` Board, `g t` Chat, `g i` Inbox, `g d` Design, `g r` Runs, `g p` Playtest, `g e` Ended, `g a` Agent, `g m` Metrics, `g s` Settings; the nav's icons say theirs), Esc closes a dialog, Help, the item's or the detail window; none while a field has the focus. Board 0.16.0: the nav is a rail of icons, the project switcher sits at the header's left.
|
package/dist/server/app.js
CHANGED
|
@@ -24,8 +24,8 @@ 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 { activeRuns, adoptRuns, busyCheck, keepProjects, sweepRuns, closeReport, forgetProject, resumeQueue, holdProject, retryWaiting, runsOf, setAutopilot, startRun, unqueue, ticketState, watchTickets, } from './runs.js';
|
|
28
|
-
import { acceptProposal, agentDefaults, agentPresets, chatCard,
|
|
27
|
+
import { activeRuns, adoptRuns, busyCheck, keepProjects, sweepRuns, closeReport, forgetProject, resumeQueue, holdProject, retryWaiting, runsOf, setAutopilot, startRun, allowOf, whileAllowing, unqueue, ticketState, watchTickets, } from './runs.js';
|
|
28
|
+
import { acceptProposal, agentDefaults, agentPresets, chatCard, deniedRuleIn, lastDeniedOf, lastRunEnd, chatOf, entryTalk, listTalks, openTalk, pickTalk, prepareTalk, startDesign, startTalk, stopTalk, talkEntry, talkId, talkLive, talkSaid, talkWaits, watchTalks, writeTalk, } from './talks.js';
|
|
29
29
|
import { accountSettings, saveAccountSettings, threadDir, threadOfEntry } from 'gcf-session';
|
|
30
30
|
const send = (res, status, body) => {
|
|
31
31
|
res.writeHead(status, { 'content-type': 'application/json; charset=utf-8' });
|
|
@@ -502,12 +502,12 @@ export function createApp(o) {
|
|
|
502
502
|
i.chat_card = chatCard(chat);
|
|
503
503
|
if (i.running_kind === 'run')
|
|
504
504
|
i.running_kind = mine.has(i.id) ? 'board' : 'console';
|
|
505
|
-
// A block for a refused
|
|
506
|
-
//
|
|
505
|
+
// A block for a refused call: the deny rule its run's last refusal named, for "Allow
|
|
506
|
+
// <rule> for one run" (docs/Permission-Stop-Plan.md, d3). Never git-history.
|
|
507
507
|
if (i.status === 'blocked' && /needs permission/.test(i.blocked ?? '')) {
|
|
508
|
-
const
|
|
509
|
-
if (
|
|
510
|
-
i.
|
|
508
|
+
const rule = deniedRuleIn(chat);
|
|
509
|
+
if (rule)
|
|
510
|
+
i.denied_rule = rule;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
send(res, 200, { ...board, ...own });
|
|
@@ -667,7 +667,7 @@ export function createApp(o) {
|
|
|
667
667
|
},
|
|
668
668
|
],
|
|
669
669
|
[
|
|
670
|
-
// The project chat's threads (AD-46: `?item=` its bound one),
|
|
670
|
+
// The project chat's threads (AD-46: `?item=` its bound one), the last used first.
|
|
671
671
|
'GET',
|
|
672
672
|
/^\/api\/p\/([^/]+)\/talks$/,
|
|
673
673
|
async (_req, res, m, url) => {
|
|
@@ -1235,12 +1235,29 @@ export function createApp(o) {
|
|
|
1235
1235
|
const ids = runIds(body);
|
|
1236
1236
|
const fresh = body.fresh === true;
|
|
1237
1237
|
const agent = runAgent(body);
|
|
1238
|
+
if (body.allow !== undefined && !allowOf(body.allow))
|
|
1239
|
+
throw new HttpError(400, 'allow is a list of up to 8 one-line deny rules');
|
|
1240
|
+
const allow = allowOf(body.allow) ?? undefined;
|
|
1238
1241
|
// One run per mode: a main one queues behind the main run going, a worktree one starts.
|
|
1239
1242
|
const parts = Map.groupBy(ids, (id) => runModeOf(board, id, body.mode));
|
|
1240
1243
|
// Each part checks first: a refused one starts no other.
|
|
1241
1244
|
for (const part of parts.values())
|
|
1242
1245
|
busyCheck(p, part);
|
|
1243
|
-
const
|
|
1246
|
+
const start = () => [...parts].map(([mode, part]) => startRun(o.entry, p, part, mode, { fresh, harness, agent, allow }));
|
|
1247
|
+
// "Allow for one run" (Permission-Stop-Plan d3): the unblock and the start as one step,
|
|
1248
|
+
// the autopilot held off between them, so no run takes the card without its allowance.
|
|
1249
|
+
const started = body.unblock === true && allow
|
|
1250
|
+
? await whileAllowing(p.name, async () => {
|
|
1251
|
+
for (const id of ids) {
|
|
1252
|
+
const args = moveArgs({ cmd: 'unblock', id }, board.domain.moves);
|
|
1253
|
+
const r = await cli(p, args);
|
|
1254
|
+
if (!r.ok)
|
|
1255
|
+
throw new HttpError(409, `unblock ${id}: ${briefError(r.err)}`);
|
|
1256
|
+
}
|
|
1257
|
+
broadcast({ type: 'board', project: p.name });
|
|
1258
|
+
return start();
|
|
1259
|
+
})
|
|
1260
|
+
: start();
|
|
1244
1261
|
send(res, 202, {
|
|
1245
1262
|
started: started.flatMap((s) => s.started ?? []),
|
|
1246
1263
|
queued: started.flatMap((s) => s.queued ?? []),
|
package/dist/server/chat.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// What the operator writes into an item's chat (docs/Chat-Plan.md): its shape checked here, at
|
|
2
|
+
// the board's edge; `gcf-harness chat` checks the rest and writes it for the session.
|
|
3
|
+
import { replyBlock } from '../shared/board.js';
|
|
1
4
|
import { HttpError } from './http-error.js';
|
|
2
5
|
import { saveUpload } from './upload.js';
|
|
3
6
|
/** A chat message may carry images: a body up to 10 MB. */
|
|
@@ -93,6 +96,18 @@ export async function withUploads(root, body) {
|
|
|
93
96
|
/** Whether a body attaches a design unit: its route reads the board's units for it. */
|
|
94
97
|
export const attachesUnit = (body) => Array.isArray(body.attach) &&
|
|
95
98
|
body.attach.some((a) => a?.kind === 'unit');
|
|
99
|
+
/** A request's `reply_to` (Board-Use-Plan d1): the agent message's `at` and its text; null for none. */
|
|
100
|
+
function replyTo(r) {
|
|
101
|
+
if (r === undefined || r === null)
|
|
102
|
+
return null;
|
|
103
|
+
const { at, text } = r;
|
|
104
|
+
if (typeof at !== 'string' ||
|
|
105
|
+
!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?Z$/.test(at) ||
|
|
106
|
+
typeof text !== 'string')
|
|
107
|
+
throw bad("reply_to is {at: <the agent message's ISO time>, text: <its text>}");
|
|
108
|
+
// The body's own limit bounds it; only its first REPLY_QUOTE_MAX characters are quoted.
|
|
109
|
+
return { at, text };
|
|
110
|
+
}
|
|
96
111
|
/**
|
|
97
112
|
* The line a request writes into the chat input: a message, a stop of the step, an answer.
|
|
98
113
|
* `units`: the design units an attachment may name.
|
|
@@ -101,7 +116,18 @@ export function chatInput(body, units) {
|
|
|
101
116
|
if (body.type === 'interrupt')
|
|
102
117
|
return { type: 'interrupt' };
|
|
103
118
|
if (body.type === 'say') {
|
|
104
|
-
const
|
|
119
|
+
const attach = typeof body.text === 'string' ? attachLine(body.attach, units) : '';
|
|
120
|
+
const reply = replyTo(body.reply_to);
|
|
121
|
+
if (reply && !(typeof body.text === 'string' && body.text.trim()))
|
|
122
|
+
throw bad('a reply carries your own words: the quote alone says nothing');
|
|
123
|
+
// The quote gives way to the operator's words and the attachments: it is cut, not refused.
|
|
124
|
+
const text = typeof body.text === 'string'
|
|
125
|
+
? body.text +
|
|
126
|
+
(reply
|
|
127
|
+
? replyBlock(reply.at, reply.text, TEXT_MAX - body.text.length - attach.length)
|
|
128
|
+
: '') +
|
|
129
|
+
attach
|
|
130
|
+
: body.text;
|
|
105
131
|
if (typeof text !== 'string' || !text.trim() || text.length > TEXT_MAX)
|
|
106
132
|
throw bad(`a message is text, up to ${TEXT_MAX} characters`);
|
|
107
133
|
const list = images(body.images);
|
package/dist/server/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ export function aiFactoryEntry() {
|
|
|
31
31
|
function globalRoots() {
|
|
32
32
|
const roots = [];
|
|
33
33
|
try {
|
|
34
|
-
roots.push(execSync('npm root -g', { encoding: 'utf8', stdio: 'pipe' }).trim());
|
|
34
|
+
roots.push(execSync('npm root -g', { windowsHide: true, encoding: 'utf8', stdio: 'pipe' }).trim());
|
|
35
35
|
}
|
|
36
36
|
catch {
|
|
37
37
|
// No npm on PATH: the folders beside this node still hold the global packages.
|
|
@@ -112,6 +112,7 @@ export function runCli(entry, cwd, args, timeoutMs = 120_000, input) {
|
|
|
112
112
|
const { CLAUDE_CODE_SESSION_ID: _, GCF_RUN_OWNER: __, GCF_MOVE_BY: ___, GCF_RUN_ITEM: ____, ...env } = process.env;
|
|
113
113
|
return new Promise((resolve) => {
|
|
114
114
|
const child = spawn(process.execPath, [entry, ...args], {
|
|
115
|
+
windowsHide: true,
|
|
115
116
|
cwd,
|
|
116
117
|
env,
|
|
117
118
|
shell: false,
|
|
@@ -132,7 +133,10 @@ export function runCli(entry, cwd, args, timeoutMs = 120_000, input) {
|
|
|
132
133
|
err += `\nstopped after ${timeoutMs / 1000} s`;
|
|
133
134
|
// On Windows a kill stops node alone: a build it started (Unity) would go on.
|
|
134
135
|
if (process.platform === 'win32' && child.pid)
|
|
135
|
-
spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F'], {
|
|
136
|
+
spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F'], {
|
|
137
|
+
windowsHide: true,
|
|
138
|
+
stdio: 'ignore',
|
|
139
|
+
});
|
|
136
140
|
else
|
|
137
141
|
child.kill();
|
|
138
142
|
// A grandchild holding the pipes keeps close from firing: the answer does not wait for it.
|
package/dist/server/desktop.js
CHANGED
|
@@ -72,6 +72,7 @@ export function createShortcut(main, port) {
|
|
|
72
72
|
const plan = shortcutPlan(process.platform, process.execPath, main, port);
|
|
73
73
|
if ('powershell' in plan) {
|
|
74
74
|
const r = spawnSync('powershell', ['-NoProfile', '-Command', plan.powershell], {
|
|
75
|
+
windowsHide: true,
|
|
75
76
|
encoding: 'utf8',
|
|
76
77
|
});
|
|
77
78
|
if (r.error)
|
package/dist/server/runs.js
CHANGED
|
@@ -122,6 +122,19 @@ const paused = new Set();
|
|
|
122
122
|
// The projects the operator holds (Hold-Plan d20): no queued or autopilot run starts; the
|
|
123
123
|
// operator's own Run goes at once. Apart from `paused`: Release resumes the queue, nothing else.
|
|
124
124
|
const projectHolds = new Set();
|
|
125
|
+
// Projects where the operator's "Allow for one run" unblocks a card (Permission-Stop-Plan d3):
|
|
126
|
+
// no autopilot run starts in the gap, or it would take the card without the allowance.
|
|
127
|
+
const allowing = new Set();
|
|
128
|
+
/** Hold off the autopilot while `fn` unblocks and starts a card with its allowance. */
|
|
129
|
+
export async function whileAllowing(project, fn) {
|
|
130
|
+
allowing.add(project);
|
|
131
|
+
try {
|
|
132
|
+
return await fn();
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
allowing.delete(project);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
125
138
|
// The paused projects whose pause the usage limit set: a run that ended paused by it (AD-19).
|
|
126
139
|
const limitPaused = new Set();
|
|
127
140
|
// When the usage limit that paused a project's queue resets, ISO; none when it was not one.
|
|
@@ -252,6 +265,16 @@ const WORD = /^[A-Za-z0-9][\w.-]*$/;
|
|
|
252
265
|
const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
253
266
|
const list = (v) => (Array.isArray(v) ? v : []);
|
|
254
267
|
const pick = (v) => (typeof v === 'string' && WORD.test(v) ? v : null);
|
|
268
|
+
/**
|
|
269
|
+
* The deny rules a run goes without, or null: a short list of one-line rules. Whether each is a
|
|
270
|
+
* rule in force is the harness's check; here only what reaches its command line is bounded.
|
|
271
|
+
*/
|
|
272
|
+
export function allowOf(v) {
|
|
273
|
+
if (!Array.isArray(v) || !v.length || v.length > 8)
|
|
274
|
+
return null;
|
|
275
|
+
const ok = v.every((r) => typeof r === 'string' && r.trim() && r.length <= 200 && !/[\r\n]/.test(r));
|
|
276
|
+
return ok ? v : null;
|
|
277
|
+
}
|
|
255
278
|
/**
|
|
256
279
|
* A queued request as `queue.json` holds it, or null: its ids go to the harness's command line,
|
|
257
280
|
* so each must be an item id; its mode one of the two; its pick plain words.
|
|
@@ -274,6 +297,7 @@ function queuedOf(v) {
|
|
|
274
297
|
mode: v.mode,
|
|
275
298
|
harness: v.harness,
|
|
276
299
|
...(v.fresh === true ? { fresh: true } : {}),
|
|
300
|
+
...(allowOf(v.allow) ? { allow: allowOf(v.allow) } : {}),
|
|
277
301
|
...(v.waitLimit === true ? { waitLimit: true } : {}),
|
|
278
302
|
...(typeof v.waited === 'string' ? { waited: v.waited } : {}),
|
|
279
303
|
...(agent ? { agent } : {}),
|
|
@@ -610,6 +634,8 @@ function spawnRun(q, mode) {
|
|
|
610
634
|
if (q.kind !== 'card') {
|
|
611
635
|
if (q.fresh)
|
|
612
636
|
args.push('--fresh');
|
|
637
|
+
for (const rule of q.allow ?? [])
|
|
638
|
+
args.push('--allow', rule);
|
|
613
639
|
// This run's pick: the items keep their own (Board-V2-Data-Plan §2.5).
|
|
614
640
|
if (model)
|
|
615
641
|
args.push('--model', model);
|
|
@@ -933,8 +959,9 @@ export function busyCheck(p, ids) {
|
|
|
933
959
|
* `fresh` starts new agent sessions where the harness would resume the interrupted ones.
|
|
934
960
|
* `harness` is the domain's (`domain.harness`); the tests take GCF's. Its sessions are open to
|
|
935
961
|
* the operator's chat. `agent`: a model and effort for this run only, over each item's own.
|
|
962
|
+
* `allow`: deny rules in force this run goes without (docs/Permission-Stop-Plan.md, d2).
|
|
936
963
|
*/
|
|
937
|
-
export function startRun(entry, p, ids, mode = 'worktree', fresh = false, harness = 'gcf-harness', agent) {
|
|
964
|
+
export function startRun(entry, p, ids, mode = 'worktree', { fresh = false, harness = 'gcf-harness', agent, allow, } = {}) {
|
|
938
965
|
// A second click on the same card: the harness would refuse it on its lock, noisily.
|
|
939
966
|
paths.set(p.name, p.path);
|
|
940
967
|
busyCheck(p, ids);
|
|
@@ -944,12 +971,13 @@ export function startRun(entry, p, ids, mode = 'worktree', fresh = false, harnes
|
|
|
944
971
|
if (mode === 'main' && (held || going.some((r) => r.mode === 'main'))) {
|
|
945
972
|
queues.set(p.name, [
|
|
946
973
|
...(queues.get(p.name) ?? []),
|
|
947
|
-
{ entry, p, ids, mode, fresh, harness, agent },
|
|
974
|
+
{ entry, p, ids, mode, fresh, harness, agent, ...(allow?.length ? { allow } : {}) },
|
|
948
975
|
]);
|
|
949
976
|
changed(p.name);
|
|
950
977
|
return { queued: ids };
|
|
951
978
|
}
|
|
952
|
-
|
|
979
|
+
const q = { entry, p, ids, mode, fresh, harness, agent, ...(allow?.length ? { allow } : {}) };
|
|
980
|
+
return { started: spawnRun(q, mode) };
|
|
953
981
|
}
|
|
954
982
|
const pilots = new Map();
|
|
955
983
|
// The projects whose autopilot is asking the harness now: one ask at a time.
|
|
@@ -1097,8 +1125,10 @@ export const reserveText = (r) => r?.weekly
|
|
|
1097
1125
|
? "the quota is at its reserve: the automation stands until the week's reset"
|
|
1098
1126
|
: `the quota is at its reserve: the automation waits for the reset${r?.until ? ` at ${r.until}` : ''}`;
|
|
1099
1127
|
/** Whether the project is idle for the autopilot: no run, no queue to go, no pause. */
|
|
1100
|
-
|
|
1128
|
+
/** Whether nothing goes or waits in the project: the autopilot starts only then. */
|
|
1129
|
+
export const idle = (project) => !paused.has(project) &&
|
|
1101
1130
|
!projectHolds.has(project) &&
|
|
1131
|
+
!allowing.has(project) &&
|
|
1102
1132
|
!clickBuilding(project) &&
|
|
1103
1133
|
!activeRuns(project).length &&
|
|
1104
1134
|
!queues.get(project)?.some((q) => !q.waiting);
|
package/dist/server/talks.js
CHANGED
|
@@ -173,7 +173,7 @@ export function talkSpec(p, board, mcp, start = null) {
|
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
175
|
/** A command's output in the project, or empty. */
|
|
176
|
-
const git = (cwd, ...args) => spawnSync('git', args, { cwd, encoding: 'utf8' }).stdout?.trim() ?? '';
|
|
176
|
+
const git = (cwd, ...args) => spawnSync('git', args, { windowsHide: true, cwd, encoding: 'utf8' }).stdout?.trim() ?? '';
|
|
177
177
|
// The most lines of a log or of commits a thread's context gives: it goes into every session.
|
|
178
178
|
const CONTEXT_LINES = 30;
|
|
179
179
|
/** The last lines of a csv log (no header, Harness-PRD §11) whose fields include the id. */
|
|
@@ -493,7 +493,7 @@ function eventsOf(td) {
|
|
|
493
493
|
return chatEvents(path.join(td, 'chat.jsonl'));
|
|
494
494
|
}
|
|
495
495
|
const runs = new Map();
|
|
496
|
-
const NONE = { stamp: '', card: null, end: null, denied: null,
|
|
496
|
+
const NONE = { stamp: '', card: null, end: null, denied: null, rule: null };
|
|
497
497
|
/** A run's chat file's facts, read again only when the file changed. */
|
|
498
498
|
function runChat(file) {
|
|
499
499
|
let stamp = '';
|
|
@@ -517,7 +517,7 @@ function runChat(file) {
|
|
|
517
517
|
card: cardIn(events),
|
|
518
518
|
end,
|
|
519
519
|
denied: lastDenied(events),
|
|
520
|
-
|
|
520
|
+
rule: deniedRuleOf(events),
|
|
521
521
|
};
|
|
522
522
|
runs.set(file, facts);
|
|
523
523
|
return facts;
|
|
@@ -526,8 +526,8 @@ function runChat(file) {
|
|
|
526
526
|
export const chatCard = (file) => runChat(file).card;
|
|
527
527
|
/** How the last run in a run's chat file ended (`run_end`), or null. */
|
|
528
528
|
export const lastRunEnd = (file) => runChat(file).end;
|
|
529
|
-
/** The deny
|
|
530
|
-
export const
|
|
529
|
+
/** The deny rule the last refusal of a run's chat file named (deniedRuleOf), or null. */
|
|
530
|
+
export const deniedRuleIn = (file) => runChat(file).rule;
|
|
531
531
|
/** The last call a deny rule refused in a run's chat file, or null. */
|
|
532
532
|
export const lastDeniedOf = (file) => runChat(file).denied;
|
|
533
533
|
/**
|
|
@@ -547,18 +547,23 @@ export function lastDenied(events) {
|
|
|
547
547
|
}
|
|
548
548
|
/** The events of a chat file: a thread's, or a run's `<id>.chat.jsonl`; none without one. */
|
|
549
549
|
/**
|
|
550
|
-
* The deny
|
|
551
|
-
*
|
|
552
|
-
*
|
|
550
|
+
* The deny rule the last session of a run's chat was refused by, for "Allow <rule> for one run"
|
|
551
|
+
* (docs/Permission-Stop-Plan.md, d3): its last refusal's, none from an older run, none when two
|
|
552
|
+
* rules held (the event names no rule then). Never a rule of a group that guards history or the
|
|
553
|
+
* operator's own moves.
|
|
553
554
|
*/
|
|
554
|
-
export function
|
|
555
|
+
export function deniedRuleOf(events) {
|
|
555
556
|
const start = events.findLastIndex((e) => e.type === 'session' && e.kind === 'start');
|
|
556
|
-
const
|
|
557
|
-
|
|
557
|
+
const last = events
|
|
558
|
+
.slice(Math.max(0, start))
|
|
559
|
+
.findLast((e) => e.type === 'denied' && e.by === 'rule');
|
|
560
|
+
const { rule, group } = (last ?? {});
|
|
561
|
+
if (!rule)
|
|
562
|
+
return null;
|
|
558
563
|
// `run-play`: a run builds by the harness, never by its agent (Play-Setup-Plan d32).
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
564
|
+
if (group && ['git-history', 'git-destroy', 'human-moves', 'run-play'].includes(group))
|
|
565
|
+
return null;
|
|
566
|
+
return group ? { rule, group } : { rule };
|
|
562
567
|
}
|
|
563
568
|
export function chatEvents(file) {
|
|
564
569
|
let text = '';
|
|
@@ -836,6 +841,8 @@ async function talkOf(p, th, ids, questionOf) {
|
|
|
836
841
|
start: th.start?.id ?? null,
|
|
837
842
|
created_at: th.created_at,
|
|
838
843
|
last_at: events.at(-1)?.at ?? null,
|
|
844
|
+
// A close, a limit or a session's end is no use of it (Board-Use-Plan d4).
|
|
845
|
+
used_at: events.findLast((e) => e.type === 'say' || e.type === 'agent')?.at ?? th.created_at,
|
|
839
846
|
cost_usd: Math.round(cost * 100) / 100,
|
|
840
847
|
model: pick.model ?? null,
|
|
841
848
|
effort: pick.effort ?? null,
|
|
@@ -849,7 +856,7 @@ async function talkOf(p, th, ids, questionOf) {
|
|
|
849
856
|
};
|
|
850
857
|
}
|
|
851
858
|
/**
|
|
852
|
-
* The project's threads,
|
|
859
|
+
* The project's threads, the last used first (`used_at`); with `item`, its bound one only. `ids()` reads the
|
|
853
860
|
* board's items when a proposal needs settling; `questionOf` the question an answer proposal
|
|
854
861
|
* answers, when it is first seen.
|
|
855
862
|
*/
|
|
@@ -858,7 +865,8 @@ export async function listTalks(p, ids, item, questionOf) {
|
|
|
858
865
|
// One board read at most, and only when a proposal needs it.
|
|
859
866
|
let read = null;
|
|
860
867
|
const once = () => (read ??= ids());
|
|
861
|
-
|
|
868
|
+
const talks = await Promise.all(threads.map((th) => talkOf(p, th, once, questionOf)));
|
|
869
|
+
return talks.sort((a, b) => b.used_at.localeCompare(a.used_at));
|
|
862
870
|
}
|
|
863
871
|
/** Where a thread's input is read to, and how far it is written. */
|
|
864
872
|
function unread(td) {
|
package/dist/shared/board.js
CHANGED
|
@@ -59,3 +59,48 @@ export function moveOfTool(moves, raw) {
|
|
|
59
59
|
const keys = Object.keys(moves).filter((k) => toolOf(k) === tool);
|
|
60
60
|
return keys.find((k) => moves[k].propose) ?? (Object.hasOwn(moves, raw) ? raw : keys[0]) ?? null;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* A selection of the chat as a Markdown quote: `> ` before each of its lines, an empty line
|
|
64
|
+
* after it, so the reply starts below.
|
|
65
|
+
*/
|
|
66
|
+
export function quoted(sel) {
|
|
67
|
+
const lines = sel
|
|
68
|
+
.replace(/\r\n?/g, '\n')
|
|
69
|
+
.replace(/^\n+|\n+$/g, '')
|
|
70
|
+
.split('\n');
|
|
71
|
+
return `${lines.map((l) => (l ? `> ${l}` : '>')).join('\n')}\n\n`;
|
|
72
|
+
}
|
|
73
|
+
// A reply to an agent's message (Board-Use-Plan d1): the board server writes it into the text
|
|
74
|
+
// after the operator's words, so every way in (a run, a thread, the queue, a fresh session) carries it.
|
|
75
|
+
const REPLY_HEAD = (at) => `[in reply to the agent's message of ${at}]`;
|
|
76
|
+
const REPLY_LINE = /^\[in reply to the agent's message of (\d{4}-\d\d-\d\dT[\d:.]+Z)\]$/gm;
|
|
77
|
+
/** The longest part of the agent's text a reply quotes. */
|
|
78
|
+
export const REPLY_QUOTE_MAX = 2000;
|
|
79
|
+
/**
|
|
80
|
+
* The block a reply adds to the operator's words: its head, then the agent's text quoted, cut to
|
|
81
|
+
* REPLY_QUOTE_MAX and to `room` characters of the whole block.
|
|
82
|
+
*/
|
|
83
|
+
export function replyBlock(at, text, room = Infinity) {
|
|
84
|
+
const head = `\n\n${REPLY_HEAD(at)}\n`;
|
|
85
|
+
let take = Math.min(REPLY_QUOTE_MAX, text.length);
|
|
86
|
+
for (;;) {
|
|
87
|
+
const part = text.slice(0, take).trimEnd();
|
|
88
|
+
const block = `${head}${quoted(take < text.length ? `${part} …` : part).trimEnd()}`;
|
|
89
|
+
if (block.length <= room)
|
|
90
|
+
return block;
|
|
91
|
+
// No room for even its head: the words go without the link rather than be refused.
|
|
92
|
+
if (take === 0)
|
|
93
|
+
return '';
|
|
94
|
+
take = Math.max(0, take - (block.length - room));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** A message's last reply marker: the agent message it answers, and the text without its line. */
|
|
98
|
+
export function replyOf(text) {
|
|
99
|
+
const last = [...text.matchAll(REPLY_LINE)].at(-1);
|
|
100
|
+
if (!last || last.index === undefined)
|
|
101
|
+
return { at: null, text };
|
|
102
|
+
return {
|
|
103
|
+
at: last[1],
|
|
104
|
+
text: text.slice(0, last.index) + text.slice(last.index + last[0].length + 1),
|
|
105
|
+
};
|
|
106
|
+
}
|