@attalabs/vinaya 0.42.1 → 0.43.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/dist/checks/bin/check-evidence-fresh.js +177 -152
- package/dist/checks/bin/check-registry-gates.js +10 -3
- package/dist/index.js +300 -173
- package/dist/lib/pre-push-cache-test-run.js +145 -144
- package/dist/lib/pre-push-changed-files.js +10 -3
- package/dist/lib/pre-push-progress-dir.js +169 -147
- package/dist/lib/pre-push-select-tests.js +16 -4
- package/dist/lib/push-progress-observer.js +169 -147
- package/dist/programs/archive.js +172 -148
- package/dist/programs/audit.js +169 -147
- package/dist/programs/check.js +172 -148
- package/dist/programs/commit-msg.js +172 -148
- package/dist/programs/dev-review-loop.js +300 -176
- package/dist/programs/dispatch.js +1905 -1877
- package/dist/programs/log-emit.js +172 -148
- package/dist/programs/log-selftest.js +172 -148
- package/dist/programs/log-send.js +172 -148
- package/dist/programs/pr-report.js +177 -152
- package/dist/programs/pr-snapshot.js +172 -148
- package/dist/programs/pr-verify-evidence.js +177 -152
- package/dist/programs/pr.js +172 -148
- package/dist/programs/review-post.js +172 -148
- package/dist/programs/review-status.js +180 -148
- package/dist/programs/run-engine.js +110594 -0
- package/dist/programs/supervised-command.js +67 -0
- package/dist/programs/sync.js +63 -39
- package/dist/programs/task-brief.js +174 -150
- package/dist/programs/task-sweep.js +244 -151
- package/dist/programs/task-tools-serve.js +260 -163
- package/dist/programs/tokens.js +172 -148
- package/dist/programs/waiver.js +172 -148
- package/dist/vinaya-strict/checks/registry.ts +1085 -0
- package/dist/vinaya-strict/executing/code-reviewer/README.md +3 -0
- package/dist/vinaya-strict/executing/code-reviewer/doctrine.md +185 -0
- package/dist/vinaya-strict/executing/code-reviewer/evals/README.md +1 -0
- package/dist/vinaya-strict/executing/code-reviewer/evals/code-reviewer-cases.json +280 -0
- package/dist/vinaya-strict/executing/code-reviewer/grants.yaml +22 -0
- package/dist/vinaya-strict/executing/code-reviewer/output.schema.json +93 -0
- package/dist/vinaya-strict/executing/code-reviewer/review-result.ts +347 -0
- package/dist/vinaya-strict/executing/dev-review.flow.yaml +103 -0
- package/dist/vinaya-strict/executing/developer/README.md +3 -0
- package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +69 -0
- package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +286 -0
- package/dist/vinaya-strict/executing/developer/doctrine.md +111 -0
- package/dist/vinaya-strict/executing/developer/evals/README.md +1 -0
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-cases.json +6275 -0
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-held-out.json +11526 -0
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +498 -0
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +1407 -0
- package/dist/vinaya-strict/executing/developer/grants.yaml +25 -0
- package/dist/vinaya-strict/executing/developer/output.schema.json +148 -0
- package/dist/vinaya-strict/executing/developer/reference.md +376 -0
- package/dist/vinaya-strict/executing/operator/doctrine.md +209 -0
- package/dist/vinaya-strict/executing/security-reviewer/README.md +3 -0
- package/dist/vinaya-strict/executing/security-reviewer/doctrine.md +171 -0
- package/dist/vinaya-strict/executing/security-reviewer/evals/README.md +1 -0
- package/dist/vinaya-strict/executing/security-reviewer/evals/security-reviewer-cases.json +141 -0
- package/dist/vinaya-strict/executing/security-reviewer/grants.yaml +22 -0
- package/dist/vinaya-strict/executing/security-reviewer/output.schema.json +93 -0
- package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +1278 -0
- package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +52 -0
- package/dist/vinaya-strict/integration/process/process-integration.ts +57 -0
- package/dist/vinaya-strict/loops/dev-review/v2/dev-review-v2.flow.yaml +136 -0
- package/dist/vinaya-strict/process.yaml +43 -0
- package/dist/vinaya-strict/retrospecting/archivist/doctrine.md +174 -0
- package/dist/vinaya-strict/retrospecting/tranche-archivist/doctrine.md +270 -0
- package/dist/vinaya-strict/thinking/architect/doctrine.md +110 -0
- package/dist/vinaya-strict/thinking/planner/doctrine.md +105 -0
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +128 -0
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +169 -0
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +701 -0
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +1035 -0
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +359 -0
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +815 -0
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +200 -0
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +458 -0
- package/package.json +4 -2
- package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
- /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → x2q88XfwsihlevulRhIvs}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → x2q88XfwsihlevulRhIvs}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Developer's turn result — the one structured value a Developer turn ends
|
|
3
|
+
* with, delivered as each CLI's native structured final output (Claude Code
|
|
4
|
+
* `--json-schema`, Codex `--output-schema`) rather than parsed out of prose.
|
|
5
|
+
*
|
|
6
|
+
* Versioned (`schemaVersion`) and discriminated by `status`:
|
|
7
|
+
*
|
|
8
|
+
* - `completed` — `summary`, `confidence` (a whole percent),
|
|
9
|
+
* `confidenceExplanation`, `addressedFindingIds`, `sourceUses`, and the
|
|
10
|
+
* optional `reportedChecks`;
|
|
11
|
+
* - `blocked` — `summary`, a typed `blocker`, optional `sourceUses`;
|
|
12
|
+
* - `needs_ruling` — `summary`, a typed `rulingRequest`, optional `sourceUses`.
|
|
13
|
+
*
|
|
14
|
+
* Confidence exists only on `completed`. `sourceUses` is required on
|
|
15
|
+
* `completed` when the brief names required sources, and is optional
|
|
16
|
+
* diagnostic context on the other two.
|
|
17
|
+
*
|
|
18
|
+
* One schema serves both vendors, so it is written to the strictest common
|
|
19
|
+
* shape: OpenAI structured outputs (which Codex's `--output-schema` uses)
|
|
20
|
+
* refuse a root that is not a plain object and refuse an optional property, so
|
|
21
|
+
* the union sits under one root key, `turnResult`, and every "optional" field
|
|
22
|
+
* is a required, nullable one. The same zod value generates the JSON Schema
|
|
23
|
+
* the CLIs receive and validates what comes back, so the two can never drift.
|
|
24
|
+
*
|
|
25
|
+
* Validation runs in two steps. `parseDeveloperTurnResult` is the shape check
|
|
26
|
+
* (the schema the provider was given); `validateDeveloperTurnResult` adds the
|
|
27
|
+
* semantic check against the turn's own context — a finding id the round never
|
|
28
|
+
* raised, a ruling request naming no decision the Principal may take, a
|
|
29
|
+
* required source left unreported — which a schema cannot express.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { CONFIDENCE_REASON_MAX_LENGTH } from '../../../../kernel/log/schema'
|
|
33
|
+
import { z } from 'zod/v4'
|
|
34
|
+
|
|
35
|
+
/** The one schema version this module produces and accepts. */
|
|
36
|
+
export const DEVELOPER_TURN_RESULT_SCHEMA_VERSION = 1
|
|
37
|
+
|
|
38
|
+
/** What stopped a `blocked` turn — the Developer doctrine's own stop conditions, typed. */
|
|
39
|
+
export const BLOCKER_KINDS = [
|
|
40
|
+
'dependency_unmerged',
|
|
41
|
+
'conflict_open',
|
|
42
|
+
'preflight_failed',
|
|
43
|
+
'premise_stale',
|
|
44
|
+
'brief_contradicts_code',
|
|
45
|
+
'test_failure',
|
|
46
|
+
'destructive_unauthorized',
|
|
47
|
+
'tooling_unavailable'
|
|
48
|
+
] as const
|
|
49
|
+
|
|
50
|
+
const schemaVersion = z.literal(DEVELOPER_TURN_RESULT_SCHEMA_VERSION)
|
|
51
|
+
const summary = z.string().min(1)
|
|
52
|
+
|
|
53
|
+
const SourceUseSchema = z
|
|
54
|
+
.object({
|
|
55
|
+
/** The required source exactly as the brief names it (a URL or an in-repo path). */
|
|
56
|
+
source: z.string().min(1),
|
|
57
|
+
/** What the source decided in this turn's work. */
|
|
58
|
+
use: z.string().min(1)
|
|
59
|
+
})
|
|
60
|
+
.strict()
|
|
61
|
+
|
|
62
|
+
const ReportedCheckSchema = z
|
|
63
|
+
.object({
|
|
64
|
+
command: z.string().min(1),
|
|
65
|
+
outcome: z.enum(['pass', 'fail'])
|
|
66
|
+
})
|
|
67
|
+
.strict()
|
|
68
|
+
|
|
69
|
+
export type DeveloperTurnSchemaContext = Pick<DeveloperTurnContext, 'knownFindingIds' | 'requiredSources'>
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Builds the provider schema from the same handoff and Documentation manifest
|
|
73
|
+
* the controller will later judge. `max` rather than a schema `contains`
|
|
74
|
+
* constraint is intentional: both vendors accept enum/length constraints,
|
|
75
|
+
* while the controller retains the coverage check for a duplicate source.
|
|
76
|
+
*/
|
|
77
|
+
function developerTurnResultSchema(context: DeveloperTurnSchemaContext) {
|
|
78
|
+
const sourceUses =
|
|
79
|
+
context.requiredSources.length === 0
|
|
80
|
+
? z.array(SourceUseSchema).length(0)
|
|
81
|
+
: z
|
|
82
|
+
.array(SourceUseSchema.extend({ source: z.enum(context.requiredSources as [string, ...string[]]) }))
|
|
83
|
+
.length(context.requiredSources.length)
|
|
84
|
+
const addressedFindingIds = z
|
|
85
|
+
.array(
|
|
86
|
+
context.knownFindingIds.length === 0
|
|
87
|
+
? z.string().min(1)
|
|
88
|
+
: z.enum(context.knownFindingIds as [string, ...string[]])
|
|
89
|
+
)
|
|
90
|
+
.max(context.knownFindingIds.length)
|
|
91
|
+
|
|
92
|
+
const CompletedSchema = z
|
|
93
|
+
.object({
|
|
94
|
+
schemaVersion,
|
|
95
|
+
status: z.literal('completed'),
|
|
96
|
+
summary,
|
|
97
|
+
confidence: z.number().int().min(0).max(100),
|
|
98
|
+
confidenceExplanation: z.string().min(1).max(CONFIDENCE_REASON_MAX_LENGTH),
|
|
99
|
+
addressedFindingIds,
|
|
100
|
+
sourceUses,
|
|
101
|
+
reportedChecks: z.array(ReportedCheckSchema).nullable()
|
|
102
|
+
})
|
|
103
|
+
.strict()
|
|
104
|
+
|
|
105
|
+
const BlockedSchema = z
|
|
106
|
+
.object({
|
|
107
|
+
schemaVersion,
|
|
108
|
+
status: z.literal('blocked'),
|
|
109
|
+
summary,
|
|
110
|
+
blocker: z
|
|
111
|
+
.object({
|
|
112
|
+
kind: z.enum(BLOCKER_KINDS),
|
|
113
|
+
detail: z.string().min(1)
|
|
114
|
+
})
|
|
115
|
+
.strict(),
|
|
116
|
+
sourceUses: z.array(SourceUseSchema).nullable()
|
|
117
|
+
})
|
|
118
|
+
.strict()
|
|
119
|
+
|
|
120
|
+
const NeedsRulingSchema = z
|
|
121
|
+
.object({
|
|
122
|
+
schemaVersion,
|
|
123
|
+
status: z.literal('needs_ruling'),
|
|
124
|
+
summary,
|
|
125
|
+
rulingRequest: z
|
|
126
|
+
.object({
|
|
127
|
+
question: z.string().min(1),
|
|
128
|
+
/** The decisions the Developer asks the Principal to choose between — each must be one the turn permits. */
|
|
129
|
+
decisions: z.array(z.string().min(1))
|
|
130
|
+
})
|
|
131
|
+
.strict(),
|
|
132
|
+
sourceUses: z.array(SourceUseSchema).nullable()
|
|
133
|
+
})
|
|
134
|
+
.strict()
|
|
135
|
+
|
|
136
|
+
/** The discriminated union itself — the value a turn reports. */
|
|
137
|
+
return z.discriminatedUnion('status', [CompletedSchema, BlockedSchema, NeedsRulingSchema])
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** The unconstrained type schema, used only for TypeScript inference. */
|
|
141
|
+
export const DeveloperTurnResultSchema = z.discriminatedUnion('status', [
|
|
142
|
+
z
|
|
143
|
+
.object({
|
|
144
|
+
schemaVersion,
|
|
145
|
+
status: z.literal('completed'),
|
|
146
|
+
summary,
|
|
147
|
+
confidence: z.number().int().min(0).max(100),
|
|
148
|
+
confidenceExplanation: z.string().min(1).max(CONFIDENCE_REASON_MAX_LENGTH),
|
|
149
|
+
addressedFindingIds: z.array(z.string().min(1)),
|
|
150
|
+
sourceUses: z.array(SourceUseSchema).nullable(),
|
|
151
|
+
reportedChecks: z.array(ReportedCheckSchema).nullable()
|
|
152
|
+
})
|
|
153
|
+
.strict(),
|
|
154
|
+
z
|
|
155
|
+
.object({
|
|
156
|
+
schemaVersion,
|
|
157
|
+
status: z.literal('blocked'),
|
|
158
|
+
summary,
|
|
159
|
+
blocker: z.object({ kind: z.enum(BLOCKER_KINDS), detail: z.string().min(1) }).strict(),
|
|
160
|
+
sourceUses: z.array(SourceUseSchema).nullable()
|
|
161
|
+
})
|
|
162
|
+
.strict(),
|
|
163
|
+
z
|
|
164
|
+
.object({
|
|
165
|
+
schemaVersion,
|
|
166
|
+
status: z.literal('needs_ruling'),
|
|
167
|
+
summary,
|
|
168
|
+
rulingRequest: z.object({ question: z.string().min(1), decisions: z.array(z.string().min(1)) }).strict(),
|
|
169
|
+
sourceUses: z.array(SourceUseSchema).nullable()
|
|
170
|
+
})
|
|
171
|
+
.strict()
|
|
172
|
+
])
|
|
173
|
+
|
|
174
|
+
/** The structured output the provider is asked for: the union under one root key (see the module comment). */
|
|
175
|
+
export const DeveloperTurnOutputSchema = z.object({ turnResult: DeveloperTurnResultSchema }).strict()
|
|
176
|
+
|
|
177
|
+
export type DeveloperTurnResult = z.infer<typeof DeveloperTurnResultSchema>
|
|
178
|
+
export type DeveloperTurnOutput = z.infer<typeof DeveloperTurnOutputSchema>
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The JSON Schema handed to the vendor CLI — generated from the same zod value
|
|
182
|
+
* that validates the reply. `$schema` is dropped: neither CLI needs it, and a
|
|
183
|
+
* provider that rejects unknown root keywords would refuse the whole schema.
|
|
184
|
+
*/
|
|
185
|
+
export function developerTurnResultJsonSchema(context: DeveloperTurnSchemaContext): Record<string, unknown> {
|
|
186
|
+
const output = z.object({ turnResult: developerTurnResultSchema(context) }).strict()
|
|
187
|
+
const { $schema: _dropped, ...schema } = z.toJSONSchema(output, { target: 'draft-7' }) as Record<string, unknown>
|
|
188
|
+
return schema
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** What the semantic check needs from the turn it judges. */
|
|
192
|
+
export type DeveloperTurnContext = {
|
|
193
|
+
/** Every finding id the round handed the Developer — `addressedFindingIds` may name only these. */
|
|
194
|
+
readonly knownFindingIds: readonly string[]
|
|
195
|
+
/** The brief's required documentation sources — a `completed` turn must report a use for each. */
|
|
196
|
+
readonly requiredSources: readonly string[]
|
|
197
|
+
/** The decisions a ruling request may ask the Principal for. */
|
|
198
|
+
readonly permissibleDecisions: readonly string[]
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export type TurnResultValidation =
|
|
202
|
+
| { ok: true; result: DeveloperTurnResult }
|
|
203
|
+
| { ok: false; stage: 'schema' | 'semantic'; errors: string[] }
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Providers receive the narrower per-turn schema, while this shape check
|
|
207
|
+
* accepts the shared representation so semantic diagnostics can name the
|
|
208
|
+
* missing sources or unexpected findings rather than a generic array bound.
|
|
209
|
+
*/
|
|
210
|
+
export function parseDeveloperTurnResult(value: unknown, _context: DeveloperTurnSchemaContext): TurnResultValidation {
|
|
211
|
+
const parsed = DeveloperTurnOutputSchema.safeParse(value)
|
|
212
|
+
if (!parsed.success) {
|
|
213
|
+
return {
|
|
214
|
+
ok: false,
|
|
215
|
+
stage: 'schema',
|
|
216
|
+
errors: parsed.error.issues.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`)
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return { ok: true, result: parsed.data.turnResult }
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** The semantic rules a schema cannot express, checked against the turn's own context. */
|
|
223
|
+
export function semanticErrors(result: DeveloperTurnResult, context: DeveloperTurnContext): string[] {
|
|
224
|
+
const errors: string[] = []
|
|
225
|
+
if (result.status === 'completed') {
|
|
226
|
+
const known = new Set(context.knownFindingIds)
|
|
227
|
+
if (result.addressedFindingIds.length > context.knownFindingIds.length) {
|
|
228
|
+
errors.push(
|
|
229
|
+
`addressedFindingIds: expected at most ${context.knownFindingIds.length} finding ids; valid finding ids: ${context.knownFindingIds.map((value) => JSON.stringify(value)).join(', ') || '(none)'}`
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
for (const id of result.addressedFindingIds) {
|
|
233
|
+
if (!known.has(id))
|
|
234
|
+
errors.push(
|
|
235
|
+
`addressedFindingIds: unknown finding id ${JSON.stringify(id)}; valid finding ids: ${context.knownFindingIds.map((value) => JSON.stringify(value)).join(', ') || '(none)'}`
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
if (result.confidenceExplanation.length > CONFIDENCE_REASON_MAX_LENGTH) {
|
|
239
|
+
errors.push(`confidenceExplanation: longer than ${CONFIDENCE_REASON_MAX_LENGTH} characters`)
|
|
240
|
+
}
|
|
241
|
+
const reportedUses = result.sourceUses ?? []
|
|
242
|
+
if (context.requiredSources.length === 0) {
|
|
243
|
+
if (result.sourceUses === null || reportedUses.length > 0)
|
|
244
|
+
errors.push('sourceUses: expected an empty list because this turn has no required sources')
|
|
245
|
+
} else {
|
|
246
|
+
if (reportedUses.length !== context.requiredSources.length) {
|
|
247
|
+
errors.push(
|
|
248
|
+
`sourceUses: expected exactly ${context.requiredSources.length} uses for sources: ${context.requiredSources.map((value) => JSON.stringify(value)).join(', ')}`
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
const required = new Set(context.requiredSources)
|
|
252
|
+
for (const use of reportedUses) {
|
|
253
|
+
if (!required.has(use.source))
|
|
254
|
+
errors.push(
|
|
255
|
+
`sourceUses: unexpected source ${JSON.stringify(use.source)}; expected sources: ${context.requiredSources.map((value) => JSON.stringify(value)).join(', ')}`
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
const reported = new Set(reportedUses.map((u) => u.source))
|
|
259
|
+
for (const source of context.requiredSources) {
|
|
260
|
+
if (!reported.has(source))
|
|
261
|
+
errors.push(
|
|
262
|
+
`sourceUses: no use reported for required source ${JSON.stringify(source)}; expected sources: ${context.requiredSources.map((value) => JSON.stringify(value)).join(', ')}`
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (result.status === 'needs_ruling') {
|
|
268
|
+
const permissible = new Set(context.permissibleDecisions)
|
|
269
|
+
if (!result.rulingRequest.decisions.some((d) => permissible.has(d))) {
|
|
270
|
+
errors.push('rulingRequest.decisions: names no permissible decision')
|
|
271
|
+
}
|
|
272
|
+
for (const d of result.rulingRequest.decisions) {
|
|
273
|
+
if (!permissible.has(d))
|
|
274
|
+
errors.push(`rulingRequest.decisions: ${JSON.stringify(d)} is not a permissible decision`)
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return errors
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** The driver's whole acceptance check: the shape, then the semantics. Only an `ok: true` result is ever accepted. */
|
|
281
|
+
export function validateDeveloperTurnResult(value: unknown, context: DeveloperTurnContext): TurnResultValidation {
|
|
282
|
+
const parsed = parseDeveloperTurnResult(value, context)
|
|
283
|
+
if (!parsed.ok) return parsed
|
|
284
|
+
const errors = semanticErrors(parsed.result, context)
|
|
285
|
+
return errors.length > 0 ? { ok: false, stage: 'semantic', errors } : parsed
|
|
286
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_title: Developer
|
|
3
|
+
title: Developer
|
|
4
|
+
order: 3
|
|
5
|
+
role_id: developer
|
|
6
|
+
description: The coding agent that executes a brief — writes the change, opens the pull request, and answers for it.
|
|
7
|
+
actor: agent
|
|
8
|
+
ack-token: 1a2c7690
|
|
9
|
+
denied-tools:
|
|
10
|
+
- author-own-brief
|
|
11
|
+
- write-status
|
|
12
|
+
- review-own-work
|
|
13
|
+
- merge
|
|
14
|
+
- settle-contested-architecture
|
|
15
|
+
- skip-verification-hook
|
|
16
|
+
- commit-report-only-file
|
|
17
|
+
performs:
|
|
18
|
+
- write-the-code
|
|
19
|
+
- write-the-tests
|
|
20
|
+
- pass-typecheck-lint-hooks
|
|
21
|
+
- open-the-pull-request
|
|
22
|
+
- run-agent-test-plan-items
|
|
23
|
+
- address-review-findings
|
|
24
|
+
refuses_when: >
|
|
25
|
+
Input isn't a well-formed brief (missing tier/scope/stop-conditions);
|
|
26
|
+
a dispatch gate is unmet (unmerged depends-on, an open conflicts-with PR);
|
|
27
|
+
the task Issue is #TBD or blank; a named product's previous tranche is
|
|
28
|
+
complete but not archived; the task's row doesn't exist yet in the
|
|
29
|
+
tranche's forge-derived task list; or the Step 0 branch name doesn't
|
|
30
|
+
literal-match the topology row. (2026-07-13: the prior task's
|
|
31
|
+
provenance block is NO LONGER a refusal condition — superseded.)
|
|
32
|
+
summary: Ever had someone review their own work?
|
|
33
|
+
---
|
|
34
|
+
# Developer — Role Reference
|
|
35
|
+
|
|
36
|
+
**Read receipt — do this first.** `vinaya doctrine --role developer --print`'s output begins with a fixed acknowledgement token, one line, before anything else. Your first message in this session must repeat that exact token verbatim — e.g. `ACK: <token>` — so a transcript proves this doctrine was read, checked with one grep. The token lives only in this file's frontmatter, never in this paragraph, so editing this paragraph never invalidates a past session's proof. A session the review loop dispatched gives no receipt: the driver puts this role's short version and checklist in your prompt itself and reads only your turn's result or output files.
|
|
37
|
+
|
|
38
|
+
## The short version
|
|
39
|
+
|
|
40
|
+
You execute **one** brief, on **one** branch, and answer for it. You are the only role that writes code.
|
|
41
|
+
|
|
42
|
+
**You own** — the code, the tests, and the documentation the brief names; a clean typecheck, lint, test and production build; the worktree; and the pull request, carrying the report, its impact tier, and the issue it closes. Your turn's token use is the log's to record, never the body's. The brief lives elsewhere — dispatch tooling posts it, frozen, on the tracking issue before you start; you never author it.
|
|
43
|
+
|
|
44
|
+
**You refuse** — to start, when the input is not a well-formed brief, when a task you depend on has not merged, when a conflicting task is still open, when the task has no issue yet, when the previous tranche of a product you touch was never closed out, or when the branch name you were handed does not match the task; and to continue, when a pre-flight check fails, when the brief contradicts the code irreconcilably (the reference defines it), when a test still fails after repeated genuine diagnosis, or when an action would be destructive and the brief never authorized it. Refusing is reporting what blocks you, not improvising past it.
|
|
45
|
+
|
|
46
|
+
**You never** author your own brief, write status anywhere, review or approve your own work, merge, settle a contested architectural question, skip a verification hook to get a commit through, or commit a new file whose only purpose is to hold a report.
|
|
47
|
+
|
|
48
|
+
**How it physically runs** — you work in a git worktree of your own, at `.worktrees/task/<tranche>/<n>`, on a branch `task/<tranche>/<n>` cut from the tip of the main branch, never a local checkout that may be behind. Under the review loop the driver creates it, outside any sandbox, before your first turn; working manually, you create it yourself. That branch name is the whole addressing scheme — every other role finds this task's branch, its pull request and its state from that one string, so it must match exactly. The frozen brief was posted on the tracking issue before you started; the pull-request description carries the report. No file records progress: the branch, the open pull request, and the merge landing **are** the status.
|
|
49
|
+
|
|
50
|
+
**Who commits and publishes.** Under the review loop, Claude and Codex alike, you hold no forge credential and run no `git push` or `gh`: you publish, open and read your pull request, and run its checks only through tools the driver runs outside your sandbox — `publish_changes`, `open_pull_request`, `read_pull_request`, `run_checks` — each returning a success or a refusal you act on. Working manually, you do it all yourself (reference).
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Reference
|
|
56
|
+
|
|
57
|
+
**Audience:** the coding agent (whatever CLI/IDE agent the team uses), executing a dispatched brief.
|
|
58
|
+
|
|
59
|
+
You are the Developer when you are running in a coding-agent surface, a task brief has been dispatched to you (pasted in chat, or by an automation layer), and the brief tells you to execute specific work. You are executing — not planning, not strategizing, not authoring briefs.
|
|
60
|
+
|
|
61
|
+
<!-- VINAYA:CLAIM: harness/processes/vinaya-strict/loops/dev-review/dispatch/dispatch.ts contains:VINAYA_ROLE: role, -->
|
|
62
|
+
<!-- VINAYA:CLAIM: harness/kernel/log/envelope.ts contains:isRole(input.env.role) ? input.env.role : 'unattributed' -->
|
|
63
|
+
A turn started via `vinaya-dispatch developer --agent <vendor>` carries its role and task in every `vinaya` call it makes; one started by hand in a terminal reads `unattributed` in the Vinaya Log, which is the truth about it.
|
|
64
|
+
|
|
65
|
+
<!-- VINAYA:CLAIM: harness/processes/vinaya-strict/loops/dev-review/dispatch/dispatch.ts contains:VINAYA_DRIVER_PID: String(process.pid), -->
|
|
66
|
+
**Your own driver is not a competing run.** That same turn carries its driver's process id as `VINAYA_DRIVER_PID`. A `vinaya task run` or review-loop process whose process id is that value is your OWN driver — the process that launched you, and whose log header names the same id — never a second run on your branch, and finding it is never a reason to stop. Only a second driver for the same task, with a DIFFERENT process id, is a conflict; escalate that one rather than proceeding.
|
|
67
|
+
|
|
68
|
+
**The machine you run on is not yours to change.** You never alter its keychain, its services or its global settings, and a test that genuinely needs one of those runs against a fake instead of the real thing. The permission policy a dispatched session carries refuses those commands — the same list, under the same version, whichever coding agent the loop dispatched you through, expressed in that agent's own command-policy grammar and written fresh for that one run — but it is a floor, not a sandbox: it matches the command you typed against a list of names, so what it cannot answer for is the same command reached another way — behind a wrapper word, through another interpreter, or inside a script you wrote and then run.
|
|
69
|
+
|
|
70
|
+
> **Toolchain is per-repo.** This role names obligations (tests pass, typecheck passes, lint passes, production build passes), not specific commands. Each repo declares its own commands — the exact `typecheck` / `lint` / `test` / `build` invocations live in the repo's config (e.g. `package.json` scripts, a Makefile, the brief's verification section). Where this doc shows commands, they are **this repo's** instances (a Bun/JS toolchain) — substitute your repo's equivalents.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## When you are the Developer
|
|
75
|
+
|
|
76
|
+
- Running in a coding-agent CLI or IDE surface
|
|
77
|
+
- A task brief has been pasted, or dispatched by an automation layer
|
|
78
|
+
- The brief says to build, fix, refactor, document, or validate something specific
|
|
79
|
+
|
|
80
|
+
You are NOT the Developer if you are in a chat/planning surface talking with the Principal about strategy or planning. That's the Planner role. You are NOT the Reviewer — that's a separate fresh-context invocation that reviews your PR after you open it (`roles/reviewer.md`, `roles/security.md`). Environment determines role.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Entry gate (self-locating)
|
|
85
|
+
|
|
86
|
+
Every condition below holds before step 0, or the task does not start — the refusal the short version names. **Under the review loop (`vinaya task run`)** the driver checks them for you, from its own process outside your sandbox, before your turn starts: it runs the `dispatch-readiness` gate and, on this repo's toolchain, the fuller `verify-dispatch.ts` derivation against a freshly fetched `origin/main` and the live forge, creates the task branch itself, re-checks the brief's premises, and dispatches you only on a READY verdict — being dispatched is the verdict, and its `publish_changes` tool refuses a worktree on any other branch. The `first-push-dispatch` check runs the forge items again on a task branch's first push, from the managed pre-push hook and from CI. **Working manually, with no driver** (`vinaya-dispatch` or a bare terminal), confirm each item by hand, as written — each is a complete forge check in its own right.
|
|
87
|
+
|
|
88
|
+
1. **A well-formed brief.** It carries tier, scope, stop conditions, and a deliverable. A loose prompt is not a brief → *"This isn't a brief — it's missing tier / scope / stop-conditions. Get one dispatched from the Planner; I don't infer scope from a prompt."* In a multi-project repo, its `Project:` resolves against `.vinaya/projects.md` → otherwise *"Project 'x' isn't registered."*
|
|
89
|
+
2. **Dispatch gates.** Read from the forge — status is derived, not stored:
|
|
90
|
+
- Every `depends-on` task's **PR is merged**. If not → *"Task N depends on <dep>, whose PR isn't merged yet. Not starting — it serializes behind it."*
|
|
91
|
+
- No `conflicts-with` sibling has an **open PR** (or is otherwise in-flight). If one does → *"Task N conflicts with <sibling>, whose PR is open. Not starting until it merges."*
|
|
92
|
+
3. **The task has an Issue.** On the forge — a `vinaya/tranche:<slug>`-labeled Issue titled `[<slug>] <n> — …`, in the tranche's Milestone — the task carries a real Issue number, not `#TBD` and not blank; the PR's `Closes #N` needs it. If not → *"Task <id> in tranche `<name>` has no Issue (#TBD) — it is not dispatchable. The Planner cuts the Issue before this task can start."* See `doctrine/contracts/planner-developer.md`.
|
|
93
|
+
4. **Retired: the prior-task provenance check.** Automated post-merge provenance posting replaced it, so the previous task's PR carrying no provenance comment holds no task back. Its former queries — the last merged task PR, then its provenance comment, the pattern now naming the current heading — kept so this list's numbering and older transcripts still resolve:
|
|
94
|
+
```
|
|
95
|
+
gh pr list --state merged --json number,headRefName,mergedAt \
|
|
96
|
+
| jq '[.[] | select(.headRefName | startswith("task/<tranche>/"))] | sort_by(.mergedAt) | last'
|
|
97
|
+
```
|
|
98
|
+
```
|
|
99
|
+
gh pr view <N> --json comments \
|
|
100
|
+
| jq '.comments[].body | select(test("Vinaya.*provenance|provenance.*task"; "i"))'
|
|
101
|
+
```
|
|
102
|
+
5. **The previous tranche is archived.** For each product the brief's `Project:` names, no prior tranche for that product still has an open Milestone with all its task PRs merged (a tranche planned before the forge-native cutover: `tranche-model.md` §4). If one does → *"Product `<X>`'s previous tranche `<name>` is complete but not archived — the Tranche Archivist runs before new work on this product. Dispatch it first."* No prior tranche passes trivially. See `doctrine/contracts/tranche-archivist-planner.md`.
|
|
103
|
+
6. **The branch name matches the task.** The branch suffix in the Step 0 you were handed literal-matches this task's forge-derived id `<n>` — character for character: no added prefix, no case change, no truncation. If not → *"The Step 0 branch name `task/<tranche>/<X>` doesn't match this task's topology ID `<Y>` — stopping here; the Planner/Principal settles which name is right."*
|
|
104
|
+
7. **The task exists.** This task's Issue is present in the tranche's forge-derived task list at all — distinct from item 3's `#TBD` check: a missing row means its plan or Issue has not merged or opened, and there is nothing to inspect. If not → *"Task <id> is not present in tranche `<name>`'s forge-derived task list (no `vinaya/tranche:<name>`-labeled Issue with this task id yet). Not dispatchable until it is."*
|
|
105
|
+
8. **Documentation sources are read.** Every source in the brief's own `## Documentation` section is fetched (a URL) or read (an in-repo path) in full before step 0. The PR body's Decisions section (see [§ PR body — canonical form](reference.md#pr-body--canonical-form)) records, for each, the mechanism you confirmed it governs and the runtime or protocol version it states — a value read off the source, or `unverifiable: <why>` when the source states none and nothing on this host can check one; a guessed version is a fabrication. Under the review loop the driver records each URL read through its `fetch_documentation` tool, holds your turn open while a URL source is unread, and the turn-result validator accepts `sourceUses` only for a source it recorded; an in-repo path's read is not observed, so it rests on you alone. On this repo's toolchain the hold is a `PostToolUse` hook plus a `Stop` hook in the dispatched session's settings (`harness/processes/vinaya-strict/loops/dev-review/loop.md`, "The Documentation read-gate").
|
|
106
|
+
|
|
107
|
+
Working manually, `PREMISE_FILE=<body-file> vinaya-check dispatch-readiness` run from the task branch (the body file being the brief text) re-asserts a brief's `Premise:` block against the checked-out files, alongside the check's forge readiness findings; off a task branch, or when its forge read fails, it gives no premise verdict at all; a stale premise means the surface moved since the brief was rendered — stop and re-dig (`doctrine/contracts/planner-developer.md`).
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
For the full procedure — the PR body's canonical form, worktree discipline, commit conventions, the review handoff, the Verification phase, the pre-merge gate, and every anti-pattern this role has hit in practice — see [`roles/developer/reference.md`](reference.md).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Evaluation cases for the developer role belong here.
|