gcf-board 0.34.0 → 0.36.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 +7 -2
- package/dist/server/app.js +66 -7
- package/dist/server/moves.js +7 -3
- package/dist/server/propose.js +23 -5
- package/dist/server/talks.js +29 -4
- package/dist/shared/board.js +1 -1
- package/dist/web/assets/index-Blx3Arwz.css +1 -0
- package/dist/web/assets/index-CGnD6bzB.js +131 -0
- package/dist/web/index.html +2 -2
- package/node_modules/gcf-session/lib/job.js +20 -10
- package/node_modules/gcf-session/lib/wake.js +6 -3
- package/node_modules/gcf-session/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/web/assets/index-Fq42leVT.css +0 -1
- package/dist/web/assets/index-WMT9LmvP.js +0 -124
package/README.md
CHANGED
|
@@ -6,8 +6,10 @@ 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.36: `gcf-aif-ext` ≥ 0.36 for the Plan and Implement model and effort of a card and in Settings (`agent.phase_defaults`; Inherit options) and the plan review's findings on the plan tab and the stall; an older core hides the phase rows. `gcf-harness-aif-ext` ≥ 0.35 writes `run_end.plan`
|
|
10
|
+
- for 0.35: `gcf-aif-ext` ≥ 0.35 (`gcf board --json` with `schema: 7`; the board refuses an older core's schema, and an older board refuses this core's) for the lessons review, the manual strip, the Rules screen and the Changes mark; `gcf-harness-aif-ext` ≥ 0.34 for the Run ended mark (an older harness writes no `run_end.instructions`). Then run `ai-factory gcf init` in the project (the `AGENTS.md` block changed)
|
|
9
11
|
- for 0.34: `gcf-aif-ext` ≥ 0.34 for an assumption that came due: an unanswered D2 whose trigger fired, or one of `manual(...)` or no trigger unanswered past `question_stale_after_commits`, comes with `category: decision` and stands among the decisions (Waiting for me, Needs you, the Design screen's Questions), its head saying "trigger fired: <until>" or "unanswered for N commits"; answer it with **Overrule**. Then run `ai-factory gcf init` in the project (the `AGENTS.md` block changed). An older core keeps every D2 folded among the assumptions
|
|
10
|
-
- for 0.33: `gcf-aif-ext` ≥ 0.33 for a move that waits behind a card's main run: a
|
|
12
|
+
- for 0.33: `gcf-aif-ext` ≥ 0.33 for a move that waits behind a card's main run: a dialog closes by itself with a "Waits behind <card>" toast and its answer comes as a toast later, a chat proposal, a question's answer or a Commit under a refusal shows "Waits behind <card>" with **Cancel** in place, the top bar a pill per waiting move (`runs.moves_waiting`, read from `.gcf-session/waiting/`, so it holds over a board restart). "Allow for one run" behind a main run queues its unblock with the start, with any core. A session's or a thread's move is still refused. An older core refuses the move as before
|
|
11
13
|
- for 0.32: `gcf-aif-ext` ≥ 0.32 (`gcf board --json` with `schema: 6`; the board refuses an older core's schema, and an older board refuses this core's) and `gcf-harness-aif-ext` ≥ 0.31 for the review stand-ins and `run_mode: main` by default
|
|
12
14
|
- for 0.25: `gcf-aif-ext` ≥ 0.27 for **Push** and **Pull** on Changes and the header's `↑N` (an older core shows no strip)
|
|
13
15
|
- for 0.23: `gcf-aif-ext` ≥ 0.25 and `gcf-harness-aif-ext` ≥ 0.24 for **Play** (an older core shows no bar)
|
|
@@ -43,7 +45,7 @@ It puts **GCF Board** on the desktop (Windows: a shortcut whose server console s
|
|
|
43
45
|
|
|
44
46
|
## What it does
|
|
45
47
|
|
|
46
|
-
The board knows no domain by name: the project's board read gives its columns, moves with their forms, item fields, blocks and Help terms (`domain`, Board-PRD decision 16). The page follows design B (`docs/design/mockup`): a left nav with the project switcher (add a project, take one off the board), the screens **Command**, **Board**, **Chat**, **Inbox**, **Design**, **Runs**, **Playtest**, **Ended**, **Agent** and **Metrics** (a domain without a block has no screen for it, a project without a harness no Runs and no Metrics), and a header with the phase, the runs, the limit wait, the quota, WIP, the release, **waiting for me**, **+ item**, the gear (**Settings**, a dialog over the screen; on a phone in More) and **?**. The project and the screen are in the URL hash. On a phone a bottom bar holds Command, Board, Chat, Inbox and More. When the server is gone, the page says so and reconnects by itself. For a GCF project:
|
|
48
|
+
The board knows no domain by name: the project's board read gives its columns, moves with their forms, item fields, blocks and Help terms (`domain`, Board-PRD decision 16). The page follows design B (`docs/design/mockup`): a left nav with the project switcher (add a project, take one off the board), the screens **Command**, **Board**, **Chat**, **Inbox**, **Design**, **Runs**, **Playtest**, **Ended**, **Agent**, **Rules** and **Metrics** (a domain without a block has no screen for it, a project without a harness no Runs and no Metrics), and a header with the phase, the runs, the limit wait, the quota, WIP, the release, **waiting for me**, **+ item**, the gear (**Settings**, a dialog over the screen; on a phone in More) and **?**. The project and the screen are in the URL hash. On a phone a bottom bar holds Command, Board, Chat, Inbox and More. When the server is gone, the page says so and reconnects by itself. For a GCF project:
|
|
47
49
|
|
|
48
50
|
- **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.
|
|
49
51
|
- **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.
|
|
@@ -82,6 +84,9 @@ The board knows no domain by name: the project's board read gives its columns, m
|
|
|
82
84
|
- **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.
|
|
83
85
|
- **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.
|
|
84
86
|
- **Lessons** (core 0.7.10, harness 0.9.2): what got in an agent's way, asked at the end of each session, lands in the inbox as the category Lesson, its kind (`tool`, `rules`, `framework`, `template`, `other`) the detail, with its item. The inbox filters them; a card shows `N lessons`, and the item's **Lessons** tab lists them with the inbox's buttons. A run's report line ends with `, N lessons`, and with `— code written outside aif-implement` when a session skipped that skill.
|
|
87
|
+
- **Lessons review** (board 0.35.0, core 0.35.0, harness 0.34.0; Board-PRD decision 66): **Review lessons (N)** in the head of Agent feedback and **Review these** on a repeated lesson's line start a project chat thread (start `lessons-review`, skill gcf-triage) whose agent groups the lessons by cause and proposes one outcome a group: a new item or an amend from the group (`from` a list), a rule (`rules add`), a report to GCF or the template (`lessons report`, a file in `~/.gcf/lessons/`), an erase with its reason, Later. Its agent may not edit `AGENTS.md`, `CLAUDE.md`, `.claude/` or `.ai-factory/`, YOLO or not. A card lists the entries it erases by their titles; a rule's and a report's card show their dry run first (`POST /api/p/<project>/move/preview`: a move with `preview` and no target, its `--dry-run --json`). **Next** under the agent's message asks for the next groups. Without an agent: filter the inbox by Lesson, tick a group, and **→ Item**, **→ Rule**, **Report ▾**, **Erase ▾** (done, duplicate, noise; it goes at once with that reason, no `of`, no confirm) or **Later**. A proposal whose move takes `--proposal` (`proposal_trailer`) is recovered after a board restart only by its own `GCF-Proposal` commit. The board passes its version to the core as `GCF_BOARD_VERSION` (a report names it).
|
|
88
|
+
- **Rules** (board 0.35.0, core 0.35.0): `AGENTS.md` and `CLAUDE.md` as the agent reads them (`GET /api/p/<project>/rules`, `gcf rules --json`): the text before and after GCF's block in text areas, the block folded and read-only, the size in bytes and about tokens, a note when a file has edits not committed; **Save…** shows the diff from HEAD and commits `gcf rules save --base`, refused when the file changed since the edits began; **Discard edits** reads it again. The screen shows with a core that has the move `rules-save`.
|
|
89
|
+
- **The instructions mark** (harness 0.34.0, core 0.35.0): a run whose commits changed the agent's instructions says so on its Run ended card, "changed the agent's instructions: AGENTS.md", with **Show diff** (`GET /api/p/<project>/rules/diff?from=&to=`, `gcf rules diff`, hex hashes only); Changes marks such files `agent instructions`, whoever wrote them. Only a reminder.
|
|
85
90
|
- **Playtest**: `gcf playtest session` with the checklist grouped by subsystem; keep, tune or kill each item from the list. Each card has its own **Play** bar. A note goes to the inbox as `--category playtest`.
|
|
86
91
|
- **Ended**: history (accepted) and graveyard (killed, dropped, won't-fix); a line opens the item's History.
|
|
87
92
|
- **Metrics**: `gcf-harness metrics --json` of the project — how many runs reached submit or close, what they cost, handoffs, plan checks, DoD attempts, guard firings, block reasons — and, with harness 0.9.5, the cost per item over all its runs and per week and day.
|
package/dist/server/app.js
CHANGED
|
@@ -26,7 +26,7 @@ import { addProject, homeDir, listProjects, projectOf, removeProject, yoloFile,
|
|
|
26
26
|
import { allThemes } from './themes.js';
|
|
27
27
|
import { askIfDue, askUsage, configureUsage, lastUsage } from './usage.js';
|
|
28
28
|
import { activeRuns, adoptRuns, busyCheck, keepProjects, mainTaken, sweepRuns, closeReport, forgetProject, resumeQueue, holdProject, retryWaiting, runsOf, setAutopilot, setUnblocker, startRun, allowOf, whileAllowing, unqueue, ticketState, watchTickets, } from './runs.js';
|
|
29
|
-
import { acceptProposal, agentDefaults, agentPresets, chatCard, deniedRuleIn, lastDeniedOf, lastRunEnd, chatOf, entryTalk, listTalks, openTalk, pickTalk, prepareTalk, proposalTag, startDesign, startTalk, stopTalk, wakeTalk, talkEntry, talkId, talkLive, talkPending, talkSaid, talkWaits, watchTalks, writeTalk, } from './talks.js';
|
|
29
|
+
import { acceptProposal, agentDefaults, agentPresets, runDefaults, chatCard, deniedRuleIn, lastDeniedOf, lastRunEnd, chatOf, entryTalk, listTalks, openTalk, pickTalk, prepareTalk, proposalTag, startDesign, startTalk, stopTalk, wakeTalk, talkEntry, talkId, talkLive, talkPending, talkSaid, talkWaits, watchTalks, writeTalk, } from './talks.js';
|
|
30
30
|
import { accountSettings, saveAccountSettings, threadDir, threadOfEntry } from 'gcf-session';
|
|
31
31
|
const send = (res, status, body) => {
|
|
32
32
|
res.writeHead(status, { 'content-type': 'application/json; charset=utf-8' });
|
|
@@ -315,7 +315,12 @@ export function createApp(o) {
|
|
|
315
315
|
adoptRuns(o.entry, p);
|
|
316
316
|
}
|
|
317
317
|
};
|
|
318
|
-
|
|
318
|
+
// GCF_BOARD_VERSION: the board's version for what the core writes of it (a lessons report, d5);
|
|
319
|
+
// an older core reads no such variable.
|
|
320
|
+
const cli = (p, args, timeout, input, env) => runCli(o.entry, p.path, args, timeout, input, {
|
|
321
|
+
...(o.version && { GCF_BOARD_VERSION: o.version }),
|
|
322
|
+
...env,
|
|
323
|
+
});
|
|
319
324
|
// This board's moves going now, tag → project folder: a board that stops cancels the ones
|
|
320
325
|
// waiting behind a main run (Main-Run-Moves-Plan d9), none goes on with no page to tell.
|
|
321
326
|
const ownMoves = new Map();
|
|
@@ -534,6 +539,7 @@ export function createApp(o) {
|
|
|
534
539
|
usage: lastUsage(),
|
|
535
540
|
presets: agentPresets(),
|
|
536
541
|
defaults: agentDefaults(),
|
|
542
|
+
run_defaults: runDefaults(),
|
|
537
543
|
// What a review row offers, and which review CLIs answer (Operator-Tasks-Plan t2 d5).
|
|
538
544
|
review_presets: reviewPresets().presets,
|
|
539
545
|
providers: reviewPresets().providers,
|
|
@@ -974,7 +980,9 @@ export function createApp(o) {
|
|
|
974
980
|
// A proposal of a Draft thread makes the entry's item (Board-V2-Data-Plan §2.7): the
|
|
975
981
|
// entry goes with it while it is there; a second proposal, or one after it went, has none.
|
|
976
982
|
const proposal = (body.proposal ?? {});
|
|
977
|
-
|
|
983
|
+
// An empty list names no entry: the thread's own goes in its place.
|
|
984
|
+
const named = Array.isArray(body.from) ? body.from.length > 0 : body.from !== undefined;
|
|
985
|
+
if (typeof proposal.talk === 'string' && !named) {
|
|
978
986
|
// A thread that is not there has no entry: acceptProposal says it is not there.
|
|
979
987
|
const entry = existsSync(threadDir(p.path, talkId(proposal.talk)))
|
|
980
988
|
? talkEntry(p, proposal.talk)
|
|
@@ -983,7 +991,7 @@ export function createApp(o) {
|
|
|
983
991
|
if (board &&
|
|
984
992
|
board.domain.new_item === body.cmd &&
|
|
985
993
|
board.inbox?.some((e) => e.id === entry))
|
|
986
|
-
body.from = entry;
|
|
994
|
+
body.from = [entry];
|
|
987
995
|
}
|
|
988
996
|
let args = moveArgs(body, domain?.moves);
|
|
989
997
|
const run = (tag) => tagged(p, tag, args, moveInput(body, domain?.moves));
|
|
@@ -1011,10 +1019,14 @@ export function createApp(o) {
|
|
|
1011
1019
|
return;
|
|
1012
1020
|
}
|
|
1013
1021
|
body.id = dry.out.trim().split(/\s/)[0];
|
|
1014
|
-
|
|
1015
|
-
args = [...withItemId(args, String(body.id)), `--proposal=${talk}/${id}`];
|
|
1022
|
+
args = withItemId(args, String(body.id));
|
|
1016
1023
|
}
|
|
1017
|
-
|
|
1024
|
+
// Its commit names the proposal (a move that takes it, schema 7): a recovery finds
|
|
1025
|
+
// the move by it, a new item told from another's of one id.
|
|
1026
|
+
const spec = domain?.moves[String(body.cmd)];
|
|
1027
|
+
const mark = spec?.proposal_trailer ? `${talk}/${id}` : undefined;
|
|
1028
|
+
if (mark)
|
|
1029
|
+
args = [...args, `--proposal=${mark}`];
|
|
1018
1030
|
const item = typeof body.id === 'string' ? body.id : '';
|
|
1019
1031
|
const read = await boardOf(p);
|
|
1020
1032
|
const ids = idsOf(read);
|
|
@@ -1068,6 +1080,53 @@ export function createApp(o) {
|
|
|
1068
1080
|
send(res, 200, jsonOf(r, 'item amend --dry-run'));
|
|
1069
1081
|
},
|
|
1070
1082
|
],
|
|
1083
|
+
[
|
|
1084
|
+
// What a move with `preview` and no target would do (Lessons-Review-Plan d7): its own args,
|
|
1085
|
+
// `--dry-run --json` in place of `--commit` (a rule's diff, a report's files).
|
|
1086
|
+
'POST',
|
|
1087
|
+
/^\/api\/p\/([^/]+)\/move\/preview$/,
|
|
1088
|
+
async (req, res, m) => {
|
|
1089
|
+
const p = await projectOf(m[1]);
|
|
1090
|
+
const b = await bodyOf(req, CHAT_BODY_MAX);
|
|
1091
|
+
const { moves } = domains.get(p.name) ?? (await boardOf(p)).domain;
|
|
1092
|
+
const spec = moves[String(b.cmd)];
|
|
1093
|
+
if (!Object.hasOwn(moves, String(b.cmd)) || !spec.preview)
|
|
1094
|
+
throw new HttpError(404, `${String(b.cmd)} has no preview`);
|
|
1095
|
+
const args = [...moveArgs(b, moves).filter((a) => a !== '--commit'), '--dry-run', '--json'];
|
|
1096
|
+
const r = await cli(p, args, undefined, moveInput(b, moves));
|
|
1097
|
+
if (!r.ok)
|
|
1098
|
+
throw new HttpError(400, briefError(r.err || r.out));
|
|
1099
|
+
send(res, 200, jsonOf(r, `${String(b.cmd)} --dry-run`));
|
|
1100
|
+
},
|
|
1101
|
+
],
|
|
1102
|
+
[
|
|
1103
|
+
// The agent's instruction files for the Rules screen (Lessons-Review-Plan d8): `gcf rules`.
|
|
1104
|
+
'GET',
|
|
1105
|
+
/^\/api\/p\/([^/]+)\/rules$/,
|
|
1106
|
+
async (_req, res, m) => {
|
|
1107
|
+
const p = await projectOf(m[1]);
|
|
1108
|
+
const r = await cli(p, ['gcf', 'rules', '--json']);
|
|
1109
|
+
if (!r.ok)
|
|
1110
|
+
throw new HttpError(400, briefError(r.err || r.out));
|
|
1111
|
+
send(res, 200, jsonOf(r, 'gcf rules'));
|
|
1112
|
+
},
|
|
1113
|
+
],
|
|
1114
|
+
[
|
|
1115
|
+
// What a run changed in the agent's instructions (Lessons-Review-Plan d9): `gcf rules diff`
|
|
1116
|
+
// of its run end's `from..to`, hex only (the core refuses any other word too).
|
|
1117
|
+
'GET',
|
|
1118
|
+
/^\/api\/p\/([^/]+)\/rules\/diff$/,
|
|
1119
|
+
async (_req, res, m, url) => {
|
|
1120
|
+
const p = await projectOf(m[1]);
|
|
1121
|
+
const [from, to] = ['from', 'to'].map((k) => url.searchParams.get(k) ?? '');
|
|
1122
|
+
if (![from, to].every((x) => /^[0-9a-f]{4,64}$/i.test(x)))
|
|
1123
|
+
throw new HttpError(400, 'from and to are commit hashes, hex only');
|
|
1124
|
+
const r = await cli(p, ['gcf', 'rules', 'diff', `--from=${from}`, `--to=${to}`, '--json']);
|
|
1125
|
+
if (!r.ok)
|
|
1126
|
+
throw new HttpError(400, briefError(r.err || r.out));
|
|
1127
|
+
send(res, 200, jsonOf(r, 'gcf rules diff'));
|
|
1128
|
+
},
|
|
1129
|
+
],
|
|
1071
1130
|
[
|
|
1072
1131
|
// The hand edits a `dirty` refusal names (core 0.20): the staged part and the part not
|
|
1073
1132
|
// staged, read by `gcf edits diff`. Paths under gcf/ only, as the refusal gives them.
|
package/dist/server/moves.js
CHANGED
|
@@ -56,6 +56,8 @@ const idList = (b, key, flag = key) => list(b, key, SLUG, 'ids', flag);
|
|
|
56
56
|
const tagList = (b, key, flag = key) => list(b, key, TAG, 'tags', flag);
|
|
57
57
|
/** `--remove` / `--no-remove` when the operator chose; the command's default otherwise. */
|
|
58
58
|
const remove = (b, key = 'remove', flag = key) => b[key] === true ? [`--${flag}`] : b[key] === false ? [`--no-${flag}`] : [];
|
|
59
|
+
// A config key of up to three levels: `agent.plan.effort` (Plan-Review-Rework-Plan d10).
|
|
60
|
+
const CONFIG_KEY = /^[a-z_]+(\.[a-z_]+){0,2}$/;
|
|
59
61
|
const MOVES = {
|
|
60
62
|
// A session's mark taken off: the item no longer shows running (Board-PRD §3.2, kind c).
|
|
61
63
|
release: (b) => ['release', id(b)],
|
|
@@ -63,7 +65,7 @@ const MOVES = {
|
|
|
63
65
|
// a number back to its default.
|
|
64
66
|
'config-set': (b) => {
|
|
65
67
|
const key = b.key;
|
|
66
|
-
if (typeof key !== 'string' ||
|
|
68
|
+
if (typeof key !== 'string' || !CONFIG_KEY.test(key))
|
|
67
69
|
throw new HttpError(400, 'key must be a config key');
|
|
68
70
|
// A missing value is a mistake, not a reset: only an empty one takes the default back.
|
|
69
71
|
const v = b.value;
|
|
@@ -79,7 +81,7 @@ const MOVES = {
|
|
|
79
81
|
if (typeof pairs !== 'object' || pairs === null || Array.isArray(pairs))
|
|
80
82
|
throw new HttpError(400, 'pairs must map config keys to values');
|
|
81
83
|
const args = Object.entries(pairs).map(([key, v]) => {
|
|
82
|
-
if (
|
|
84
|
+
if (!CONFIG_KEY.test(key))
|
|
83
85
|
throw new HttpError(400, 'key must be a config key');
|
|
84
86
|
// A list (`no_diff`) goes as its lines: Settings saves every key at once (t3 d6).
|
|
85
87
|
if (typeof v !== 'string')
|
|
@@ -140,7 +142,9 @@ function fieldArgs(f, b) {
|
|
|
140
142
|
return tagList(b, f.key, flag);
|
|
141
143
|
if (f.kind === 'choice')
|
|
142
144
|
return choice(f, b, flag);
|
|
143
|
-
// Its text goes on stdin (moveInput): the file `-`.
|
|
145
|
+
// Its text goes on stdin (moveInput): the file `-`. With `clear`, an empty text is a text too.
|
|
146
|
+
if (f.stdin && f.clear && typeof b[f.key] === 'string')
|
|
147
|
+
return [`--${flag}-file=-`];
|
|
144
148
|
if (f.stdin)
|
|
145
149
|
return (f.required ? required(b, f.key) : text(b, f.key)) ? [`--${flag}-file=-`] : [];
|
|
146
150
|
if (f.clear && b[f.key] === '')
|
package/dist/server/propose.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The agent's proposals (docs/Session-Engine.md AD-12, AD-36): a tool of the center's MCP server
|
|
2
2
|
// for each domain move with `propose`, `propose_<key>` (`-` and `:` as `_`). Its input schema is
|
|
3
3
|
// built from the move's form: no hidden field, no model or effort, the run's own; a move on an
|
|
4
|
-
// item, an inbox entry or a question also takes its `id`. The schema says what
|
|
4
|
+
// item, an inbox entry or a question also takes its `id`, one on several (`{ids}`) their `ids`. The schema says what
|
|
5
5
|
// it can (types, choices, lengths, what is always required); `checkProposal` the rest (a field
|
|
6
6
|
// that goes only with another's value, the defaults).
|
|
7
7
|
import { toolOf } from '../shared/board.js';
|
|
@@ -9,14 +9,25 @@ export { toolOf };
|
|
|
9
9
|
/** The fields of a run an agent does not choose: the operator's run settings. */
|
|
10
10
|
const NOT_PROPOSED = new Set(['model', 'effort']);
|
|
11
11
|
const SLUG = '^[a-z0-9]+(-[a-z0-9]+)*$';
|
|
12
|
+
const SLUG_RE = new RegExp(SLUG);
|
|
12
13
|
const TAG = '^[a-z0-9][a-z0-9:-]{0,39}$';
|
|
14
|
+
/** Whether an agent fills field `f`: not one the form fills unless it says so, nor the run's. */
|
|
15
|
+
const proposable = (f) => (!f.hidden || f.propose === true) && !NOT_PROPOSED.has(f.key);
|
|
13
16
|
/** The fields an agent may propose: the form's, without the hidden ones and the run's. */
|
|
14
|
-
export const proposed = (spec) => spec.fields.filter(
|
|
17
|
+
export const proposed = (spec) => spec.fields.filter(proposable);
|
|
15
18
|
/**
|
|
16
19
|
* Whether a move acts on an item, an inbox entry or a question already there (`{id}` in its
|
|
17
20
|
* words, no field of its own names it): the agent names it in `id`.
|
|
18
21
|
*/
|
|
19
22
|
export const targeted = (spec) => spec.args.includes('{id}') && !spec.fields.some((f) => f.key === 'id');
|
|
23
|
+
/** Whether a move acts on several already there (`{ids}`): the agent names them in `ids`. */
|
|
24
|
+
export const targetsMany = (spec) => spec.args.includes('{ids}') && !spec.fields.some((f) => f.key === 'ids');
|
|
25
|
+
const TARGETS = {
|
|
26
|
+
type: 'array',
|
|
27
|
+
items: { type: 'string', pattern: SLUG },
|
|
28
|
+
minItems: 1,
|
|
29
|
+
description: 'The ids it acts on: the inbox entries for an inbox move, else the items.',
|
|
30
|
+
};
|
|
20
31
|
const TARGET = {
|
|
21
32
|
type: 'string',
|
|
22
33
|
pattern: SLUG,
|
|
@@ -77,14 +88,17 @@ export function fieldSchema(f) {
|
|
|
77
88
|
export function toolSchema(spec) {
|
|
78
89
|
const fields = proposed(spec);
|
|
79
90
|
const target = targeted(spec);
|
|
91
|
+
const many = targetsMany(spec);
|
|
80
92
|
return {
|
|
81
93
|
type: 'object',
|
|
82
94
|
properties: {
|
|
83
95
|
...(target && { id: TARGET }),
|
|
96
|
+
...(many && { ids: TARGETS }),
|
|
84
97
|
...Object.fromEntries(fields.map((f) => [f.key, fieldSchema(f)])),
|
|
85
98
|
},
|
|
86
99
|
required: [
|
|
87
100
|
...(target ? ['id'] : []),
|
|
101
|
+
...(many ? ['ids'] : []),
|
|
88
102
|
...fields.filter((f) => f.required && !f.when).map((f) => f.key),
|
|
89
103
|
],
|
|
90
104
|
additionalProperties: false,
|
|
@@ -101,15 +115,19 @@ export function checkProposal(spec, args) {
|
|
|
101
115
|
const values = Object.fromEntries(spec.fields.filter((f) => f.default !== undefined).map((f) => [f.key, f.default]));
|
|
102
116
|
const problems = [];
|
|
103
117
|
const target = targeted(spec);
|
|
104
|
-
if (target && (typeof args.id !== 'string' || !
|
|
118
|
+
if (target && (typeof args.id !== 'string' || !SLUG_RE.test(args.id)))
|
|
105
119
|
problems.push('id is required: the item, inbox entry or question it acts on');
|
|
120
|
+
const many = targetsMany(spec);
|
|
121
|
+
const slugs = (v) => Array.isArray(v) && v.length > 0 && v.every((x) => typeof x === 'string' && SLUG_RE.test(x));
|
|
122
|
+
if (many && !slugs(args.ids))
|
|
123
|
+
problems.push('ids is required: the inbox entries or items it acts on, one or more');
|
|
106
124
|
for (const [key, v] of Object.entries(args)) {
|
|
107
125
|
const f = fields.get(key);
|
|
108
|
-
if (target && key === 'id')
|
|
126
|
+
if ((target && key === 'id') || (many && key === 'ids'))
|
|
109
127
|
continue;
|
|
110
128
|
if (!f)
|
|
111
129
|
problems.push(`${key} is not a field of this move`);
|
|
112
|
-
else if (f
|
|
130
|
+
else if (!proposable(f))
|
|
113
131
|
problems.push(`${key} is the operator's to set, not proposed`);
|
|
114
132
|
else if (given(v))
|
|
115
133
|
values[key] = v;
|
package/dist/server/talks.js
CHANGED
|
@@ -38,6 +38,14 @@ const OWN_FILES = ['.claude/**', 'CLAUDE.md', 'AGENTS.md', '.ai-factory/**'].map
|
|
|
38
38
|
export const agentPresets = () => presetsOf(process.env.GCF_SESSION_AGENT ?? DEFAULT_AGENT);
|
|
39
39
|
/** What a thread or a run runs on when neither it nor the project picks (decision 36). */
|
|
40
40
|
export const agentDefaults = () => defaultsOf(process.env.GCF_SESSION_AGENT ?? DEFAULT_AGENT);
|
|
41
|
+
/**
|
|
42
|
+
* The defaults of the agent a run of this board launches: the harness's `--agent` default, as
|
|
43
|
+
* the board spawns it with its own environment (Plan-Review-Rework-Plan d10). GCF's phase default
|
|
44
|
+
* sets only a flag these have.
|
|
45
|
+
* shortcut: read at the board read, not at the run; a GCF_RUN_AGENT changed in between is not
|
|
46
|
+
* seen; pass the run's agent along if a board ever starts runs with another one.
|
|
47
|
+
*/
|
|
48
|
+
export const runDefaults = () => defaultsOf(process.env.GCF_SESSION_AGENT ?? process.env.GCF_RUN_AGENT ?? DEFAULT_AGENT);
|
|
41
49
|
/**
|
|
42
50
|
* Pick thread `t`'s model and effort (`default` or none: the project's setting, else the agent's default); its next session
|
|
43
51
|
* takes them. A word that is not plain is a 400.
|
|
@@ -146,6 +154,8 @@ export function talkSpec(p, board, mcp, start = null) {
|
|
|
146
154
|
...rules.deny.filter((r) => !r.run_only),
|
|
147
155
|
{ kind: 'edit', pattern: '.gcf-session/**' },
|
|
148
156
|
...homeRules(),
|
|
157
|
+
// The start's own (a lessons review's: no edit of the agent's instructions).
|
|
158
|
+
...(own?.deny ?? []),
|
|
149
159
|
],
|
|
150
160
|
// Claude holds ask over allow: the blanket edit ask would shadow the start's edits. The
|
|
151
161
|
// agent's own instructions and settings still ask, whatever the project allows. A start
|
|
@@ -391,9 +401,13 @@ export function designTalk(p, board, start, given) {
|
|
|
391
401
|
const systems = board.design && !('error' in board.design) ? board.design.systems : {};
|
|
392
402
|
if (s.takes === 'system' && !Object.hasOwn(systems, given.system ?? ''))
|
|
393
403
|
throw new HttpError(400, `${start} takes a subsystem of the design: ${String(given.system)}`);
|
|
394
|
-
const text =
|
|
404
|
+
const text = s.entries
|
|
405
|
+
? entriesOf(board, s.entries, String(given.text ?? ''))
|
|
406
|
+
: String(given.text ?? '').trim();
|
|
395
407
|
if (s.takes === 'text' && !text)
|
|
396
|
-
throw new HttpError(400,
|
|
408
|
+
throw new HttpError(400, s.entries
|
|
409
|
+
? `${start} takes inbox entries of category ${s.entries}: none of these is one`
|
|
410
|
+
: `${start} takes the change in words`);
|
|
397
411
|
const t = createThread(p.path, { start: { id: start } });
|
|
398
412
|
let file = '';
|
|
399
413
|
if (given.file && name) {
|
|
@@ -417,6 +431,14 @@ export function designTalk(p, board, start, given) {
|
|
|
417
431
|
.replaceAll('{text}', () => text);
|
|
418
432
|
return { id: t, say };
|
|
419
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* The ids of `asked` (comma or space separated) that are inbox entries of `category` on the
|
|
436
|
+
* board, each once, as `in-a, in-b`: an id the page sent of another kind, or gone, is left out.
|
|
437
|
+
*/
|
|
438
|
+
export function entriesOf(board, category, asked) {
|
|
439
|
+
const of = new Set((board.inbox ?? []).filter((e) => e.category === category).map((e) => e.id));
|
|
440
|
+
return [...new Set(asked.split(/[\s,]+/).filter((id) => of.has(id)))].join(', ');
|
|
441
|
+
}
|
|
420
442
|
/**
|
|
421
443
|
* Design start `start` (designTalk), its first message sent by `send`: the thread's id. A send
|
|
422
444
|
* that fails takes the thread away with it, so no empty thread stays in the list.
|
|
@@ -749,11 +771,14 @@ async function settled(td, id, rec, ids, mine = false) {
|
|
|
749
771
|
const ours = !rec.mark ||
|
|
750
772
|
git(projectDir, 'log', '-1', '--format=%H', `--grep=^GCF-Proposal: ${rec.mark}$`) !== '';
|
|
751
773
|
// A new item: there now and not before, by its own commit. A move on what is already there
|
|
752
|
-
// (an item, a question): its commit since the HEAD the record kept, by the trailers.
|
|
774
|
+
// (an item, a question): its commit since the HEAD the record kept, by the trailers. A marked
|
|
775
|
+
// move on what is there (an amend, a group of entries): only its own commit says so; entries
|
|
776
|
+
// gone may be another move's doing.
|
|
753
777
|
const made = (!rec.existed && Boolean(rec.item) && board.has(rec.item ?? '') && ours) ||
|
|
754
778
|
(!rec.mark &&
|
|
755
779
|
Boolean(rec.head && rec.cmd) &&
|
|
756
|
-
movedSince(projectDir, rec.head ?? '', rec.cmd ?? '', rec.item ?? ''))
|
|
780
|
+
movedSince(projectDir, rec.head ?? '', rec.cmd ?? '', rec.item ?? '')) ||
|
|
781
|
+
(Boolean(rec.mark) && (rec.existed || !rec.item) && ours);
|
|
757
782
|
const next = made
|
|
758
783
|
? { state: 'accepted', item: rec.item, at: now() }
|
|
759
784
|
: { state: 'refused', error: 'the board stopped while it was made: try again', at: now() };
|
package/dist/shared/board.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The read model of `ai-factory gcf board --json` (Methodology §11): the board refuses a schema
|
|
2
2
|
// it does not know. Types only, plus the version this board reads.
|
|
3
|
-
export const BOARD_SCHEMA =
|
|
3
|
+
export const BOARD_SCHEMA = 7;
|
|
4
4
|
// Where a project keeps files given to an item or an inbox entry (Board-PRD §5.3, §5.6): only
|
|
5
5
|
// there may the board hand out a file that is not text. One list: a later kind is one line.
|
|
6
6
|
const ATTACHED = [
|