@attalabs/vinaya 0.44.1 → 0.47.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 +6 -4
- package/dist/checks/bin/check-body-bare-digits.js +233 -195
- package/dist/checks/bin/check-branch-topology.js +70 -23
- package/dist/checks/bin/check-brief-shape.js +233 -195
- package/dist/checks/bin/check-changeset-coverage.js +94 -16
- package/dist/checks/bin/check-ci-shard-coverage.js +3 -0
- package/dist/checks/bin/check-closes-n.js +128 -34
- package/dist/checks/bin/check-coherence.js +336 -245
- package/dist/checks/bin/check-dispatch-readiness.js +3623 -463
- package/dist/checks/bin/check-doc-claims.js +233 -195
- package/dist/checks/bin/check-doc-coverage-push.js +243 -196
- package/dist/checks/bin/check-doc-coverage.js +243 -196
- package/dist/checks/bin/check-doctrine-no-procedures.js +233 -195
- package/dist/checks/bin/check-doctrine-portability.js +233 -195
- package/dist/checks/bin/check-evidence-fresh.js +9983 -1995
- package/dist/checks/bin/check-exec-bits.js +3 -0
- package/dist/checks/bin/check-first-push-dispatch.js +301 -224
- package/dist/checks/bin/check-issue-milestone-attach.js +65 -10
- package/dist/checks/bin/check-issue-objectives-numbering.js +233 -195
- package/dist/checks/bin/check-issue-parts-coverage.js +65 -10
- package/dist/checks/bin/check-issue-surface-globs.js +1032 -236
- package/dist/checks/bin/check-issue-title-grammar.js +5 -1
- package/dist/checks/bin/check-no-disk-state.js +5 -1
- package/dist/checks/bin/check-pr-premise-reassert.js +10 -1
- package/dist/checks/bin/check-pr-report-density.js +5 -1
- package/dist/checks/bin/check-principal-test-plan-wait.js +253 -201
- package/dist/checks/bin/check-quoted-command.js +233 -195
- package/dist/checks/bin/check-reader-resolvable-prose.js +233 -195
- package/dist/checks/bin/check-registry-gates.js +131 -34
- package/dist/checks/bin/check-retired-vocabulary.js +233 -195
- package/dist/checks/bin/check-review-gate.js +233 -195
- package/dist/checks/bin/check-single-plan-pr.js +5 -1
- package/dist/checks/bin/check-surface-scope.js +107 -32
- package/dist/checks/bin/check-test-plan.js +253 -201
- package/dist/checks/bin/check-token-collection-wired.js +3 -0
- package/dist/checks/bin/check-workspace-escape.js +3 -0
- package/dist/checks/bin/verify-coherence.js +237 -148
- package/dist/checks/bin/verify-dispatch.js +870 -66
- package/dist/checks/bin/verify-docs.js +13 -6
- package/dist/harness.js +57 -10
- package/dist/index.js +16617 -7187
- package/dist/lib/pre-push-cache-test-run.js +4487 -2170
- package/dist/lib/pre-push-changed-files.js +251 -12
- package/dist/lib/pre-push-mode.js +69 -19
- package/dist/lib/pre-push-progress-dir.js +10265 -2853
- package/dist/lib/pre-push-record-tests.js +67 -19
- package/dist/lib/pre-push-select-tests.js +520 -222
- package/dist/lib/push-progress-observer.js +9176 -1757
- package/dist/process.js +2 -0
- package/dist/programs/archive.js +8948 -1547
- package/dist/programs/audit.js +9176 -1772
- package/dist/programs/check.js +9248 -1845
- package/dist/programs/commit-msg.js +8984 -1583
- package/dist/programs/dev-review-loop.js +15612 -7634
- package/dist/programs/dispatch.js +9977 -2726
- package/dist/programs/log-emit.js +9011 -1660
- package/dist/programs/log-selftest.js +8908 -1507
- package/dist/programs/log-send.js +9081 -1594
- package/dist/programs/pr-report.js +9476 -1820
- package/dist/programs/pr-snapshot.js +8916 -1515
- package/dist/programs/pr-verify-evidence.js +9481 -1825
- package/dist/programs/pr.js +11709 -4033
- package/dist/programs/review-post.js +11140 -3496
- package/dist/programs/review-status.js +8996 -1533
- package/dist/programs/run-engine.js +22031 -18759
- package/dist/programs/sync.js +9030 -1629
- package/dist/programs/task-brief.js +10185 -1821
- package/dist/programs/task-sweep.js +9266 -1621
- package/dist/programs/task-tools-serve.js +77118 -16678
- package/dist/programs/tokens.js +8966 -1565
- package/dist/programs/waiver.js +8983 -1582
- package/dist/types/harness/kernel/dev-process-socket/loader/load-process.d.ts +1 -1
- package/dist/types/harness/processes/vinaya-strict/tools/legacy-markers.d.ts +8 -0
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/brief-validation.d.ts +3 -3
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
- package/dist/vinaya-strict/checks/registry.ts +2 -2
- package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
- package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
- package/dist/vinaya-strict/executing/developer/reference.md +5 -3
- package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
- package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
- package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
- package/dist/vinaya-strict/process.yaml +6 -1
- package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
- package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
- package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
- package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
- package/package.json +3 -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/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- 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/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
- package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +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/server/preview-props.json +3 -3
- package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
- package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
- package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
- package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
- package/vinaya-strict/artifacts/templates/brief-template.md +4 -0
- package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
- package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
- package/vinaya-strict/doctrine/contracts/planner-developer.md +2 -1
- package/vinaya-strict/doctrine/enforcement.md +4 -4
- package/vinaya-strict/doctrine/roles/principal.md +1 -1
- package/vinaya-strict/doctrine/state-machine.md +7 -2
- package/vinaya-strict/executing/developer/reference.md +5 -3
- package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
- package/vinaya-strict/thinking/planner/doctrine.md +4 -1
- package/vinaya-strict/thinking/planner/reference.md +29 -8
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
- package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
- /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
|
@@ -20,32 +20,68 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
|
20
20
|
import { tmpdir } from 'node:os'
|
|
21
21
|
import { join } from 'node:path'
|
|
22
22
|
import { z } from 'zod'
|
|
23
|
-
import { taskToolError, type TaskToolError } from '
|
|
24
|
-
import type { SeatCallResult, SeatHandler } from '
|
|
25
|
-
import type { McpToolListEntry } from '
|
|
26
|
-
import type { CheckError } from '
|
|
23
|
+
import { taskToolError, type TaskToolError } from '@harness/kernel/tools/catalog/task-tools'
|
|
24
|
+
import type { SeatCallResult, SeatHandler } from '@harness/kernel/tools/host/seat-host.js'
|
|
25
|
+
import type { McpToolListEntry } from '@harness/kernel/tools/mcp-protocol.js'
|
|
26
|
+
import type { CheckError } from '@harness/kernel/gates/checks/contract'
|
|
27
27
|
import {
|
|
28
|
+
checkStoredPlanDraft,
|
|
28
29
|
createIssue,
|
|
30
|
+
editDocumentation,
|
|
29
31
|
editIssue,
|
|
30
32
|
editObjectives,
|
|
33
|
+
previewStoredPlanDraft,
|
|
31
34
|
printIssueSurface,
|
|
35
|
+
readStoredPlanDraft,
|
|
32
36
|
renderBrief,
|
|
37
|
+
submitPlanDraft,
|
|
38
|
+
type BriefInput as BriefAddress,
|
|
33
39
|
type BriefOutcome,
|
|
40
|
+
type DocumentationEditInput,
|
|
41
|
+
type DocumentationOutcome,
|
|
42
|
+
type DraftCheckOutcome,
|
|
43
|
+
type DraftPreviewOutcome,
|
|
44
|
+
type DraftReadOutcome,
|
|
45
|
+
type DraftSubmitOutcome,
|
|
46
|
+
approveStoredPlanReview,
|
|
47
|
+
decideStoredPlanReview,
|
|
48
|
+
publishApprovedTasks,
|
|
49
|
+
readStoredPlanReviewStatusWithDrift,
|
|
50
|
+
startStoredPlanReview,
|
|
51
|
+
type PublishOutcome,
|
|
34
52
|
type IssueWriteOutcome,
|
|
35
53
|
type ObjectivesOutcome,
|
|
36
54
|
type SurfaceOutcome
|
|
37
55
|
} from './planner-operations'
|
|
56
|
+
import { PlanDraftSchema } from '@harness/workflow/tools/plan-draft/draft'
|
|
57
|
+
import type {
|
|
58
|
+
ApproveOutcome,
|
|
59
|
+
DecideOutcome,
|
|
60
|
+
DecisionChoice,
|
|
61
|
+
StartOutcome,
|
|
62
|
+
StatusOutcome
|
|
63
|
+
} from '@harness/workflow/tools/plan-review/coordinator'
|
|
38
64
|
|
|
39
65
|
// --- names ------------------------------------------------------------------
|
|
40
66
|
|
|
41
|
-
/** The
|
|
67
|
+
/** The tools the Planner's seat is granted, in the order the seat lists them. */
|
|
42
68
|
export const PLANNER_TOOL_NAMES = [
|
|
43
69
|
'task_issue_create',
|
|
44
70
|
'task_issue_edit',
|
|
45
71
|
'task_issue_surface',
|
|
46
72
|
'task_objectives_edit',
|
|
73
|
+
'task_documentation_edit',
|
|
47
74
|
'brief_render',
|
|
48
|
-
'task_issue_validate'
|
|
75
|
+
'task_issue_validate',
|
|
76
|
+
'plan_draft_submit',
|
|
77
|
+
'plan_draft_read',
|
|
78
|
+
'plan_draft_check',
|
|
79
|
+
'plan_draft_preview',
|
|
80
|
+
'plan_review_start',
|
|
81
|
+
'plan_review_status',
|
|
82
|
+
'plan_review_decide',
|
|
83
|
+
'plan_approve',
|
|
84
|
+
'plan_publish'
|
|
49
85
|
] as const
|
|
50
86
|
|
|
51
87
|
export type PlannerToolName = (typeof PLANNER_TOOL_NAMES)[number]
|
|
@@ -145,8 +181,40 @@ const ObjectivesInput = z.discriminatedUnion('op', [
|
|
|
145
181
|
.strict()
|
|
146
182
|
])
|
|
147
183
|
|
|
184
|
+
const DocumentationInput = z
|
|
185
|
+
.object({ issue: issueNumber, documentation: z.string().min(1), reason: z.string().min(1) })
|
|
186
|
+
.strict()
|
|
187
|
+
|
|
148
188
|
const BriefInput = z
|
|
149
|
-
.object({
|
|
189
|
+
.object({
|
|
190
|
+
tranche: z.string().min(1).optional(),
|
|
191
|
+
id: z.string().min(1).optional(),
|
|
192
|
+
globs: z.array(z.string().min(1)).optional(),
|
|
193
|
+
issue: issueNumber.optional()
|
|
194
|
+
})
|
|
195
|
+
.strict()
|
|
196
|
+
.refine(
|
|
197
|
+
(v) =>
|
|
198
|
+
v.issue !== undefined
|
|
199
|
+
? v.tranche === undefined && v.id === undefined && v.globs === undefined
|
|
200
|
+
: v.tranche !== undefined && v.id !== undefined,
|
|
201
|
+
{ message: 'give either an Issue number alone, or a tranche with a task id — one address per call' }
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
const DraftReadInput = z.object({ tranche: z.string().min(1) }).strict()
|
|
205
|
+
const DraftCheckInput = DraftReadInput
|
|
206
|
+
const DraftPreviewInput = z.object({ tranche: z.string().min(1), task: issueNumber.optional() }).strict()
|
|
207
|
+
const PublishInput = z.object({ tranche: z.string().min(1), tasks: z.array(issueNumber).min(1).optional() }).strict()
|
|
208
|
+
const ReviewStartInput = DraftReadInput
|
|
209
|
+
const ReviewStatusInput = DraftReadInput
|
|
210
|
+
const ReviewApproveInput = z.object({ tranche: z.string().min(1), fingerprint: z.string().min(1) }).strict()
|
|
211
|
+
|
|
212
|
+
const ReviewDecideInput = z
|
|
213
|
+
.object({
|
|
214
|
+
tranche: z.string().min(1),
|
|
215
|
+
fingerprint: z.string().min(1),
|
|
216
|
+
choice: z.enum(['allow_one_more', 'stop'])
|
|
217
|
+
})
|
|
150
218
|
.strict()
|
|
151
219
|
|
|
152
220
|
// --- JSON Schemas (the wire needs them; Zod 3 ships no exporter) ---------------
|
|
@@ -163,6 +231,112 @@ const FINDING_JSON_SCHEMA = {
|
|
|
163
231
|
} as const
|
|
164
232
|
const FINDINGS_ARRAY = { type: 'array', items: FINDING_JSON_SCHEMA } as const
|
|
165
233
|
|
|
234
|
+
/** A review finding as the coordinator stores it: open, resolved or a note, with the id a confirmation names. */
|
|
235
|
+
const STORED_FINDING_JSON_SCHEMA = {
|
|
236
|
+
type: 'object',
|
|
237
|
+
properties: {
|
|
238
|
+
id: { type: 'string' },
|
|
239
|
+
round: { type: 'integer' },
|
|
240
|
+
question: { type: 'integer' },
|
|
241
|
+
task: { type: ['integer', 'null'] },
|
|
242
|
+
state: { enum: ['open', 'resolved', 'note'] },
|
|
243
|
+
resolution: { type: 'string', description: 'What would resolve it.' },
|
|
244
|
+
evidence: { type: 'array', items: { type: 'object' } },
|
|
245
|
+
resolvedInRound: { type: ['integer', 'null'] }
|
|
246
|
+
},
|
|
247
|
+
required: ['id', 'round', 'question', 'task', 'state', 'resolution', 'evidence', 'resolvedInRound'],
|
|
248
|
+
additionalProperties: false
|
|
249
|
+
} as const
|
|
250
|
+
|
|
251
|
+
/** Where a plan's review stands for the stored draft's current fingerprint. */
|
|
252
|
+
const REVIEW_STATUS_JSON_SCHEMA = {
|
|
253
|
+
type: 'object',
|
|
254
|
+
properties: {
|
|
255
|
+
tranche: { type: 'string' },
|
|
256
|
+
fingerprint: { type: 'string' },
|
|
257
|
+
roundsSpent: { type: 'integer' },
|
|
258
|
+
roundsAllowed: { type: 'integer' },
|
|
259
|
+
roundLimit: { type: 'integer' },
|
|
260
|
+
approved: {
|
|
261
|
+
type: 'boolean',
|
|
262
|
+
description: 'True only when the latest round judged this exact fingerprint and approved it.'
|
|
263
|
+
},
|
|
264
|
+
principalApproved: {
|
|
265
|
+
type: 'boolean',
|
|
266
|
+
description:
|
|
267
|
+
'True when the Principal approved this exact fingerprint; publication needs it and `approved` together.'
|
|
268
|
+
},
|
|
269
|
+
principalApprovalStale: {
|
|
270
|
+
type: 'boolean',
|
|
271
|
+
description: 'The Principal approved only an earlier fingerprint: that approval does not apply to this draft.'
|
|
272
|
+
},
|
|
273
|
+
stale: {
|
|
274
|
+
type: 'boolean',
|
|
275
|
+
description: 'A round exists but judged a different fingerprint: its verdict does not apply.'
|
|
276
|
+
},
|
|
277
|
+
lastVerdict: { enum: ['approved', 'not_approved', null] },
|
|
278
|
+
approvedTasks: { type: 'array', items: { type: 'integer' } },
|
|
279
|
+
openFindings: { type: 'array', items: STORED_FINDING_JSON_SCHEMA },
|
|
280
|
+
notes: { type: 'array', items: STORED_FINDING_JSON_SCHEMA },
|
|
281
|
+
resolvedFindings: { type: 'array', items: STORED_FINDING_JSON_SCHEMA },
|
|
282
|
+
stopped: { type: 'boolean' },
|
|
283
|
+
limitReached: { type: 'boolean', description: 'Review has stopped: only the Principal decides what follows.' },
|
|
284
|
+
nextScope: { type: ['object', 'null'], description: 'What the next round judges; null before the first round.' },
|
|
285
|
+
decisions: { type: 'array', items: { type: 'object' } },
|
|
286
|
+
drift: {
|
|
287
|
+
type: 'object',
|
|
288
|
+
description:
|
|
289
|
+
"Each published task of the draft against its live Issue's title and body: `matching` tasks, `drifted` tasks (naming title, body or both) and `unread` tasks whose Issue could not be read.",
|
|
290
|
+
properties: {
|
|
291
|
+
matching: { type: 'array', items: { type: 'integer' } },
|
|
292
|
+
drifted: {
|
|
293
|
+
type: 'array',
|
|
294
|
+
items: {
|
|
295
|
+
type: 'object',
|
|
296
|
+
properties: {
|
|
297
|
+
task: { type: 'integer' },
|
|
298
|
+
issue: { type: 'integer' },
|
|
299
|
+
differs: { enum: ['title', 'body', 'both'] }
|
|
300
|
+
},
|
|
301
|
+
required: ['task', 'issue', 'differs'],
|
|
302
|
+
additionalProperties: false
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
unread: {
|
|
306
|
+
type: 'array',
|
|
307
|
+
items: {
|
|
308
|
+
type: 'object',
|
|
309
|
+
properties: { task: { type: 'integer' }, issue: { type: 'integer' }, reason: { type: 'string' } },
|
|
310
|
+
required: ['task', 'issue', 'reason'],
|
|
311
|
+
additionalProperties: false
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
required: ['matching', 'drifted', 'unread'],
|
|
316
|
+
additionalProperties: false
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
required: [
|
|
320
|
+
'tranche',
|
|
321
|
+
'fingerprint',
|
|
322
|
+
'roundsSpent',
|
|
323
|
+
'roundsAllowed',
|
|
324
|
+
'roundLimit',
|
|
325
|
+
'approved',
|
|
326
|
+
'stale',
|
|
327
|
+
'lastVerdict',
|
|
328
|
+
'approvedTasks',
|
|
329
|
+
'openFindings',
|
|
330
|
+
'notes',
|
|
331
|
+
'resolvedFindings',
|
|
332
|
+
'stopped',
|
|
333
|
+
'limitReached',
|
|
334
|
+
'nextScope',
|
|
335
|
+
'decisions'
|
|
336
|
+
],
|
|
337
|
+
additionalProperties: false
|
|
338
|
+
} as const
|
|
339
|
+
|
|
166
340
|
const WRITTEN_OUTPUT = {
|
|
167
341
|
type: 'object',
|
|
168
342
|
properties: {
|
|
@@ -175,6 +349,61 @@ const WRITTEN_OUTPUT = {
|
|
|
175
349
|
additionalProperties: false
|
|
176
350
|
} as const
|
|
177
351
|
|
|
352
|
+
const DRAFT_JSON_SCHEMA = {
|
|
353
|
+
type: 'object',
|
|
354
|
+
properties: {
|
|
355
|
+
schemaVersion: { const: 1 },
|
|
356
|
+
tranche: { type: 'string', pattern: '^[A-Za-z0-9][A-Za-z0-9-]*$' },
|
|
357
|
+
revision: { type: 'string', pattern: '^[0-9a-f]{40}$', description: 'A commit of the default branch.' },
|
|
358
|
+
reviewQuestionVersion: str,
|
|
359
|
+
tasks: {
|
|
360
|
+
type: 'array',
|
|
361
|
+
minItems: 1,
|
|
362
|
+
items: {
|
|
363
|
+
type: 'object',
|
|
364
|
+
properties: {
|
|
365
|
+
number: { ...issueSchema, description: 'The tranche task number, stable before and after publication.' },
|
|
366
|
+
issue: { type: ['integer', 'null'], minimum: 1, description: "The published Issue's number; null before." },
|
|
367
|
+
title: str,
|
|
368
|
+
body: str,
|
|
369
|
+
labels: labelsSchema
|
|
370
|
+
},
|
|
371
|
+
required: ['number', 'issue', 'title', 'body', 'labels'],
|
|
372
|
+
additionalProperties: false
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
scope: {
|
|
376
|
+
type: 'array',
|
|
377
|
+
items: {
|
|
378
|
+
type: 'object',
|
|
379
|
+
properties: {
|
|
380
|
+
item: str,
|
|
381
|
+
disposition: {
|
|
382
|
+
oneOf: [
|
|
383
|
+
{
|
|
384
|
+
type: 'object',
|
|
385
|
+
properties: { kind: { const: 'delivered' }, task: issueSchema },
|
|
386
|
+
required: ['kind', 'task'],
|
|
387
|
+
additionalProperties: false
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
type: 'object',
|
|
391
|
+
properties: { kind: { const: 'left-out' }, reason: str },
|
|
392
|
+
required: ['kind', 'reason'],
|
|
393
|
+
additionalProperties: false
|
|
394
|
+
}
|
|
395
|
+
]
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
required: ['item', 'disposition'],
|
|
399
|
+
additionalProperties: false
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
required: ['schemaVersion', 'tranche', 'revision', 'reviewQuestionVersion', 'tasks', 'scope'],
|
|
404
|
+
additionalProperties: false
|
|
405
|
+
} as const
|
|
406
|
+
|
|
178
407
|
/** The input JSON Schema of each tool. */
|
|
179
408
|
export const PLANNER_TOOL_INPUT_JSON_SCHEMAS: Record<PlannerToolName, Record<string, unknown>> = {
|
|
180
409
|
task_issue_create: {
|
|
@@ -208,10 +437,28 @@ export const PLANNER_TOOL_INPUT_JSON_SCHEMAS: Record<PlannerToolName, Record<str
|
|
|
208
437
|
required: ['op', 'issue', 'reason'],
|
|
209
438
|
additionalProperties: false
|
|
210
439
|
},
|
|
440
|
+
task_documentation_edit: {
|
|
441
|
+
type: 'object',
|
|
442
|
+
properties: {
|
|
443
|
+
issue: issueSchema,
|
|
444
|
+
documentation: {
|
|
445
|
+
...str,
|
|
446
|
+
description:
|
|
447
|
+
'The whole new `## Documentation` section: its source lines, or the `None` sentinel; the heading may be left out.'
|
|
448
|
+
},
|
|
449
|
+
reason: { ...str, description: "One line: it becomes the superseding brief's reason." }
|
|
450
|
+
},
|
|
451
|
+
required: ['issue', 'documentation', 'reason'],
|
|
452
|
+
additionalProperties: false
|
|
453
|
+
},
|
|
211
454
|
brief_render: {
|
|
212
455
|
type: 'object',
|
|
213
|
-
properties: {
|
|
214
|
-
|
|
456
|
+
properties: {
|
|
457
|
+
tranche: { ...str, description: 'The tranche slug, with id; never with issue.' },
|
|
458
|
+
id: { ...str, description: 'The task id within the tranche, with tranche; never with issue.' },
|
|
459
|
+
globs: { type: 'array', items: str },
|
|
460
|
+
issue: { ...issueSchema, description: 'A single Issue by number, alone; never with tranche and id.' }
|
|
461
|
+
},
|
|
215
462
|
additionalProperties: false
|
|
216
463
|
},
|
|
217
464
|
task_issue_validate: {
|
|
@@ -228,6 +475,75 @@ export const PLANNER_TOOL_INPUT_JSON_SCHEMAS: Record<PlannerToolName, Record<str
|
|
|
228
475
|
},
|
|
229
476
|
required: ['mode', 'body'],
|
|
230
477
|
additionalProperties: false
|
|
478
|
+
},
|
|
479
|
+
plan_draft_submit: DRAFT_JSON_SCHEMA,
|
|
480
|
+
plan_draft_read: {
|
|
481
|
+
type: 'object',
|
|
482
|
+
properties: { tranche: { ...str, description: 'The tranche slug of the draft to read.' } },
|
|
483
|
+
required: ['tranche'],
|
|
484
|
+
additionalProperties: false
|
|
485
|
+
},
|
|
486
|
+
plan_draft_check: {
|
|
487
|
+
type: 'object',
|
|
488
|
+
properties: { tranche: { ...str, description: 'The tranche slug of the stored draft to check.' } },
|
|
489
|
+
required: ['tranche'],
|
|
490
|
+
additionalProperties: false
|
|
491
|
+
},
|
|
492
|
+
plan_draft_preview: {
|
|
493
|
+
type: 'object',
|
|
494
|
+
properties: {
|
|
495
|
+
tranche: { ...str, description: 'The tranche slug of the stored draft to preview.' },
|
|
496
|
+
task: { ...issueSchema, description: 'One task number of the draft; omitted, every task is previewed.' }
|
|
497
|
+
},
|
|
498
|
+
required: ['tranche'],
|
|
499
|
+
additionalProperties: false
|
|
500
|
+
},
|
|
501
|
+
plan_review_start: {
|
|
502
|
+
type: 'object',
|
|
503
|
+
properties: { tranche: { ...str, description: 'The tranche slug of the stored draft to review.' } },
|
|
504
|
+
required: ['tranche'],
|
|
505
|
+
additionalProperties: false
|
|
506
|
+
},
|
|
507
|
+
plan_review_status: {
|
|
508
|
+
type: 'object',
|
|
509
|
+
properties: { tranche: { ...str, description: 'The tranche slug of the stored draft.' } },
|
|
510
|
+
required: ['tranche'],
|
|
511
|
+
additionalProperties: false
|
|
512
|
+
},
|
|
513
|
+
plan_review_decide: {
|
|
514
|
+
type: 'object',
|
|
515
|
+
properties: {
|
|
516
|
+
tranche: { ...str, description: 'The tranche slug of the stored draft.' },
|
|
517
|
+
fingerprint: { ...str, description: "The draft's current fingerprint, which the decision is given for." },
|
|
518
|
+
choice: {
|
|
519
|
+
enum: ['allow_one_more', 'stop'],
|
|
520
|
+
description: "The Principal's choice at the round limit: one more round, or stop the plan."
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
required: ['tranche', 'fingerprint', 'choice'],
|
|
524
|
+
additionalProperties: false
|
|
525
|
+
},
|
|
526
|
+
plan_approve: {
|
|
527
|
+
type: 'object',
|
|
528
|
+
properties: {
|
|
529
|
+
tranche: { ...str, description: 'The tranche slug of the stored draft.' },
|
|
530
|
+
fingerprint: { ...str, description: "The draft's current fingerprint, which the Principal approved." }
|
|
531
|
+
},
|
|
532
|
+
required: ['tranche', 'fingerprint'],
|
|
533
|
+
additionalProperties: false
|
|
534
|
+
},
|
|
535
|
+
plan_publish: {
|
|
536
|
+
type: 'object',
|
|
537
|
+
properties: {
|
|
538
|
+
tranche: { ...str, description: 'The tranche slug of the stored, approved draft to publish.' },
|
|
539
|
+
tasks: {
|
|
540
|
+
type: 'array',
|
|
541
|
+
items: issueSchema,
|
|
542
|
+
description: 'Task numbers to publish; omitted, every approved task is published.'
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
required: ['tranche'],
|
|
546
|
+
additionalProperties: false
|
|
231
547
|
}
|
|
232
548
|
}
|
|
233
549
|
|
|
@@ -248,10 +564,175 @@ export const PLANNER_TOOL_OUTPUT_JSON_SCHEMAS: Record<PlannerToolName, Record<st
|
|
|
248
564
|
required: ['version', 'url', 'supersedeUrl'],
|
|
249
565
|
additionalProperties: false
|
|
250
566
|
},
|
|
567
|
+
task_documentation_edit: {
|
|
568
|
+
type: 'object',
|
|
569
|
+
properties: {
|
|
570
|
+
briefUrl: { type: 'string', description: 'The new frozen brief version, rendered from the corrected Issue.' },
|
|
571
|
+
recordUrl: { type: 'string', description: 'The record comment: the previous lines, the new ones and the reason.' }
|
|
572
|
+
},
|
|
573
|
+
required: ['briefUrl', 'recordUrl'],
|
|
574
|
+
additionalProperties: false
|
|
575
|
+
},
|
|
251
576
|
brief_render: {
|
|
252
577
|
type: 'object',
|
|
253
|
-
properties: {
|
|
254
|
-
|
|
578
|
+
properties: {
|
|
579
|
+
brief: { type: 'string' },
|
|
580
|
+
waiting: {
|
|
581
|
+
type: 'array',
|
|
582
|
+
items: { type: 'string' },
|
|
583
|
+
description: 'Each reason the task cannot start yet; empty when it can start.'
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
required: ['brief', 'waiting'],
|
|
587
|
+
additionalProperties: false
|
|
588
|
+
},
|
|
589
|
+
plan_draft_submit: {
|
|
590
|
+
type: 'object',
|
|
591
|
+
properties: {
|
|
592
|
+
tranche: { type: 'string' },
|
|
593
|
+
fingerprint: { type: 'string', description: 'One fingerprint covering the whole draft.' },
|
|
594
|
+
tasks: { type: 'integer' }
|
|
595
|
+
},
|
|
596
|
+
required: ['tranche', 'fingerprint', 'tasks'],
|
|
597
|
+
additionalProperties: false
|
|
598
|
+
},
|
|
599
|
+
plan_draft_read: {
|
|
600
|
+
type: 'object',
|
|
601
|
+
properties: { draft: DRAFT_JSON_SCHEMA, fingerprint: { type: 'string' } },
|
|
602
|
+
required: ['draft', 'fingerprint'],
|
|
603
|
+
additionalProperties: false
|
|
604
|
+
},
|
|
605
|
+
plan_draft_check: {
|
|
606
|
+
type: 'object',
|
|
607
|
+
properties: {
|
|
608
|
+
fingerprint: { type: 'string', description: 'The fingerprint of the draft that was checked.' },
|
|
609
|
+
warnings: { ...FINDINGS_ARRAY, description: 'Findings that do not block; a blocking one is a refusal instead.' }
|
|
610
|
+
},
|
|
611
|
+
required: ['fingerprint', 'warnings'],
|
|
612
|
+
additionalProperties: false
|
|
613
|
+
},
|
|
614
|
+
plan_draft_preview: {
|
|
615
|
+
type: 'object',
|
|
616
|
+
properties: {
|
|
617
|
+
fingerprint: { type: 'string' },
|
|
618
|
+
revision: { type: 'string', description: 'The commit the briefs were rendered at.' },
|
|
619
|
+
tasks: {
|
|
620
|
+
type: 'array',
|
|
621
|
+
items: {
|
|
622
|
+
type: 'object',
|
|
623
|
+
properties: {
|
|
624
|
+
task: issueSchema,
|
|
625
|
+
issue: {
|
|
626
|
+
type: 'object',
|
|
627
|
+
properties: { title: { type: 'string' }, body: { type: 'string' }, labels: labelsSchema },
|
|
628
|
+
required: ['title', 'body', 'labels'],
|
|
629
|
+
additionalProperties: false
|
|
630
|
+
},
|
|
631
|
+
brief: { type: 'string' },
|
|
632
|
+
waiting: {
|
|
633
|
+
type: 'array',
|
|
634
|
+
items: { type: 'string' },
|
|
635
|
+
description: 'Each reason the task cannot start yet; empty when it can.'
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
required: ['task', 'issue', 'brief', 'waiting'],
|
|
639
|
+
additionalProperties: false
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
required: ['fingerprint', 'revision', 'tasks'],
|
|
644
|
+
additionalProperties: false
|
|
645
|
+
},
|
|
646
|
+
plan_review_start: {
|
|
647
|
+
type: 'object',
|
|
648
|
+
properties: {
|
|
649
|
+
round: { type: 'integer', description: 'The number of this round among all rounds spent on the tranche.' },
|
|
650
|
+
fingerprint: { type: 'string', description: 'The fingerprint of the draft the round judged.' },
|
|
651
|
+
agent: { enum: ['claude-code', 'codex'] },
|
|
652
|
+
verdict: { enum: ['approved', 'not_approved'], description: 'Derived by the harness from the validated answer.' },
|
|
653
|
+
findings: { type: 'array', items: STORED_FINDING_JSON_SCHEMA, description: 'The findings this round made.' },
|
|
654
|
+
resolved: {
|
|
655
|
+
type: 'array',
|
|
656
|
+
items: STORED_FINDING_JSON_SCHEMA,
|
|
657
|
+
description: 'Findings this round resolved with a valid confirmation.'
|
|
658
|
+
},
|
|
659
|
+
openFindings: {
|
|
660
|
+
type: 'array',
|
|
661
|
+
items: STORED_FINDING_JSON_SCHEMA,
|
|
662
|
+
description: 'Every blocking finding still open after the round.'
|
|
663
|
+
},
|
|
664
|
+
roundsSpent: { type: 'integer' },
|
|
665
|
+
roundsAllowed: { type: 'integer' }
|
|
666
|
+
},
|
|
667
|
+
required: [
|
|
668
|
+
'round',
|
|
669
|
+
'fingerprint',
|
|
670
|
+
'agent',
|
|
671
|
+
'verdict',
|
|
672
|
+
'findings',
|
|
673
|
+
'resolved',
|
|
674
|
+
'openFindings',
|
|
675
|
+
'roundsSpent',
|
|
676
|
+
'roundsAllowed'
|
|
677
|
+
],
|
|
678
|
+
additionalProperties: false
|
|
679
|
+
},
|
|
680
|
+
plan_review_status: {
|
|
681
|
+
type: 'object',
|
|
682
|
+
properties: { status: REVIEW_STATUS_JSON_SCHEMA },
|
|
683
|
+
required: ['status'],
|
|
684
|
+
additionalProperties: false
|
|
685
|
+
},
|
|
686
|
+
plan_review_decide: {
|
|
687
|
+
type: 'object',
|
|
688
|
+
properties: {
|
|
689
|
+
decision: {
|
|
690
|
+
type: 'object',
|
|
691
|
+
description: 'The decision as stored: its fingerprint, its choice and the rounds then spent.'
|
|
692
|
+
},
|
|
693
|
+
status: REVIEW_STATUS_JSON_SCHEMA
|
|
694
|
+
},
|
|
695
|
+
required: ['decision', 'status'],
|
|
696
|
+
additionalProperties: false
|
|
697
|
+
},
|
|
698
|
+
plan_approve: {
|
|
699
|
+
type: 'object',
|
|
700
|
+
properties: {
|
|
701
|
+
approval: {
|
|
702
|
+
type: 'object',
|
|
703
|
+
description: 'The approval as stored: its fingerprint and the rounds then spent.'
|
|
704
|
+
},
|
|
705
|
+
status: REVIEW_STATUS_JSON_SCHEMA
|
|
706
|
+
},
|
|
707
|
+
required: ['approval', 'status'],
|
|
708
|
+
additionalProperties: false
|
|
709
|
+
},
|
|
710
|
+
plan_publish: {
|
|
711
|
+
type: 'object',
|
|
712
|
+
properties: {
|
|
713
|
+
tasks: {
|
|
714
|
+
type: 'array',
|
|
715
|
+
items: {
|
|
716
|
+
type: 'object',
|
|
717
|
+
properties: {
|
|
718
|
+
task: issueSchema,
|
|
719
|
+
issue: { ...issueSchema, description: "The task's Issue number." },
|
|
720
|
+
url: {
|
|
721
|
+
type: ['string', 'null'],
|
|
722
|
+
description: 'The link the forge returned; null for a task published earlier.'
|
|
723
|
+
},
|
|
724
|
+
alreadyPublished: {
|
|
725
|
+
type: 'boolean',
|
|
726
|
+
description: 'True when the task had an Issue before this call and was not written.'
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
required: ['task', 'issue', 'url', 'alreadyPublished'],
|
|
730
|
+
additionalProperties: false
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
warnings: { type: 'array', items: { type: 'object' }, description: 'Warning findings the write gate raised.' }
|
|
734
|
+
},
|
|
735
|
+
required: ['tasks', 'warnings'],
|
|
255
736
|
additionalProperties: false
|
|
256
737
|
}
|
|
257
738
|
}
|
|
@@ -264,8 +745,18 @@ const DESCRIPTIONS: Record<PlannerToolName, string> = {
|
|
|
264
745
|
task_issue_edit: `Edit a task Issue's title, body or labels through the Issue write gate (the same gates \`task_issue_validate\` dry-runs for an edit). Returns the Issue's link. ${REFUSAL_NOTE}`,
|
|
265
746
|
task_issue_surface: `Report what a draft Issue body's Boundary pins force on its Surface. Writes nothing. ${REFUSAL_NOTE}`,
|
|
266
747
|
task_objectives_edit: `Add, drop or replace one objective of an Issue's \`## Objectives\` (Principal only); supersedes a frozen brief when one exists. Returns the new objectives version. ${REFUSAL_NOTE}`,
|
|
267
|
-
|
|
268
|
-
|
|
748
|
+
task_documentation_edit: `Replace the \`## Documentation\` section of a task Issue whose brief is frozen (Principal only), with a one-line reason. The new body passes the whole Issue write gate and every other section stays as it was; the frozen brief is superseded from the corrected Issue, and a record comment holds the previous lines, the new ones and the reason. Refused for an Issue with no frozen brief, which \`task_issue_edit\` edits. Returns the new brief comment and the record comment. ${REFUSAL_NOTE}`,
|
|
749
|
+
brief_render: `Preview a task's brief from its Issue, addressed by a tranche with a task id or by an Issue number alone. A task waiting on an unmerged dependency or an open conflicting task still renders in full, with each reason it cannot start yet in \`waiting\`; a refusal lists the facts it could not find. Writes nothing. ${REFUSAL_NOTE}`,
|
|
750
|
+
task_issue_validate: `Dry-run the Issue write gate for a create or an edit: runs exactly the gates create and edit run, writes nothing, and returns the findings in the same encoding as the other tools. ${REFUSAL_NOTE}`,
|
|
751
|
+
plan_draft_submit: `Store a whole plan draft — every task's title, body and labels, the task list, the agreed scope and the captured revision — on this machine, replacing any earlier draft of the same tranche. Writes no Issue and nothing to the repository. Returns the one fingerprint covering all of it. ${REFUSAL_NOTE}`,
|
|
752
|
+
plan_draft_read: `Read back the stored draft of a tranche, with its fingerprint. Writes nothing. ${REFUSAL_NOTE}`,
|
|
753
|
+
plan_draft_check: `Check the stored draft of a tranche as a whole: the full Issue write gate on every task as publication would run it, plus tasks that change the same files without a declared conflict, an edge naming a task the draft does not hold, a dependency cycle, a deferred fact whose producer is not a dependency, and every agreed-scope item delivered once or left out. It reads the code at the draft's captured revision, never the working tree. Writes nothing. ${REFUSAL_NOTE}`,
|
|
754
|
+
plan_draft_preview: `Preview the exact Issue (title, body, labels) and the exact brief of each task of the stored draft, as the Developer will read them, rendered from the code at the draft's captured revision. A task waiting on an unmerged dependency still previews in full, with each reason in \`waiting\`. Writes nothing. ${REFUSAL_NOTE}`,
|
|
755
|
+
plan_review_start: `Start one independent review round of the stored draft of a tranche. Refused unless the draft was checked as a whole at its current fingerprint with no blocking finding, and the round limit allows another round. The harness runs one fresh read-only reviewer session, validates its answer, derives the verdict and stores the result with the round; the reviewer never decides the verdict. A later round judges only each finding still open, the tasks whose text changed since the last round and their related tasks. A round that produced no valid review is refused and not counted. Writes nothing to the repository. ${REFUSAL_NOTE}`,
|
|
756
|
+
plan_review_status: `Read the stored review state of a tranche's draft: the rounds spent and allowed, whether the current fingerprint is approved (an earlier approval of a different fingerprint is stale and does not apply), each finding open, resolved or a note, the tasks whose approval still holds, what the next round judges, and the drift of each published task: whether its live Issue title or body still equals the draft's preview (matching, drifted, or unread when the Issue could not be read). Writes nothing. ${REFUSAL_NOTE}`,
|
|
757
|
+
plan_review_decide: `Record the Principal's decision once the round limit is reached for the draft's current fingerprint: allow one more round, or stop the plan. Records that a decision was given and for which fingerprint, never who gave it. Refused when the limit is not reached or the fingerprint is not the stored draft's. ${REFUSAL_NOTE}`,
|
|
758
|
+
plan_approve: `Record the Principal's approval of the reviewed plan: call it only after the Principal approved the draft's current fingerprint, which the latest review round also approved. Records that an approval was given and for which fingerprint, never who gave it. Refused when no draft is stored, when the fingerprint is not the stored draft's or when the latest round did not approve it. ${REFUSAL_NOTE}`,
|
|
759
|
+
plan_publish: `Publish the approved tasks of a tranche's stored draft as Issues, in task order: each one's exact preview title, body and labels, through the same Issue write gate \`task_issue_create\` runs, with the draft's tasks given to the brief render so a bare task number in an edge resolves. Refused, writing nothing, when no draft is stored, when the draft's current fingerprint is not approved by the review and by the Principal or when a named task is not approved. A task that already has an Issue number is reported and not written again. Each new Issue's number is recorded on its task in the stored draft, which leaves the approval in force; a refusal stops at its task and keeps the numbers already recorded. Returns each task's number, Issue number and link, and the gate's warnings. ${REFUSAL_NOTE}`
|
|
269
760
|
}
|
|
270
761
|
|
|
271
762
|
/** The Planner seat's catalog entries, in the order the seat lists them. */
|
|
@@ -283,16 +774,36 @@ export type PlannerOperations = {
|
|
|
283
774
|
createIssue: (input: { ghArgs: string[]; validateOnly?: boolean }) => Promise<IssueWriteOutcome>
|
|
284
775
|
editIssue: (input: { args: string[]; validateOnly?: boolean }) => Promise<IssueWriteOutcome>
|
|
285
776
|
editObjectives: (args: string[]) => Promise<ObjectivesOutcome>
|
|
777
|
+
editDocumentation: (input: DocumentationEditInput) => Promise<DocumentationOutcome>
|
|
286
778
|
printIssueSurface: (args: string[]) => SurfaceOutcome
|
|
287
|
-
renderBrief: (input:
|
|
779
|
+
renderBrief: (input: BriefAddress) => Promise<BriefOutcome>
|
|
780
|
+
submitPlanDraft: (input: unknown) => DraftSubmitOutcome
|
|
781
|
+
readPlanDraft: (tranche: string) => DraftReadOutcome
|
|
782
|
+
checkPlanDraft: (tranche: string) => Promise<DraftCheckOutcome>
|
|
783
|
+
previewPlanDraft: (tranche: string, task?: number) => Promise<DraftPreviewOutcome>
|
|
784
|
+
startPlanReview: (tranche: string) => Promise<StartOutcome>
|
|
785
|
+
planReviewStatus: (tranche: string) => StatusOutcome
|
|
786
|
+
decidePlanReview: (input: { tranche: string; fingerprint: string; choice: DecisionChoice }) => DecideOutcome
|
|
787
|
+
approvePlanReview: (input: { tranche: string; fingerprint: string }) => ApproveOutcome
|
|
788
|
+
publishPlan: (input: { tranche: string; tasks?: readonly number[] }) => Promise<PublishOutcome>
|
|
288
789
|
}
|
|
289
790
|
|
|
290
791
|
export const realPlannerOperations: PlannerOperations = {
|
|
291
792
|
createIssue: (input) => createIssue(input),
|
|
292
793
|
editIssue: (input) => editIssue(input),
|
|
293
794
|
editObjectives: (args) => editObjectives(args),
|
|
795
|
+
editDocumentation: (input) => editDocumentation(input),
|
|
294
796
|
printIssueSurface,
|
|
295
|
-
renderBrief: (input) => renderBrief(input)
|
|
797
|
+
renderBrief: (input) => renderBrief(input),
|
|
798
|
+
submitPlanDraft: (input) => submitPlanDraft(input),
|
|
799
|
+
readPlanDraft: (tranche) => readStoredPlanDraft(tranche),
|
|
800
|
+
checkPlanDraft: (tranche) => checkStoredPlanDraft(tranche),
|
|
801
|
+
previewPlanDraft: (tranche, task) => previewStoredPlanDraft(tranche, task),
|
|
802
|
+
startPlanReview: (tranche) => startStoredPlanReview(tranche),
|
|
803
|
+
planReviewStatus: (tranche) => readStoredPlanReviewStatusWithDrift(tranche),
|
|
804
|
+
decidePlanReview: (input) => decideStoredPlanReview(input),
|
|
805
|
+
approvePlanReview: (input) => approveStoredPlanReview(input),
|
|
806
|
+
publishPlan: (input) => publishApprovedTasks(input)
|
|
296
807
|
}
|
|
297
808
|
|
|
298
809
|
/** Writes a body to a scratch file the library reads (`--body-file`), and removes it when the operation is over. */
|
|
@@ -433,12 +944,21 @@ export function plannerToolHandlers(
|
|
|
433
944
|
if (!outcome.ok) return refused(outcome.findings.map(fromCheckError))
|
|
434
945
|
return succeeded({ version: outcome.version, url: outcome.url, supersedeUrl: outcome.supersedeUrl })
|
|
435
946
|
}),
|
|
947
|
+
task_documentation_edit: guarded(DocumentationInput, async (v) => {
|
|
948
|
+
const outcome = await ops.editDocumentation({ issue: v.issue, documentation: v.documentation, reason: v.reason })
|
|
949
|
+
if (!outcome.ok) return refused(outcome.findings.map(fromCheckError))
|
|
950
|
+
return succeeded({ briefUrl: outcome.briefUrl, recordUrl: outcome.recordUrl })
|
|
951
|
+
}),
|
|
436
952
|
brief_render: guarded(BriefInput, async (v) => {
|
|
437
|
-
const outcome = await ops.renderBrief(
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
953
|
+
const outcome = await ops.renderBrief(
|
|
954
|
+
v.issue !== undefined
|
|
955
|
+
? { issue: v.issue }
|
|
956
|
+
: {
|
|
957
|
+
trancheSlug: v.tranche as string,
|
|
958
|
+
taskId: v.id as string,
|
|
959
|
+
...(v.globs ? { globs: v.globs } : {})
|
|
960
|
+
}
|
|
961
|
+
)
|
|
442
962
|
if (!outcome.ok) {
|
|
443
963
|
return refused(
|
|
444
964
|
outcome.missing.length > 0
|
|
@@ -452,7 +972,102 @@ export function plannerToolHandlers(
|
|
|
452
972
|
: [finding('brief-render', 'the brief cannot be rendered', 'Check the task Issue, then render again.')]
|
|
453
973
|
)
|
|
454
974
|
}
|
|
455
|
-
return succeeded({ brief: outcome.brief })
|
|
975
|
+
return succeeded({ brief: outcome.brief, waiting: outcome.waiting })
|
|
976
|
+
}),
|
|
977
|
+
plan_draft_submit: guarded(PlanDraftSchema, (v) => {
|
|
978
|
+
const outcome = ops.submitPlanDraft(v)
|
|
979
|
+
if (!outcome.ok) {
|
|
980
|
+
return refused(
|
|
981
|
+
outcome.errors.map((e) => finding('plan-draft', e, 'Correct the draft, then submit the whole draft again.'))
|
|
982
|
+
)
|
|
983
|
+
}
|
|
984
|
+
return succeeded({ tranche: outcome.tranche, fingerprint: outcome.fingerprint, tasks: outcome.tasks })
|
|
985
|
+
}),
|
|
986
|
+
plan_draft_read: guarded(DraftReadInput, (v) => {
|
|
987
|
+
const outcome = ops.readPlanDraft(v.tranche)
|
|
988
|
+
if (!outcome.ok) {
|
|
989
|
+
return refused([finding('plan-draft', outcome.message, 'Submit the draft with `plan_draft_submit` first.')])
|
|
990
|
+
}
|
|
991
|
+
return succeeded({ draft: outcome.draft, fingerprint: outcome.fingerprint })
|
|
992
|
+
}),
|
|
993
|
+
plan_draft_check: guarded(DraftCheckInput, async (v) => {
|
|
994
|
+
const outcome = await ops.checkPlanDraft(v.tranche)
|
|
995
|
+
if (!outcome.ok) {
|
|
996
|
+
return refused([finding('plan-draft', outcome.message, 'Submit the draft with `plan_draft_submit` first.')])
|
|
997
|
+
}
|
|
998
|
+
const { report } = outcome
|
|
999
|
+
const all = [
|
|
1000
|
+
...report.tasks.flatMap((t) =>
|
|
1001
|
+
t.findings.map((e) => fromCheckError({ ...e, message: `task ${t.task}: ${e.message}` }))
|
|
1002
|
+
),
|
|
1003
|
+
...report.cross.map(fromCheckError),
|
|
1004
|
+
...report.coverage.map(fromCheckError)
|
|
1005
|
+
]
|
|
1006
|
+
if (report.blocking) return refused(all)
|
|
1007
|
+
return succeeded({ fingerprint: report.fingerprint, warnings: all })
|
|
1008
|
+
}),
|
|
1009
|
+
plan_draft_preview: guarded(DraftPreviewInput, async (v) => {
|
|
1010
|
+
const outcome = await ops.previewPlanDraft(v.tranche, v.task)
|
|
1011
|
+
if (!outcome.ok) {
|
|
1012
|
+
return refused([finding('plan-draft', outcome.message, 'Submit the draft with `plan_draft_submit` first.')])
|
|
1013
|
+
}
|
|
1014
|
+
const { preview } = outcome
|
|
1015
|
+
if (!preview.ok) {
|
|
1016
|
+
return refused([...preview.findings, ...preview.tasks.flatMap((t) => t.findings)].map(fromCheckError))
|
|
1017
|
+
}
|
|
1018
|
+
return succeeded({
|
|
1019
|
+
fingerprint: preview.fingerprint,
|
|
1020
|
+
revision: preview.revision,
|
|
1021
|
+
tasks: preview.tasks.map((t) => ({ task: t.task, issue: t.issue, brief: t.brief, waiting: t.waiting }))
|
|
1022
|
+
})
|
|
1023
|
+
}),
|
|
1024
|
+
plan_review_start: guarded(ReviewStartInput, async (v) => {
|
|
1025
|
+
const outcome = await ops.startPlanReview(v.tranche)
|
|
1026
|
+
if (!outcome.ok) return refused(outcome.findings)
|
|
1027
|
+
return succeeded({
|
|
1028
|
+
round: outcome.round,
|
|
1029
|
+
fingerprint: outcome.fingerprint,
|
|
1030
|
+
agent: outcome.agent,
|
|
1031
|
+
verdict: outcome.verdict,
|
|
1032
|
+
findings: outcome.findings,
|
|
1033
|
+
resolved: outcome.resolved,
|
|
1034
|
+
openFindings: outcome.openFindings,
|
|
1035
|
+
roundsSpent: outcome.roundsSpent,
|
|
1036
|
+
roundsAllowed: outcome.roundsAllowed
|
|
1037
|
+
})
|
|
1038
|
+
}),
|
|
1039
|
+
plan_review_status: guarded(ReviewStatusInput, (v) => {
|
|
1040
|
+
const outcome = ops.planReviewStatus(v.tranche)
|
|
1041
|
+
if (!outcome.ok) return refused(outcome.findings)
|
|
1042
|
+
return succeeded({ status: outcome.status })
|
|
1043
|
+
}),
|
|
1044
|
+
plan_review_decide: guarded(ReviewDecideInput, (v) => {
|
|
1045
|
+
const outcome = ops.decidePlanReview(v)
|
|
1046
|
+
if (!outcome.ok) return refused(outcome.findings)
|
|
1047
|
+
return succeeded({ decision: outcome.decision, status: outcome.status })
|
|
1048
|
+
}),
|
|
1049
|
+
plan_approve: guarded(ReviewApproveInput, (v) => {
|
|
1050
|
+
const outcome = ops.approvePlanReview(v)
|
|
1051
|
+
if (!outcome.ok) return refused(outcome.findings)
|
|
1052
|
+
return succeeded({ approval: outcome.approval, status: outcome.status })
|
|
1053
|
+
}),
|
|
1054
|
+
plan_publish: guarded(PublishInput, async (v) => {
|
|
1055
|
+
const outcome = await ops.publishPlan(v)
|
|
1056
|
+
if (!outcome.ok) {
|
|
1057
|
+
const done = outcome.published.filter((t) => !t.alreadyPublished)
|
|
1058
|
+
const kept =
|
|
1059
|
+
done.length === 0
|
|
1060
|
+
? []
|
|
1061
|
+
: [
|
|
1062
|
+
finding(
|
|
1063
|
+
'plan-publish',
|
|
1064
|
+
`published before the refusal: ${done.map((t) => `task ${t.task} as Issue #${t.issue}`).join(', ')}; their numbers stay recorded in the draft`,
|
|
1065
|
+
'Fix the refused task in the draft, then publish again: a task with an Issue number is not written twice.'
|
|
1066
|
+
)
|
|
1067
|
+
]
|
|
1068
|
+
return refused([...outcome.findings.map(fromCheckError), ...kept])
|
|
1069
|
+
}
|
|
1070
|
+
return succeeded({ tasks: outcome.tasks, warnings: outcome.warnings.map(fromCheckError) })
|
|
456
1071
|
})
|
|
457
1072
|
}
|
|
458
1073
|
}
|