Repository navigation
AA07: AuthorDraft / AuthorPatch schemas, draftToSpec, applyAuthorPatch - #851
Merged
Merged
Conversation
…plyAuthorPatch Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ng caller input Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
New
apps/agent-forge/server/author/draft/module — the zod contract and pure spec builders the Author's propose tools (AA08/AA09) will sit on.schema.tsauthorDraftSchema: derived from the SDK'sagentSpecV2Schemaminusversion,evals,flow(DRAFT_OMITTED_KEYS), strict.descriptionis required and capped at 500 chars (stricter than the spec);instructionsis a plain string 1–50,000 chars (never{ file });nameandmodelstay required exactly where the spec requires them. Never re-declared by hand, so the schema cannot drift from the SDK.authorPatchSchema: every draft key optional (omitted = keep); the spec-optional keys also acceptnull(reset to default) —NULLABLE_PATCH_KEYSis computed from the spec schema's optional fields minusdescription. Strict.FIELD_DESCRIPTIONS: one sentence per draftable field; a coverage test pins it to exactly the schema keys.toSpec.tsdraftToSpec(draft):{ version: 2, ...draft }plus a chat-trigger backstop, validated withagentSpecV2Schema.applyAuthorPatch(base, patch): undefined → keep,null→ delete key, any other value → replace (lists replace wholesale,[]clears); same chat-trigger backstop and validation.draftInvalidFailure(toolName, issues): theDRAFT_INVALIDtool failure (first 10 issues aspath: message).deriveAgentId(name, taken): name → slug (lowercase, non-[a-z0-9]runs →-, 48-char cap,agentfallback) with-2,-3… collision suffixes; every output passesisValidAgentId.tools[2].builtin-style paths ([n]for array indexes).type: 'chat'entry exists, with the first unusedt<N>id.No wiring yet — AA08 is the first caller (test usage satisfies fallow until then).
Test summary
server/author/draft/__tests__/schema.test.ts+toSpec.test.ts: 125 tests — required/omitted/unknown keys, null rules, full patch-semantics table,t1taken →t2,guardrails[0].nameissue path,deriveAgentIdcases (empty, unicode, 60-char, collisions).typecheck:server,typecheck,test:server(69 files / 944 tests),test(85 files / 942 tests) — all pass.tsc --noEmit,lint,fallow(no issues),docs:ratchet,api:check,docs:llms:check,size-check— all pass.test:coverage: 11 pre-existing/environmental failures unrelated to this change — 6×templates.test.tsREADMEstartsWithchecks fail under a CRLF checkout (core.autocrlf=true), 5×create-loushotests need the package'sdist/build (not produced in this worktree). All other 7,152 tests pass; coverage report generated via--coverage.reportOnFailureso fallow could consume it.Acceptance criteria
authorDraftSchemarejectsversion,evals,flowand unknown keys; requires name, description, model, instructions.applyAuthorPatch(base, { tools: [] })clears tools;{ reasoning: null }removesreasoning;{}returns base unchanged (plus chat trigger).{ description: null }fails patch validation.deriveAgentId('Support Triage!', new Set(['support-triage']))→support-triage-2; every output passesisValidAgentId.Generated with Devin