gcf-aif-ext 0.28.0 → 0.29.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/commands/gcf.js +35 -18
- package/extension.json +1 -1
- package/lib/agent-permissions.js +1 -1
- package/lib/board.js +6 -6
- package/lib/build-queue.js +13 -10
- package/lib/design-parts.js +20 -2
- package/lib/devices.js +2 -1
- package/lib/domain.js +15 -0
- package/lib/gates.js +2 -1
- package/lib/git.js +1 -1
- package/lib/handoff.js +49 -19
- package/lib/inbox-categories.js +9 -0
- package/lib/inbox.js +20 -1
- package/lib/integrate.js +4 -0
- package/lib/play-notes.js +4 -0
- package/lib/play-on.js +2 -1
- package/lib/play.js +642 -268
- package/lib/playtest-list.js +2 -2
- package/lib/push.js +7 -4
- package/lib/questions.js +3 -1
- package/lib/systems-doc.js +4 -3
- package/lib/validate-item.js +1 -2
- package/lib/work-ops.js +9 -3
- package/package.json +1 -1
- package/skills/gcf-chat/SKILL.md +4 -3
- package/templates/agents-block.md +6 -0
package/lib/playtest-list.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { gameMilestones } from './design-check.js';
|
|
6
6
|
import { listItems, readConfig, scalarOf, firstBullet } from './gcf-paths.js';
|
|
7
|
-
import {
|
|
7
|
+
import { itemBuilds, linksOf, playOf } from './play.js';
|
|
8
8
|
import { handoffOf } from './handoff.js';
|
|
9
9
|
import { recordsOf } from './verdict-fs.js';
|
|
10
10
|
|
|
@@ -81,7 +81,7 @@ export async function playtestList(root) {
|
|
|
81
81
|
system: c.data.system ?? [],
|
|
82
82
|
milestone: c.data.milestone ?? null,
|
|
83
83
|
play_on: c.data.play_on ?? builds ?? platforms,
|
|
84
|
-
|
|
84
|
+
builds: itemBuilds(path.dirname(root), String(c.data.id), c.data.status, links),
|
|
85
85
|
question: scalarOf(c.body, 'miss_criterion') || '(miss_criterion is empty)',
|
|
86
86
|
reach: recordsOf(c.body, 'behavior')
|
|
87
87
|
.map((r) => r.input)
|
package/lib/push.js
CHANGED
|
@@ -146,7 +146,8 @@ function outOf(dir, range) {
|
|
|
146
146
|
.filter(Boolean)
|
|
147
147
|
.map((rec) => {
|
|
148
148
|
const [hash, subject, by = ''] = rec.split(FS);
|
|
149
|
-
|
|
149
|
+
// A split gives one part at least.
|
|
150
|
+
const named = /** @type {string} */ (by.trim().split(',').at(-1));
|
|
150
151
|
|
|
151
152
|
return { hash, subject, by: BY.includes(named) ? named : 'operator' };
|
|
152
153
|
});
|
|
@@ -301,7 +302,8 @@ export async function pushBranch(dir, { remote, timeoutMs = NET_TIMEOUT_MS } = {
|
|
|
301
302
|
const branch = refuseWhereNoPush(dir, 'push');
|
|
302
303
|
const t = targetOf(dir, branch, remote);
|
|
303
304
|
const before = hashOf(dir, t.track);
|
|
304
|
-
|
|
305
|
+
// refuseWhereNoPush refused a branch with no commit.
|
|
306
|
+
const to = /** @type {string} */ (hashOf(dir, 'HEAD'));
|
|
305
307
|
const pushed = count(
|
|
306
308
|
dir,
|
|
307
309
|
before ? ['HEAD', `^${before}`] : ['HEAD', '--not', `--remotes=${t.remote}`],
|
|
@@ -362,8 +364,9 @@ export async function pullBranch(dir, { remote, timeoutMs = NET_TIMEOUT_MS } = {
|
|
|
362
364
|
timeoutMs,
|
|
363
365
|
);
|
|
364
366
|
if (f.status !== 0) throw netFailure(f, t, 'pull', timeoutMs);
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
+
// The fetch wrote the tracking ref; refuseWhereNoPush refused a branch with no commit.
|
|
368
|
+
const theirs = /** @type {string} */ (hashOf(dir, t.track));
|
|
369
|
+
const head = /** @type {string} */ (hashOf(dir, 'HEAD'));
|
|
367
370
|
const base = { remote: t.remote, branch, upstream: t.short, from: head.slice(0, 7) };
|
|
368
371
|
const ancestor = (a, b) => git(dir, ['merge-base', '--is-ancestor', a, b]).status === 0;
|
|
369
372
|
if (ancestor(theirs, head)) return { ...base, to: head.slice(0, 7), pulled: 0 };
|
package/lib/questions.js
CHANGED
|
@@ -58,6 +58,7 @@ function recordsOf(text) {
|
|
|
58
58
|
/**
|
|
59
59
|
* Every question: id, class, the question, the proposed answer, the ids it blocks and the
|
|
60
60
|
* human's answer, each null when the record has none.
|
|
61
|
+
* @returns {Promise<Array<{id: string} & Record<string, string | null>>>}
|
|
61
62
|
*/
|
|
62
63
|
export async function listQuestions(root) {
|
|
63
64
|
const file = fileOf(root);
|
|
@@ -164,7 +165,8 @@ export async function appendQuestions(root, records) {
|
|
|
164
165
|
let text = existsSync(file) ? await readFile(file, 'utf8') : '';
|
|
165
166
|
const ids = [];
|
|
166
167
|
for (const r of records) {
|
|
167
|
-
if (!['D1', 'D2'].includes(r.class))
|
|
168
|
+
if (!(/** @type {unknown[]} */ (['D1', 'D2']).includes(r.class)))
|
|
169
|
+
throw new Error('a question record is class D1 or D2');
|
|
168
170
|
if (!oneLine(r.question)) throw new Error('a question record needs its question');
|
|
169
171
|
const next = withRecord(text, r);
|
|
170
172
|
ids.push(next.id);
|
package/lib/systems-doc.js
CHANGED
|
@@ -90,7 +90,7 @@ export function upsertBlock(rawBody, key, addLines, order) {
|
|
|
90
90
|
const kept = existing.filter((l) => !/^- none\b/.test(l));
|
|
91
91
|
// A key the profile does not know goes last, after every block it does.
|
|
92
92
|
const specs = (order.includes(key) ? order : [...order, key]).map((k) => ({ key: k }));
|
|
93
|
-
const lead = body.match(/^\n*/)[0];
|
|
93
|
+
const lead = /** @type {RegExpMatchArray} */ (body.match(/^\n*/))[0];
|
|
94
94
|
const text = body.slice(lead.length);
|
|
95
95
|
let lines = text.split('\n');
|
|
96
96
|
// Out and back in: a block a hand left out of the profile's order moves to its place.
|
|
@@ -101,7 +101,8 @@ export function upsertBlock(rawBody, key, addLines, order) {
|
|
|
101
101
|
const end = Math.max(at.end, ...itemsOf(prose, at.start).map((i) => i.line));
|
|
102
102
|
lines = [...lines.slice(0, at.start - 1), ...lines.slice(end)];
|
|
103
103
|
while (lines.length > 1 && !lines[0].trim()) lines.shift();
|
|
104
|
-
while (lines.length > 1 && !lines.
|
|
104
|
+
while (lines.length > 1 && !lines[lines.length - 1].trim() && !lines[lines.length - 2].trim())
|
|
105
|
+
lines.pop();
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
const put = putBlock(lines, specs, { key }, [`${key}:`, ...kept, ...fresh], { raw: true });
|
|
@@ -143,7 +144,7 @@ export function blocksNamed(rawText) {
|
|
|
143
144
|
export function replaceBlock(rawBody, key, rendered, order) {
|
|
144
145
|
const body = lf(rawBody);
|
|
145
146
|
const specs = (order.includes(key) ? order : [...order, key]).map((k) => ({ key: k }));
|
|
146
|
-
const lead = body.match(/^\n*/)[0];
|
|
147
|
+
const lead = /** @type {RegExpMatchArray} */ (body.match(/^\n*/))[0];
|
|
147
148
|
const lines = body.slice(lead.length).split('\n');
|
|
148
149
|
const put = putBlock(lines, specs, { key }, rendered, { raw: true });
|
|
149
150
|
|
package/lib/validate-item.js
CHANGED
|
@@ -207,8 +207,7 @@ const RULES = {
|
|
|
207
207
|
nullable((x) => ['main', 'worktree'].includes(x))(v) || 'run_mode must be main | worktree',
|
|
208
208
|
skip_gates: (v) => typeof v === 'boolean' || 'skip_gates must be true or false',
|
|
209
209
|
gate_why: (v) => nullable(isText)(v) || 'gate_why must be text or null',
|
|
210
|
-
play_on: (v) =>
|
|
211
|
-
(Array.isArray(v) && v.every(isText)) || 'play_on must list names of play.builds',
|
|
210
|
+
play_on: (v) => (Array.isArray(v) && v.every(isText)) || 'play_on must list names of play.builds',
|
|
212
211
|
version: (v) =>
|
|
213
212
|
nullable((x) => typeof x === 'string' && /^\S+$/.test(x))(v) ||
|
|
214
213
|
'version must be one word of text (quote a number: "1.0")',
|
package/lib/work-ops.js
CHANGED
|
@@ -71,6 +71,7 @@ import { playNotesCheck, playNotesOf, withoutPlayNotes } from './play-notes.js';
|
|
|
71
71
|
* @property {string[]} [assume] the agent's assumptions: D2 records in the move's commit
|
|
72
72
|
* @property {boolean} [dropOutcome] the integrator's: the plan's `## Outcome` leaves in the commit
|
|
73
73
|
* @property {string} [said] the agent's word for the human, into the commit's subject
|
|
74
|
+
* @property {string[]} [playedOn] a verdict's: where the operator played it
|
|
74
75
|
*/
|
|
75
76
|
|
|
76
77
|
const SOFT = ['mechanic', 'resource'];
|
|
@@ -711,6 +712,7 @@ const playChanges = (item) =>
|
|
|
711
712
|
/**
|
|
712
713
|
* A4 in one write: gate verdict, awaiting-verdict, and why (`gate_why`) — status alone would
|
|
713
714
|
* break "awaiting-verdict needs gate: verdict".
|
|
715
|
+
* @param {string | null} [why]
|
|
714
716
|
*/
|
|
715
717
|
function awaitVerdict(m, why = null) {
|
|
716
718
|
const data = {
|
|
@@ -1377,14 +1379,14 @@ async function stallItemUnlocked(projectDir, id, { passes, reason = '', commit =
|
|
|
1377
1379
|
*/
|
|
1378
1380
|
async function answerStallUnlocked(projectDir, id, { more, accept = false, commit = true }) {
|
|
1379
1381
|
const move = accept ? 'plan_accept' : 'plan_more';
|
|
1380
|
-
if (!accept && !(Number.isInteger(more) && more >= 1))
|
|
1382
|
+
if (!accept && !(more !== undefined && Number.isInteger(more) && more >= 1))
|
|
1381
1383
|
throw new Error('more passes: a number, 1 or more');
|
|
1382
1384
|
const m = await begin(projectDir, id, move);
|
|
1383
1385
|
const stall = m.item.data.stall;
|
|
1384
1386
|
if (!stall) throw new Error(`${id} is not stalled in planning: nothing to answer`);
|
|
1385
1387
|
const answered = accept
|
|
1386
1388
|
? { ...stall, accepted: true }
|
|
1387
|
-
: { ...stall, more: Number(stall.more ?? 0) + more };
|
|
1389
|
+
: { ...stall, more: Number(stall.more ?? 0) + /** @type {number} */ (more) };
|
|
1388
1390
|
const data = {
|
|
1389
1391
|
...without(m.item.data, 'blocked'),
|
|
1390
1392
|
status: 'ready',
|
|
@@ -1789,9 +1791,13 @@ const SKIP_GATES = { skip: true, wait: false, project: undefined };
|
|
|
1789
1791
|
* The operator's choice of an item's gates (docs/Autonomy-Plan.md, B): `skip` puts its verdict,
|
|
1790
1792
|
* decision and question gates on their second value, `wait` holds them, `project` takes the
|
|
1791
1793
|
* field off and the project's `gates:` hold. Commit `gcf(item)`, key `gates`.
|
|
1794
|
+
* @param {string} projectDir
|
|
1795
|
+
* @param {string} id
|
|
1796
|
+
* @param {{gates?: string, commit?: boolean}} [opts]
|
|
1792
1797
|
*/
|
|
1793
1798
|
async function setGatesUnlocked(projectDir, id, { gates, commit = true } = {}) {
|
|
1794
|
-
if (
|
|
1799
|
+
if (gates === undefined || !(gates in SKIP_GATES))
|
|
1800
|
+
throw new Error(`gates is ${Object.keys(SKIP_GATES).join(' | ')}`);
|
|
1795
1801
|
const ledger = await buildLedger(projectDir);
|
|
1796
1802
|
const item = ledger.item(id);
|
|
1797
1803
|
if (!item) throw new Error(`${id} is not a work item`);
|
package/package.json
CHANGED
package/skills/gcf-chat/SKILL.md
CHANGED
|
@@ -59,9 +59,10 @@ workflow:
|
|
|
59
59
|
14. then call `propose_play` with its `id`, a `target` and, for a target with devices, the `device` id: the human's click starts it and opens it, and the verdict stops it
|
|
60
60
|
15. the context file says no `play:` is set up and the project's `AGENTS.md` says how the game builds and starts: call `propose_play_setup` with those commands; say what is missing when it does not say
|
|
61
61
|
16. a Set up pass over a `play:` with no `plays_on`: propose `play.builds` with rows from the `platforms` of `gcf/game.md`, and targets with `build`, `for`, `devices` and `launches`
|
|
62
|
-
17.
|
|
63
|
-
18.
|
|
64
|
-
19.
|
|
62
|
+
17. one `propose_play_setup` per build, named in `of`; a release command goes with `profile: release`; `auto_build` names the build a run's card gets
|
|
63
|
+
18. in that pass, turn each line of platforms in a card's `play_on` and `played_on` into the name of its build
|
|
64
|
+
19. another move the human asks for: run its `ai-factory gcf` command; the human approves it on the card, or refuses it
|
|
65
|
+
20. say in one line what changed, or that nothing did
|
|
65
66
|
|
|
66
67
|
invocation:
|
|
67
68
|
- run at the start of a project chat thread the board opens, and when the user types `/gcf-chat`
|
|
@@ -50,6 +50,10 @@ gcf_work:
|
|
|
50
50
|
- Play main does the same for the checkout as it is, hand edits too; `ai-factory gcf playtest status` names the targets, the running player and the build queue
|
|
51
51
|
- `ai-factory gcf item show <id>` prints a waiting card's handoff: its outcome, its main question, Play by platform, what changed, what to try, what waits for the human
|
|
52
52
|
- `play.builds` names the builds of the project, each with its command, its output and the rows it `plays_on` (`device`, `os`, `os_min`, `model`, `input`)
|
|
53
|
+
- a build's command is one, or `build: { debug: <cmd>, release: <cmd> }`; `play.auto_build` is the build a run's card gets when its `play_on` names none
|
|
54
|
+
- `playtest build <id> --of <build> --profile release` builds one build in one profile; with neither, the card's build in debug; `playtest start --profile release` plays the target's build in release
|
|
55
|
+
- a card whose code has left the checkout builds in `.gcf-session/buildtree` at its own commit; its first build there is slow, the next ones reuse its caches
|
|
56
|
+
- `playtest setup --of <build> --build <cmd> [--profile release] --output <folder> --plays-on <row>` sets one build; `--auto-build <build>`, `--remove-build <build>`; a target's `--target-build <build>`
|
|
53
57
|
- a target names its `build`, the rows it serves (`for`), its `devices` script, and `launches: true` when it installs and ends
|
|
54
58
|
- `ai-factory gcf playtest devices <target>` lists the devices its script finds and why one does not fit; `playtest start <id> --target <t> --device <id>` plays on one
|
|
55
59
|
- a build while a run works in the checkout waits on a ticket: `playtest build <id> --wait` waits in its process, `--queue` prints `{ticket}` and ends; `ai-factory gcf playtest cancel <ticket>` takes it out or stops it
|
|
@@ -129,6 +133,8 @@ gcf_forbidden:
|
|
|
129
133
|
- do not answer a `TBD` of a design unit yourself: ask the human and offer your draft as the proposed answer
|
|
130
134
|
- do not run `ai-factory gcf phase next`: the phase moves on the human's word only
|
|
131
135
|
- do not change what agent runs may do: `ai-factory gcf permissions`, its deny groups and the board's YOLO belong to the human
|
|
136
|
+
- a run blocked with `needs permission` goes on once the human allows that one rule for its next run: the board's **Allow <rule> for one run**
|
|
137
|
+
- its console form is `ai-factory gcf unblock <id>`, then `ai-factory gcf-harness run <id> --allow "<rule>"`, the rule as the refusal card names it
|
|
132
138
|
- do not change a setting of `gcf/config.yml` or the `language` of `.ai-factory/config.yaml`: `ai-factory gcf config set` belongs to the human
|
|
133
139
|
- do not reuse an ended id: rework gets a new id with `reopens: <old id>`
|
|
134
140
|
- do not commit past the gate with `--no-verify`: a refused commit names what to fix
|