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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
feat(sentinels): bind person decisions to proposals [N26,P6]
Corey Olson6f8c7c113151
diff --git a/src/api-moves.js b/src/api-moves.jsindex a3304689..18bc03e6 100644--- a/src/api-moves.js+++ b/src/api-moves.js@@ -5,6 +5,8 @@ import { Refused } from './refused.js';const MOVES = {'spec-approve': { prefix: ['spec', 'approve'], positions: ['ids'], flags: ['by', 'text'] },'spec-decline': { prefix: ['spec', 'decline'], positions: ['ids'], flags: ['reason'] },+ 'sentinel-approve': { prefix: ['sentinel', 'approve'], positions: ['name'], flags: ['digest'] },+ 'sentinel-decline': { prefix: ['sentinel', 'decline'], positions: ['name'], flags: ['digest', 'reason'] },'spec-answer': { prefix: ['spec', 'answer'], positions: ['row', 'answer'] },'check-accept': { prefix: ['check', 'accept'], item: true },add: { positions: ['lane', 'title'], flags: ['criterion', 'specs', 'parent', 'after', 'brief', 'route', 'check'], booleans: ['wait'], booleans: ['wait'] },@@ -33,6 +35,14 @@ export function moveArgs({ verb, item, args = {} }) {const form = Object.hasOwn(MOVES, verb) ? MOVES[verb] : null;if (!form) throw new Refused('BAD_REQUEST', `no API move ${String(verb)}; use a board move such as add, claim, submit, verify, shout or answer`);if (!args || typeof args !== 'object' || Array.isArray(args)) throw new Refused('BAD_REQUEST', 'args needs a JSON object containing this move\'s arguments');+ if (['sentinel-approve', 'sentinel-decline'].includes(verb)) {+ if (typeof args.digest !== 'string' || !/^[a-f0-9]{64}$/u.test(args.digest)) {+ throw new Refused('BAD_REQUEST', 'a sentinel decision needs the exact proposal digest; refresh the pending watch before deciding');+ }+ if (verb === 'sentinel-decline' && (typeof args.reason !== 'string' || !args.reason.trim())) {+ throw new Refused('BAD_REQUEST', 'declining a sentinel needs a reason; say why this proposal should not run');+ }+ }const allowed = [...(form.positions ?? []), ...(form.flags ?? []), ...(form.lists ?? []), ...(form.booleans ?? [])];for (const key of Object.keys(args)) if (!allowed.includes(key)) throw new Refused('BAD_REQUEST', `${verb} does not take args.${key}; use only this CLI move's arguments`);const argv = form.prefix ? [...form.prefix] : [verb];diff --git a/src/person-request.js b/src/person-request.jsindex 06f50cb9..6cfa4695 100644--- a/src/person-request.js+++ b/src/person-request.js@@ -3,14 +3,14 @@ import { moveArgs } from './api-moves.js';import { Refused } from './refused.js';export const PERSON_REQUEST_VERSION = 1;-const VERBS = Object.freeze(['add', 'shout', 'answer', 'hold', 'spec-approve', 'spec-decline']);+const VERBS = Object.freeze(['add', 'shout', 'answer', 'hold', 'spec-approve', 'spec-decline', 'sentinel-approve', 'sentinel-decline']);/** Validate a narrow person intent while retaining literal arguments for the actual CLI parser. */export function personRequestMove(body) {if (!body || typeof body !== 'object' || Array.isArray(body)|| Object.keys(body).some(key => !['verb', 'item', 'args'].includes(key))|| !VERBS.includes(body.verb)) {- throw new Refused('BAD_REQUEST', 'a person request takes add, shout, answer, hold, spec-approve or spec-decline with item and args; use the view controls');+ throw new Refused('BAD_REQUEST', 'a person request takes add, shout, answer, hold, spec-approve, spec-decline, sentinel-approve or sentinel-decline with item and args; use the view controls');}const move = structuredClone(body);move.args ??= {};diff --git a/src/relay-requests.js b/src/relay-requests.jsindex 81d0a10c..be8536ae 100644--- a/src/relay-requests.js+++ b/src/relay-requests.js@@ -69,8 +69,8 @@ export function receivePersonRequest(board, document, { sequence, at, sender })if (sender?.kind !== 'person' || typeof sender.userId !== 'string' || !sender.userId || sender.userId.length > 256) throw new Refused('RELAY_PERSON_ONLY', 'only the authenticated person can send a relay request; use the paired view with the person session');request = validatePersonRequest(document);// On a board that names approvers, a phone request that acts as the person must come from one [E4].- if (sender.approver === false && ['answer', 'hold', 'spec-approve', 'spec-decline'].includes(request.move?.verb)) {- throw new Refused('NOT_APPROVER', `${sender.login ?? 'this person'} is not an approver of this board; ask an approver to answer, hold or decide rows`);+ if (sender.approver === false && ['answer', 'hold', 'spec-approve', 'spec-decline', 'sentinel-approve', 'sentinel-decline'].includes(request.move?.verb)) {+ throw new Refused('NOT_APPROVER', `${sender.login ?? 'this person'} is not an approver of this board; ask an approver to answer, hold or decide rows and sentinels`);}} catch (cause) {if (!(cause instanceof Refused)) throw cause;@@ -124,6 +124,14 @@ function fulfilsIntent(record, move) {&& JSON.stringify(options.implies ?? []) === JSON.stringify(requestedImplies(args.implies)) && (options.supersedes ?? null) === requestedAnswer(args.supersedes);if (intent.verb === 'hold') return value === args.lane && options?.asPerson === true && options.channel === 'view'&& (args.off || options.reason === (args.reason ?? ''));+ if (['sentinel-approve', 'sentinel-decline'].includes(intent.verb)) {+ const decline = intent.verb === 'sentinel-decline';+ return move.args.length === 1 && value?.agentId === 'person' && value.channel === 'view'+ && value.name === args.name && value.digest === args.digest && value.decision === (decline ? 'decline' : 'approve')+ && (!decline || typeof args.reason === 'string' && Boolean(args.reason.trim()))+ && (value.reason ?? '') === (decline ? args.reason.trim() : '')+ && Object.keys(value).every(key => ['agentId', 'channel', 'name', 'digest', 'decision', 'reason'].includes(key));+ }const rows = value?.decisions;const ids = args.ids.split(/[\s,]+/u).filter(Boolean);return value?.agentId === 'person' && value.channel === 'view' && Array.isArray(rows) && rows.length === ids.length@@ -188,7 +196,7 @@ export function requestMoveProblem(board, move, { checkExecutorLease = true } =const actor = relayMoveActor(move);if (!['coordinator', 'person'].includes(actor)) return new Refused('PERSON_REQUEST_RECEIPT', 'only the coordinator fulfils an authenticated person request');if (tag.phase === 'execute') {- const expected = { add: 'addItem', shout: 'shout', answer: 'answerDecision', hold: record.move.args.off ? 'releaseLane' : 'holdLane', 'spec-approve': 'recordRowDecisions', 'spec-decline': 'recordRowDecisions' }[record.move.verb];+ const expected = { add: 'addItem', shout: 'shout', answer: 'answerDecision', hold: record.move.args.off ? 'releaseLane' : 'holdLane', 'spec-approve': 'recordRowDecisions', 'spec-decline': 'recordRowDecisions', 'sentinel-approve': 'decideSentinel', 'sentinel-decline': 'decideSentinel' }[record.move.verb];if (move.operation !== expected || !fulfilsIntent(record, move)) return new Refused('PERSON_REQUEST_RECEIPT', 'the ordinary move does not fulfil this request; execute its original CLI intent');}if (move.engine >= 6 && ['claim', 'repo-request', 'refuse'].includes(tag.phase) && !fulfilsStage(record, move, tag)) return new Refused('PERSON_REQUEST_RECEIPT', 'publish only the exact stage for this authenticated phone request');diff --git a/src/sentinel-command.js b/src/sentinel-command.jsindex e376e9f0..2c7b44af 100644--- a/src/sentinel-command.js+++ b/src/sentinel-command.js@@ -14,6 +14,7 @@ export const SENTINEL_OPTIONS = {timeout: { type: 'string' },next: { type: 'string' },sentinel: { type: 'boolean' },+ digest: { type: 'string' },};/** Run due approved watches from ordinary resume, respecting the health switches. */@@ -45,8 +46,10 @@ export async function sentinelCommand({ ctx, words, values, withBoard, whoAmI, oif (!ctx.info.isMain || me.id !== 'coordinator') throw new Refused('B26_PERSON_APPROVAL', 'only the person from the main checkout approves or declines a sentinel; use their terminal or Pullboard View');const current = sentinels(board).find(entry => entry.name === name);if (!current) throw new Refused('STALE_SENTINEL', 'read the current proposals with pullboard sentinels');+ const digest = values.digest ?? current.digest;+ if (digest !== current.digest) throw new Refused('STALE_SENTINEL', 'this proposal changed after it was shown; refresh the pending watch and decide its current command, directory and schedule');row = await ordered(ctx, board, 'decideSentinel', [{ agentId: PERSON, channel: ctx.io.personChannel ?? 'terminal',- name, digest: current.digest, decision: verb, reason: values.reason }]);+ name, digest, decision: verb, reason: (values.reason ?? '').trim() }]);}ctx.io.result?.({ sentinel: row });ctx.io.say(`${name}: ${row.status}; ${row.every}; owner ${row.owner}; directory ${row.directory}\n ${row.check}`);diff --git a/src/sentinels.js b/src/sentinels.jsindex 80e14f57..3498d211 100644--- a/src/sentinels.js+++ b/src/sentinels.js@@ -67,6 +67,7 @@ export function rigorSentinelName(key) {export function sentinelDraftNeeds(rows) {return rows.filter(row => row.status === 'pending').map(row => ({kind: 'sentinel-draft', id: `sentinel:${row.name}`, ref: row.name,+ check: row.check, directory: row.directory, every: row.every, owner: row.owner, digest: row.digest,text: `Sentinel draft: ${row.name} runs ${row.check} ${row.every === 'daily' || row.every === 'hourly' ? row.every : 'every ' + row.every}, reporting to ${row.owner}`,what: `pullboard sentinel approve ${row.name}, or decline it with --reason`, target: `sentinel:${row.name}`,...(row.evidence ? { cause: row.evidence.key, evidence: row.evidence } : {}),