Write updated docs and port SEP-2663 content (#2)

* Port SEP-2663 content

* Commit package-lock.json

* Add TODOs to import new types from SDK

* Copy InputRequests/InputResponses types from main repo

* Specify error for servers that require tasks

* Allow servers to require tasks

* Move "existing code" note to separate section

* Update 2663-tasks-extension.md

Co-authored-by: Caitie McCaffrey <caitiem20@github.com>

* Update 2663-tasks-extension.md

Co-authored-by: Caitie McCaffrey <caitiem20@github.com>

* Task Update Requests

* Link to MRTR spec for inputRequests

* Add auth check requirement

* Rename notifications/tasks/status

* Move detailed task types into task status section

* Add back explicit polling response requirements

* Disallow progress/logging notifications for now

* Add spec language for client behavior on inputRequests

* Mark Accepted

* Mark Final

* regenerate schema

* Fix check mode in generate-schemas.ts

Check mode previously compared the gitignored intermediate
schema/draft/generated/schema.ts against fresh output, then wrote a
temp file under that same directory to dynamic-import for JSON Schema
generation. On fresh checkouts (every CI run, since schema/**/generated/
is gitignored) the directory does not exist, so the temp-file write
crashed with ENOENT before reporting any real result. Local runs hid
the bug because once a developer runs the generator the directory
sticks around.

Drop the comparison against the gitignored intermediate (it cannot be
stale on CI by definition) and check only the committed schema.json.
The Zod schemas file is now written unconditionally so the dynamic
import resolves.

---------

Co-authored-by: Caitie McCaffrey <caitiem20@github.com>
This commit is contained in:
Luca Chang 2026-05-22 12:06:55 -07:00 • committed by GitHub
commit 29f83d5c8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -107,56 +107,39 @@ async function main() {
);
schemasContent = postProcess(schemasContent);
// Ensure generated directory exists. Required in both modes because check
// mode writes a temp file here for dynamic import (its relative imports
// resolve against this directory).
mkdirSync(GENERATED_DIR, { recursive: true });
if (isCheck) {
// Check mode: compare generated output against existing files
// Check mode: only schema.json is tracked in git (generated/ is gitignored
// as an intermediate artifact). We verify the committed schema.json matches
// what would be regenerated from schema.ts.
let hasChanges = false;
if (existsSync(SCHEMA_OUTPUT_FILE)) {
const existing = readFileSync(SCHEMA_OUTPUT_FILE, "utf-8");
if (existing !== schemasContent) {
// Write the freshly generated Zod schemas to disk so we can dynamic-import
// them. This file is gitignored, so writing it is not a check concern.
writeFileSync(SCHEMA_OUTPUT_FILE, schemasContent, "utf-8");
const jsonSchemaContent = await generateJsonSchemaContent(SCHEMA_OUTPUT_FILE);
if (existsSync(JSON_SCHEMA_OUTPUT_FILE)) {
const existing = readFileSync(JSON_SCHEMA_OUTPUT_FILE, "utf-8");
if (existing !== jsonSchemaContent) {
console.error(
"❌ Generated Zod schemas are out of date. Run: npm run generate:schemas"
"❌ JSON Schema is out of date. Run: npm run generate:schemas"
);
hasChanges = true;
} else {
console.log(" ✓ Zod schemas are up to date");
console.log(" ✓ JSON Schema is up to date");
}
} else {
console.error(
"❌ Generated Zod schemas file does not exist. Run: npm run generate:schemas"
"❌ JSON Schema file does not exist. Run: npm run generate:schemas"
);
hasChanges = true;
}
// Write temp file to generate JSON Schema for comparison
const tempFile = SCHEMA_OUTPUT_FILE + ".check.ts";
writeFileSync(tempFile, schemasContent, "utf-8");
try {
const jsonSchemaContent = await generateJsonSchemaContent(tempFile);
if (existsSync(JSON_SCHEMA_OUTPUT_FILE)) {
const existing = readFileSync(JSON_SCHEMA_OUTPUT_FILE, "utf-8");
if (existing !== jsonSchemaContent) {
console.error(
"❌ JSON Schema is out of date. Run: npm run generate:schemas"
);
hasChanges = true;
} else {
console.log(" ✓ JSON Schema is up to date");
}
} else {
console.error(
"❌ JSON Schema file does not exist. Run: npm run generate:schemas"
);
hasChanges = true;
}
} finally {
// Clean up temp file
const { unlinkSync } = await import("node:fs");
try {
unlinkSync(tempFile);
} catch {}
}
if (hasChanges) {
process.exit(1);
}
@ -164,9 +147,6 @@ async function main() {
return;
}
// Ensure generated directory exists
mkdirSync(GENERATED_DIR, { recursive: true });
// Write Zod schemas
writeFileSync(SCHEMA_OUTPUT_FILE, schemasContent, "utf-8");
console.log(`✅ Written: ${SCHEMA_OUTPUT_FILE}`);