Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

chore(merge): integrate accepted per-agent relay tokens [H2,H9]

Corey Olsonf30834537925
diff --cc src/cli.js
index dd20b1d0,9e449ee5..e07e0c4a
--- a/src/cli.js
+++ b/src/cli.js
@@@ -61,7 -65,8 +65,8 @@@ import { proofStats } from './stats.js'
import { exportBoard, importBoard } from './exchange.js';
import { addSigner, assertRequiredSigners, defaultPrincipal, hasSignerFile } from './signature.js';
import { loadMachineSettings, setGateSlots } from './settings.js';
-import { relayCommandReceipt, relayCommandReceiptReported, relayLinked, relayOff, relayOn, relayOperation, relayRecovered, relayStatus, syncRelay } from './relay.js';
+import { relayCommandReceipt, relayCommandReceiptReported, relayLinked, relayOff, relayOn, relayOperation, relayRecovered, relayRevoke, relayStatus, relayTokens, syncRelay } from './relay.js';
+ import { relayJoin, relayPair } from './relay-pairing-client.js';
import { executePersonRequests } from './relay-request-execution.js';
const PACKAGE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
@@@ -84,10 -118,9 +118,11 @@@ Set u
pullboard view --export <dir> a read-only snapshot with event replay, for any static host
pullboard serve [--port N] local API v1: boards, state, moves, requests and live events,
behind the session secret in its printed address
- pullboard relay [on|off] [--url <address>] link, inspect or unlink this board's sealed relay mirror
+ pullboard relay [on|off|pair|join <code>] [--url <address>] link, inspect or unlink this board's sealed relay
on signs in through GitHub; the address defaults to https://app.pullboard.dev
+ pair prints a one-use machine code; join stores it in another clone
+ pullboard relay tokens list this board's agent token ids, agents and expiry, never credentials
+ pullboard relay revoke <token-id> revoke one token from that list; other agents keep working
pullboard resume where you are: your claim, branch, uncommitted work, what came back,
unread shouts, what to do next; run it to start any session
pullboard hooks reinstall the git hooks (e.g. after a fresh clone)
@@@ -2395,19 -2526,16 +2533,29 @@@ async function runCommand(argv, io)
if (command === 'hook') return await hookCommand(io, args);
if (command === 'settings') return settingsCommand(io, args);
if (command === 'relay') {
+ if (['tokens', 'revoke'].includes(first)) {
+ if (rest.length || values.url || (first === 'tokens' && second) || (first === 'revoke' && !second)) {
+ throw new Refused('USAGE', 'pullboard relay tokens, or pullboard relay revoke <token-id>');
+ }
+ const ctx = context(io);
+ const result = first === 'tokens' ? await relayTokens(ctx.info.root, io) : await relayRevoke(ctx.info.root, second, io);
+ io.result?.(result);
+ if (first === 'tokens') {
+ if (!result.tokens.length) io.say('no agent tokens on this board');
+ for (const row of result.tokens) io.say(row.id + ' ' + row.agent + ' ' + (row.revoked ? 'revoked' : 'expires ' + new Date(row.expires).toISOString()));
+ } else io.say('revoked token ' + result.id + '; other agent tokens are unchanged');
+ return 0;
+ }
+ if (first === 'pair') {
+ if (second || rest.length || values.url) throw new Refused('USAGE', 'pullboard relay pair');
+ const ctx = context(io);
+ return await relayPair(ctx.info.root, io);
+ }
+ if (first === 'join') {
+ if (!second || rest.length) throw new Refused('USAGE', 'pullboard relay join <code> [--url <address>]');
+ const ctx = context(io);
+ return await relayJoin(ctx.info.root, second, values.url, io);
+ }
if (second || rest.length || (first && !['on', 'off'].includes(first)) || (values.url && first !== 'on')) throw new Refused('USAGE', 'pullboard relay [on|off] [--url <address>]');
const ctx = context(io);
if (!first) { await syncRelay(ctx.info.root, io); await executePersonRequests(ctx.info.root, io, main); }
diff --cc test/relay-client-fixture.js
index edf76998,beb7301b..8c125544
--- a/test/relay-client-fixture.js
+++ b/test/relay-client-fixture.js
@@@ -81,15 -100,10 +101,17 @@@ export async function relayClientFixtur
}
return end(chunk, ...args);
};
+ res.once('finish', () => transit.push({ method: req.method, path: req.url,
+ request: Buffer.concat(requestChunks), response: Buffer.concat(responseChunks) }));
calls.push({ method: req.method, path: req.url, accept: req.headers.accept ?? '', engine: req.headers['x-pullboard-engine'] });
if ([...privateKeys].some(key => JSON.stringify({ url: req.url, headers: req.headers }).includes(key))) keyLeaked = true;
+ if (mintFailures > 0 && req.method === 'POST' && req.url === '/auth/tokens') {
+ mintFailures -= 1;
+ req.resume();
+ res.writeHead(503, { 'content-type': 'application/json' });
+ res.end(JSON.stringify({ version: 1, error: { code: 'TEMPORARY', message: 'fixture refusal' } }));
+ return;
+ }
if (refuseEventReads && req.method === 'GET' && /\/events(?:\?|$)/.test(req.url)) {
res.writeHead(503, { 'content-type': 'application/json' });
res.end(JSON.stringify({ version: 1, error: { code: 'RELAY_UNAVAILABLE', message: 'fixture read outage' } }));
diff --cc test/relay-credential.test.js
index f1dabf35,00000000..f5463980
mode 100644,000000..100644
--- a/test/relay-credential.test.js
+++ b/test/relay-credential.test.js
@@@ -1,72 -1,0 +1,76 @@@
+/** Real transport proves credential selection follows every public operation class [H2,H9,H16]. */
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { test } from 'node:test';
+import { ENGINE_OPERATIONS } from '../src/engine.js';
+import { decodeBoardKey, unseal } from '../src/seal.js';
+import { relayClientFixture } from './relay-client-fixture.js';
+
+test('every current operation selects its native actor credential without a second authorization policy [H2,H9,H16]', async (t) => {
+ const box = await relayClientFixture(t);
+ await box.link();
+ const actor = 'coordinator';
+ const options = { agentId: actor, lane: box.lane, leaseMs: 3600000, reason: 'credential fixture', note: 'credential fixture', text: 'fixture', kind: 'observation', head: 'a'.repeat(40), frozen: { text: '{"rows":[]}', digest: 'f'.repeat(64) } };
+ const cases = ENGINE_OPERATIONS.map(operation => {
+ let args = [999999, options];
+ let kind = 'agent';
+ if (operation === 'register') { args = [{ lane: box.lane, path: '/private/credential-enrollment' }]; kind = 'person'; }
+ if (operation === 'ensureCoordinator') { args = [box.root]; kind = 'person'; }
+ if (operation === 'addItem') args = [{ by: actor, lane: box.lane, title: 'credential actor fixture' }];
+ if (operation === 'shout') args = [{ from: actor, to: 'all', text: 'credential actor fixture', lanes: [box.lane] }];
+ if (operation === 'release') args = [999999, actor];
+ if (['claim', 'refreeze'].includes(operation)) args = [box.before.tables.item[0].item_id, options];
+ if (operation === 'reserveNextReview') args = [options];
++ if (operation === 'completeCheckBaseline') args = [999999, { ...options,
++ expected: { command: 'true', main: 'a'.repeat(40), result: 'pending', request: '11111111-1111-4111-8111-111111111111' },
++ baseline: { command: 'true', main: 'a'.repeat(40), result: 'green' },
++ }];
+ if (operation === 'addMilestone') args = [{ agentId: actor, name: 'Credential fixture', items: [] }];
+ if (['holdLane', 'releaseLane'].includes(operation)) args = [box.lane, options];
+ if (operation === 'applyRowDecisions') args = [{ agentId: actor, events: [] }];
+ if (operation === 'recordRowDecisions') { args = [{ agentId: 'person', channel: 'terminal', decisions: [] }]; kind = 'person'; }
+ return { operation, args, kind };
+ });
+ cases.push(
+ { operation: 'answerDecision', args: [999999, { ...options, asPerson: true, channel: 'terminal' }], kind: 'person' },
+ { operation: 'holdLane', args: [box.lane, { ...options, asPerson: true, channel: 'terminal' }], kind: 'person' },
+ { operation: 'releaseLane', args: [box.lane, { ...options, asPerson: true, channel: 'terminal' }], kind: 'person' },
+ { operation: 'shout', args: [{ from: actor, to: 'all', text: 'person request fixture', lanes: [box.lane], request: true }], kind: 'person' },
+ { operation: 'applyRowDecisions', args: [{ agentId: actor, events: [] }], kind: 'person', personRequest: { id: 'credential-request', stage: 'apply' } },
+ );
+ const start = box.moveAcks.length;
+ const results = [];
+ // Each child keeps the fixture's existing deadline while all moves share one durable board.
+ for (let offset = 0; offset < cases.length; offset += 8) {
+ const batch = cases.slice(offset, offset + 8);
+ const result = await box.script(`
+ import { relayOperation } from ${JSON.stringify(new URL('../src/relay.js', import.meta.url).href)};
+ import { Refused } from ${JSON.stringify(new URL('../src/refused.js', import.meta.url).href)};
+ const cases = ${JSON.stringify(batch)};
+ const results = [];
+ for (const entry of cases) {
+ const io = { err() {}, onEvent() {}, ...(entry.personRequest ? { personRequest: entry.personRequest } : {}) };
+ try { await relayOperation(process.cwd(), entry.operation, entry.args, io); results.push(null); }
+ catch (error) { if (!(error instanceof Refused)) { results.push({ fatal: error.name, operation: entry.operation, stack: error.stack?.split('\\n').slice(1, 3).join('\\n') }); break; } results.push(error.code); }
+ }
+ console.log(JSON.stringify({ results }));
+ `);
+ assert.equal(result.code, 0, 'every operation reaches the real transport and deterministic replay');
+ assert.equal(result.document.results.some(value => value?.fatal), false, JSON.stringify(result.document.results.filter(value => value?.fatal)));
+ assert.equal(result.document.results.length, batch.length);
+ results.push(...result.document.results);
+ }
+ const records = box.moveAcks.slice(start);
+ assert.equal(records.length, cases.length, 'each operation is acknowledged once even when native preconditions refuse it');
+ const key = decodeBoardKey(readFileSync(box.keyFile, 'utf8').trim());
+ const state = JSON.parse(readFileSync(box.linkFile, 'utf8'));
+ for (const [index, entry] of cases.entries()) {
+ const record = records[index];
+ const move = JSON.parse(new TextDecoder().decode(await unseal(key, Buffer.from(record.sealed, 'base64url'), { boardId: state.board, kind: record.kind, sequence: record.event_id })));
+ assert.equal(move.operation, entry.operation);
+ assert.equal(record.sender.kind, entry.kind, `${entry.operation} selects the correct authenticated credential`);
+ if (entry.kind === 'agent') assert.equal(record.sender.agent, actor, 'the scoped credential belongs to the native actor');
+ assert.ok(!['RELAY_ACTOR', 'RELAY_SENDER', 'RELAY_SENDER_MISMATCH', 'RELAY_PERSON_ONLY'].includes(results[index]),
+ `${entry.operation} passes main's shared sender policy`);
+ }
+});