build(deps): bump zod from 3.25.76 to 4.4.3 (#11719)

Bumps [zod](https://github.com/colinhacks/zod) from 3.25.76 to 4.4.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/colinhacks/zod/releases">zod's
releases</a>.</em></p>
<blockquote>
<h2>v4.4.3</h2>
<h2>Commits:</h2>
<ul>
<li>4c2fa95ce3f3390fbc522324e406b4e9e89b88f9 docs: use Zernio primary
wordmark for gold sponsor logo</li>
<li>2aeec83eb135e3a83756e973ef44845fc5a455d2 docs: prune lapsed gold
sponsors and rebalance logo sizing</li>
<li>7391be88ac1ee5cd02057f5ccc012a1f5df4efd0 docs: prune lapsed
silver/bronze sponsors and add active ones</li>
<li>2c703322a21b4e2b12f33f49ea8430c451a68b4f docs: normalize bronze
sponsor logos to github avatar pattern</li>
<li>9195250cab0e7950efe39c3926d6c203b4b0a170 docs: remove Mintlify from
bronze sponsors (churned)</li>
<li>b8dffe9e62f17e6571e6249d05cc5102b54d94e4 docs: remove Numeric and
Speakeasy (2+ missed monthly cycles)</li>
<li>1cab69383fcdeae2a366d5e2a2fc4d8fc765d168 fix(v4): restore catch
handling for absent object keys (<a
href="https://redirect.github.com/colinhacks/zod/issues/5937">#5937</a>)
(<a
href="https://redirect.github.com/colinhacks/zod/issues/5939">#5939</a>)</li>
<li>c2be4f819064eed62c7c350a2d399b5faecd15f8 fix(v4): generalize
optin/fallback to transform; restore preprocess on absent keys (<a
href="https://redirect.github.com/colinhacks/zod/issues/5941">#5941</a>)</li>
<li>f3c9ec03ba7a28ae72d25cc295f38674bee0f559 4.4.3</li>
<li>1fb56a5c18c27102dbc92260a4007c7732a0ccca docs: document release
procedure in AGENTS.md</li>
</ul>
<h2>v4.4.2</h2>
<h2>Commits:</h2>
<ul>
<li>0c62df0ea19fd05abdf90473e9eef7eea530fab2 Clean up docs navigation
and stale labels (<a
href="https://redirect.github.com/colinhacks/zod/issues/5901">#5901</a>)</li>
<li>20cc794895cc8604fe0c87d83a5d1c3f89fad0ac chore: add security policy
and refresh tooling deps</li>
<li>6fbe07b0177efdd1bf1c0b05160e70d7a0702337 fix(docs): heading anchor
links now include the hash so it doesnt scoll all the way up, follows
navbar logic (<a
href="https://redirect.github.com/colinhacks/zod/issues/5791">#5791</a>)</li>
<li>4bbed1b1c73eca4ce9e59b1189ed236aa6c8b5bd Tighten discriminated union
option typing</li>
<li>bbac3e567e7fccfaaf7cdc97f1ce30c295e2c908 Update PR guidance for
agents</li>
<li>cf0dc942a32805c292fff59ade20a7ace980735a Merge remote-tracking
branch 'origin/main' into fix-discriminated-union-key-constraint</li>
<li>292c894a5fd2aa42e527900b83d8d7a3009a709c docs: add Zernio gold
sponsor</li>
<li>1fc9f311c28dcf80d0bb5a36b177086cbc3d8eca docs: document codec
inversion</li>
<li>1373c85da9aeff704a9762d27bc58699618aefb7 docs: remove AI disclosure
guidance</li>
<li>e20d02b473c08e3a4e557bc610b1b5fac079b649 chore: ignore triage
notes</li>
<li>e58ea4d91b1dfe8194b73508203213cbc7e9c936 docs: test Zod Mini tab
code heights</li>
<li>905761a5d127e8d5dd2ebb3bc88c75cb0b8149ff docs: document preprocess
input type narrowing</li>
<li>bf64bac850d4dee2b7dde7e64909d5d796d32043 chore: tighten test
guidance in AGENTS.md</li>
<li>8ec4e73f4c4693b6361ad591be40fb41eb8a9f95 chore: update play.ts
scratch</li>
<li>02c2baf7d0d615872fa4528a8020603b71211702 Make z.preprocess defer
optionality to inner schema (<a
href="https://redirect.github.com/colinhacks/zod/issues/5929">#5929</a>)</li>
<li>88015df8e25c44fb5385eb3ef28935119cd5edea fix(docs): drop deprecated
<code>baseUrl</code> from tsconfig</li>
<li>c59d4474e3b4cad1b323462186cf607178ce8267 4.4.2</li>
</ul>
<h2>v4.4.1</h2>
<h2>Commits:</h2>
<ul>
<li>481f7be4238c83ed58183f921b2646f340a91c6a ci: gate release publishing
on full test workflow</li>
<li>95ccab423aec720b2523c3a64cdc7e3204537cc7 test(v3): restore optional
undefined expectations</li>
<li>cede2c63739a5823d6aa5093d291e9a111da943d fix(v4): reject tuple holes
before required defaults (<a
href="https://redirect.github.com/colinhacks/zod/issues/5900">#5900</a>)</li>
<li>edd0bf0f5ada4a8dc581c259407d7bbad0a71ea7 release: 4.4.1</li>
<li>180d83d1dbe6a59260710cc8637a3dea2281ee56 docs: remove Jazz featured
sponsor</li>
</ul>
<h2>v4.4.0</h2>
<h2>4.4.0</h2>
<p>This is a minor release with a wide set of correctness and soundness
fixes. Some fixes intentionally make Zod stricter, so code that depended
on previously accepted invalid or ambiguous inputs may need small
updates.</p>
<h2>Potentially breaking bug fixes</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/colinhacks/zod/commit/1fb56a5c18c27102dbc92260a4007c7732a0ccca"><code>1fb56a5</code></a>
docs: document release procedure in AGENTS.md</li>
<li><a
href="https://github.com/colinhacks/zod/commit/f3c9ec03ba7a28ae72d25cc295f38674bee0f559"><code>f3c9ec0</code></a>
4.4.3</li>
<li><a
href="https://github.com/colinhacks/zod/commit/c2be4f819064eed62c7c350a2d399b5faecd15f8"><code>c2be4f8</code></a>
fix(v4): generalize optin/fallback to transform; restore preprocess on
absent...</li>
<li><a
href="https://github.com/colinhacks/zod/commit/1cab69383fcdeae2a366d5e2a2fc4d8fc765d168"><code>1cab693</code></a>
fix(v4): restore catch handling for absent object keys (<a
href="https://redirect.github.com/colinhacks/zod/issues/5937">#5937</a>)
(<a
href="https://redirect.github.com/colinhacks/zod/issues/5939">#5939</a>)</li>
<li><a
href="https://github.com/colinhacks/zod/commit/b8dffe9e62f17e6571e6249d05cc5102b54d94e4"><code>b8dffe9</code></a>
docs: remove Numeric and Speakeasy (2+ missed monthly cycles)</li>
<li><a
href="https://github.com/colinhacks/zod/commit/9195250cab0e7950efe39c3926d6c203b4b0a170"><code>9195250</code></a>
docs: remove Mintlify from bronze sponsors (churned)</li>
<li><a
href="https://github.com/colinhacks/zod/commit/2c703322a21b4e2b12f33f49ea8430c451a68b4f"><code>2c70332</code></a>
docs: normalize bronze sponsor logos to github avatar pattern</li>
<li><a
href="https://github.com/colinhacks/zod/commit/7391be88ac1ee5cd02057f5ccc012a1f5df4efd0"><code>7391be8</code></a>
docs: prune lapsed silver/bronze sponsors and add active ones</li>
<li><a
href="https://github.com/colinhacks/zod/commit/2aeec83eb135e3a83756e973ef44845fc5a455d2"><code>2aeec83</code></a>
docs: prune lapsed gold sponsors and rebalance logo sizing</li>
<li><a
href="https://github.com/colinhacks/zod/commit/4c2fa95ce3f3390fbc522324e406b4e9e89b88f9"><code>4c2fa95</code></a>
docs: use Zernio primary wordmark for gold sponsor logo</li>
<li>Additional commits viewable in <a
href="https://github.com/colinhacks/zod/compare/v3.25.76...v4.4.3">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a
href="https://www.npmjs.com/~GitHub%20Actions">GitHub Actions</a>, a new
releaser for zod since your current version.</p>
</details>
<br />

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Priya Raman <priya@paperclip.ing>
Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
authored and GitHub committed 2026-08-21 00:04:14 -07:00
1 parent 773a9dade6
commit 3abe9e2134
63 files changed
+889 -752

No files matched your search

+4 -4
View File
@@ -95,17 +95,17 @@ const createActivitySchema = z.object({
action: z.string().min(1),
entityType: z.string().min(1),
entityId: z.string().min(1),
agentId: z.string().uuid().optional().nullable(),
details: z.record(z.unknown()).optional().nullable(),
agentId: z.string().guid().optional().nullable(),
details: z.record(z.string(), z.unknown()).optional().nullable(),
});
const agentActionAuditActorScopeSchema = z.enum(["agents", "all"]);
const agentActionAuditQuerySchema = z.object({
actorScope: agentActionAuditActorScopeSchema.default("agents"),
agentId: z.string().uuid().optional(),
agentId: z.string().guid().optional(),
responsibleUserId: z.string().min(1).optional(),
runId: z.string().uuid().optional(),
runId: z.string().guid().optional(),
entityType: z.string().min(1).optional(),
entityId: z.string().min(1).optional(),
action: z.string().min(1).optional(),
+13 -13
View File
@@ -48,29 +48,29 @@ const caseKeySchema = z.string().trim().min(1).max(512);
const documentKeySchema = z.string().trim().min(1).max(120).regex(/^[A-Za-z0-9_.:-]+$/);
const createCaseSchema = z.object({
projectId: z.string().uuid().nullable().optional(),
projectId: z.string().guid().nullable().optional(),
caseType: caseTypeSchema,
key: caseKeySchema.nullable().optional(),
title: z.string().trim().min(1).max(500),
summary: z.string().max(8_000).nullable().optional(),
status: caseStatusSchema.optional(),
fields: jsonObjectSchema.optional(),
parentCaseId: z.string().uuid().nullable().optional(),
parentCaseId: z.string().guid().nullable().optional(),
}).strict();
const patchCaseSchema = z.object({
projectId: z.string().uuid().nullable().optional(),
projectId: z.string().guid().nullable().optional(),
title: z.string().trim().min(1).max(500).optional(),
summary: z.string().max(8_000).nullable().optional(),
status: caseStatusSchema.optional(),
fields: jsonObjectSchema.optional(),
parentCaseId: z.string().uuid().nullable().optional(),
labels: z.array(z.string().uuid()).max(100).optional(),
labelIds: z.array(z.string().uuid()).max(100).optional(),
parentCaseId: z.string().guid().nullable().optional(),
labels: z.array(z.string().guid()).max(100).optional(),
labelIds: z.array(z.string().guid()).max(100).optional(),
}).strict();
const createIssueLinkSchema = z.object({
issueId: z.string().uuid(),
issueId: z.string().guid(),
role: z.enum(CASE_LINK_ROLES),
}).strict();
@@ -79,7 +79,7 @@ const upsertCaseDocumentSchema = z.object({
format: z.string().trim().min(1).max(80).optional().default("markdown"),
body: z.string().max(200_000),
changeSummary: z.string().trim().max(1_000).nullable().optional(),
baseRevisionId: z.string().uuid().nullable().optional(),
baseRevisionId: z.string().guid().nullable().optional(),
}).strict();
const queryListParamSchema = z.union([z.string(), z.array(z.string())]).optional();
@@ -89,13 +89,13 @@ const listCasesQuerySchema = z.object({
types: queryListParamSchema,
status: z.string().trim().min(1).max(120).optional(),
statuses: queryListParamSchema,
project: z.string().uuid().optional(),
projectId: z.string().uuid().optional(),
project: z.string().guid().optional(),
projectId: z.string().guid().optional(),
projectIds: queryListParamSchema,
includeNoProject: z.enum(["true", "false", "1", "0"]).optional(),
label: z.string().uuid().optional(),
labelId: z.string().uuid().optional(),
parent: z.string().uuid().optional(),
label: z.string().guid().optional(),
labelId: z.string().guid().optional(),
parent: z.string().guid().optional(),
q: z.string().trim().min(1).max(200).optional(),
includeAncestors: z.enum(["true", "false", "1", "0"]).optional(),
limit: z.coerce.number().int().min(1).max(200).optional().default(100),
+3 -3
View File
@@ -316,9 +316,9 @@ export function companyRoutes(db: Db, storage?: StorageService, options?: Compan
from: z.string().optional(),
to: z.string().optional(),
userId: z.string().min(1).optional(),
goalId: z.string().uuid().optional(),
projectId: z.string().uuid().optional(),
issueId: z.string().uuid().optional(),
goalId: z.string().guid().optional(),
projectId: z.string().guid().optional(),
issueId: z.string().guid().optional(),
limit: z.string().optional(),
offset: z.string().optional(),
}).passthrough();
+6 -6
View File
@@ -6,18 +6,18 @@ import { decisionTrainingService, logActivity } from "../services/index.js";
import { assertBoard, assertCompanyAccess, getActorInfo, hasCompanyAccess } from "./authz.js";
const sourceKindSchema = z.enum(["interaction", "approval", "execution_decision"]);
const exampleIdSchema = z.string().uuid();
const exampleIdSchema = z.string().guid();
const createSchema = z.object({
sourceKind: sourceKindSchema,
sourceId: z.string().uuid(),
issueId: z.string().uuid(),
sourceId: z.string().guid(),
issueId: z.string().guid(),
notes: z.string().max(100_000).default(""),
}).strict();
const updateSchema = z.object({ notes: z.string().max(100_000) }).strict();
const previewSchema = z.object({
sourceKind: sourceKindSchema,
sourceId: z.string().uuid(),
issueId: z.string().uuid(),
sourceId: z.string().guid(),
issueId: z.string().guid(),
}).strict();
function requireHumanUser(req: Request, res: Response) {
@@ -116,7 +116,7 @@ export function decisionTrainingRoutes(db: Db) {
assertBoard(req);
assertCompanyAccess(req, companyId);
const parsed = z.object({
project: z.string().uuid().optional(),
project: z.string().guid().optional(),
kind: sourceKindSchema.optional(),
author: z.string().optional(),
q: z.string().trim().max(500).optional(),
+4 -4
View File
@@ -28,14 +28,14 @@ const createSchema = z.object({
expiresAt: z.coerce.date().optional(),
idempotencyKey: z.string().trim().min(1).max(500).nullable().optional(),
continuationPolicy: z.enum(["none", "wake_origin_agent"]).optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
}).strict();
const bundleSchema = z.object({ title: z.string().trim().min(1).max(500), summary: z.string().max(100_000), decisions: z.array(createSchema).min(1).max(50) }).strict();
const decideSchema = z.object({ optionId: z.string().trim().min(1).max(120), inputValues: z.record(z.string().max(20_000)).optional(), idempotencyKey: z.string().trim().min(1).max(500).nullable().optional() }).strict();
const decideSchema = z.object({ optionId: z.string().trim().min(1).max(120), inputValues: z.record(z.string(), z.string().max(20_000)).optional(), idempotencyKey: z.string().trim().min(1).max(500).nullable().optional() }).strict();
const dismissSchema = z.object({ reason: z.string().max(20_000).nullable().optional() }).strict();
const statsQuerySchema = z.object({
groupBy: z.literal("ruleKey"),
originAgentId: z.string().uuid().optional(),
originAgentId: z.string().guid().optional(),
since: z.coerce.date().optional(),
}).strict();
@@ -147,7 +147,7 @@ export function decisionRoutes(db: Db, options: DecisionServiceOptions) {
});
router.get("/companies/:companyId/decisions", async (req, res) => {
const companyId = req.params.companyId as string; assertBoard(req); assertCompanyAccess(req, companyId);
const query = z.object({ status: z.enum(["open", "decided", "expired", "cancelled"]).optional(), bundleId: z.string().uuid().optional(), targetIssueId: z.string().uuid().optional(), originAgentId: z.string().uuid().optional(), limit: z.coerce.number().int().positive().max(100).optional() }).safeParse(req.query);
const query = z.object({ status: z.enum(["open", "decided", "expired", "cancelled"]).optional(), bundleId: z.string().guid().optional(), targetIssueId: z.string().guid().optional(), originAgentId: z.string().guid().optional(), limit: z.coerce.number().int().positive().max(100).optional() }).safeParse(req.query);
if (!query.success) { res.status(400).json({ error: "Invalid decision filters", details: query.error.flatten() }); return; }
res.json(await svc.list(companyId, query.data));
});
+2 -2
View File
@@ -171,7 +171,7 @@ function readQuery(query: unknown) {
parsed = workspaceFileResourceQuerySchema.parse(query);
} catch (error) {
if (error instanceof ZodError) {
const refinement = error.errors.find((issue) => {
const refinement = error.issues.find((issue) => {
const code = (issue as { params?: { code?: string } }).params?.code;
return code === "invalid_path" || code === "invalid_target";
});
@@ -194,7 +194,7 @@ function readListQuery(query: unknown) {
parsed = workspaceFileListQuerySchema.parse(query);
} catch (error) {
if (error instanceof ZodError) {
const refinement = error.errors.find((issue) => {
const refinement = error.issues.find((issue) => {
const code = (issue as { params?: { code?: string } }).params?.code;
return code === "invalid_query" || code === "invalid_target" || code === "invalid_path";
});
+4 -4
View File
@@ -265,18 +265,18 @@ function prefersMinimalIssueUpdateResponse(req: Request) {
}
const refreshExternalObjectsSchema = z.object({
objectIds: z.array(z.string().uuid()).max(50).optional(),
objectIds: z.array(z.string().guid()).max(50).optional(),
}).strict();
const inboxArchiveBodySchema = z.object({
userId: z.string().trim().min(1).optional(),
}).strict().default({});
const externalObjectSummariesSchema = z.object({
issueIds: z.array(z.string().uuid()).max(1000),
issueIds: z.array(z.string().guid()).max(1000),
}).strict();
const promoteLowTrustOutputSchema = z.object({
sourceArtifactKind: z.enum(["comment", "document", "work_product", "issue"]),
sourceArtifactId: z.string().uuid(),
sourceArtifactId: z.string().guid(),
title: z.string().trim().min(1).max(200),
summary: z.string().trim().min(1).max(8_000),
});
@@ -460,7 +460,7 @@ function requiresPaperclipAttachmentMetadata(input: {
}
const attachmentArtifactMetadataInputSchema = z.object({
attachmentId: z.string().uuid(),
attachmentId: z.string().guid(),
}).passthrough();
function buildCreateIssueActivityStatusDetails(
+156 -121
View File
@@ -255,148 +255,183 @@ type OpenApiPathRegistration = {
[key: string]: unknown;
};
const zodTypeName = (schema: z.ZodTypeAny) => schema._def.typeName as string;
// Zod 4 stores each schema definition on `_def` with a lowercase `type`
// discriminator and moves the wrapped members onto that def. This loose view
// lets the converter read those members, because Zod 4 does not export a
// public type for every internal def shape.
type ZodDefAny = Record<string, unknown> & { type: string };
const zodDef = (schema: z.ZodTypeAny): ZodDefAny => schema._def as unknown as ZodDefAny;
const zodTypeName = (schema: z.ZodTypeAny): string => zodDef(schema).type;
function unwrapSchema(schema: z.ZodTypeAny): z.ZodTypeAny {
const typeName = zodTypeName(schema);
if (typeName === "ZodOptional" || typeName === "ZodDefault" || typeName === "ZodCatch") {
return unwrapSchema(schema._def.innerType);
const def = zodDef(schema);
if (def.type === "optional" || def.type === "default" || def.type === "catch") {
return unwrapSchema(def.innerType as z.ZodTypeAny);
}
if (typeName === "ZodEffects") {
return unwrapSchema(schema._def.schema);
// A `.transform()` or `.pipe()` becomes a pipe. Read the input schema so the
// published contract describes the value a client sends.
if (def.type === "pipe") {
return unwrapSchema(def.in as z.ZodTypeAny);
}
return schema;
}
function isOptionalSchema(schema: z.ZodTypeAny): boolean {
const typeName = zodTypeName(schema);
if (typeName === "ZodOptional" || typeName === "ZodDefault" || typeName === "ZodCatch") {
const def = zodDef(schema);
if (def.type === "optional" || def.type === "default" || def.type === "catch") {
return true;
}
if (typeName === "ZodEffects") {
return isOptionalSchema(schema._def.schema);
if (def.type === "pipe") {
return isOptionalSchema(def.in as z.ZodTypeAny);
}
if (typeName === "ZodNullable") {
return isOptionalSchema(schema._def.innerType);
if (def.type === "nullable") {
return isOptionalSchema(def.innerType as z.ZodTypeAny);
}
return false;
}
function applyStringChecks(jsonSchema: JsonSchema, checks: Array<Record<string, unknown>>) {
// Zod 4 stores each check as an object with a `_zod.def` that carries a `check`
// name and the check members. Read that def to describe the constraint.
function checkDef(check: unknown): Record<string, unknown> | undefined {
return (check as { _zod?: { def?: Record<string, unknown> } })._zod?.def;
}
function applyStringChecks(jsonSchema: JsonSchema, checks: ReadonlyArray<unknown>) {
for (const check of checks) {
if (check.kind === "min") jsonSchema.minLength = check.value;
if (check.kind === "max") jsonSchema.maxLength = check.value;
if (check.kind === "email") jsonSchema.format = "email";
if (check.kind === "url") jsonSchema.format = "uri";
if (check.kind === "uuid") jsonSchema.format = "uuid";
if (check.kind === "datetime") jsonSchema.format = "date-time";
if (check.kind === "regex" && check.regex instanceof RegExp) {
jsonSchema.pattern = check.regex.source;
const def = checkDef(check);
if (!def) continue;
if (def.check === "min_length") jsonSchema.minLength = def.minimum;
else if (def.check === "max_length") jsonSchema.maxLength = def.maximum;
else if (def.check === "string_format") {
if (def.format === "email") jsonSchema.format = "email";
else if (def.format === "url") jsonSchema.format = "uri";
// Zod 3 `.uuid()` maps to `.guid()` in zod 4 to keep the loose UUID
// format. Publish both as the OpenAPI `uuid` format so the spec does not
// change.
else if (def.format === "uuid" || def.format === "guid") jsonSchema.format = "uuid";
else if (def.format === "datetime") jsonSchema.format = "date-time";
// Zod 4 stores a `.regex()` pattern as a `RegExp`; publish its source.
else if (def.format === "regex") {
if (def.pattern instanceof RegExp) jsonSchema.pattern = def.pattern.source;
else if (typeof def.pattern === "string") jsonSchema.pattern = def.pattern;
}
}
}
}
function applyNumberChecks(jsonSchema: JsonSchema, checks: Array<Record<string, unknown>>) {
function applyNumberChecks(jsonSchema: JsonSchema, checks: ReadonlyArray<unknown>) {
for (const check of checks) {
if (check.kind === "int") jsonSchema.type = "integer";
if (check.kind === "min") {
jsonSchema.minimum = check.value;
if (!check.inclusive) jsonSchema.exclusiveMinimum = true;
}
if (check.kind === "max") {
jsonSchema.maximum = check.value;
if (!check.inclusive) jsonSchema.exclusiveMaximum = true;
const def = checkDef(check);
if (!def) continue;
// `.int()` records a number-format check such as `safeint`.
if (def.check === "number_format") {
if (typeof def.format === "string" && def.format.includes("int")) {
jsonSchema.type = "integer";
}
} else if (def.check === "greater_than") {
jsonSchema.minimum = def.value;
if (!def.inclusive) jsonSchema.exclusiveMinimum = true;
} else if (def.check === "less_than") {
jsonSchema.maximum = def.value;
if (!def.inclusive) jsonSchema.exclusiveMaximum = true;
}
}
}
function zodToOpenApiSchema(schema: z.ZodTypeAny): JsonSchema {
const unwrapped = unwrapSchema(schema);
const typeName = zodTypeName(unwrapped);
const def = zodDef(unwrapped);
const typeName = def.type;
if (typeName === "ZodString") {
if (typeName === "string") {
const jsonSchema: JsonSchema = { type: "string" };
applyStringChecks(jsonSchema, unwrapped._def.checks ?? []);
applyStringChecks(jsonSchema, (def.checks as unknown[]) ?? []);
return jsonSchema;
}
if (typeName === "ZodNumber") {
if (typeName === "number") {
const jsonSchema: JsonSchema = { type: "number" };
applyNumberChecks(jsonSchema, unwrapped._def.checks ?? []);
applyNumberChecks(jsonSchema, (def.checks as unknown[]) ?? []);
return jsonSchema;
}
if (typeName === "ZodBoolean") return { type: "boolean" };
if (typeName === "ZodDate") return { type: "string", format: "date-time" };
if (typeName === "ZodAny" || typeName === "ZodUnknown") return {};
if (typeName === "boolean") return { type: "boolean" };
if (typeName === "date") return { type: "string", format: "date-time" };
if (typeName === "any" || typeName === "unknown") return {};
if (typeName === "ZodLiteral") {
const value = unwrapped._def.value;
return { type: typeof value, enum: [value] };
if (typeName === "literal") {
const values = def.values as unknown[];
return { type: typeof values[0], enum: values };
}
if (typeName === "ZodEnum") {
return { type: "string", enum: unwrapped._def.values };
}
if (typeName === "ZodNativeEnum") {
const values = Object.values(unwrapped._def.values).filter(
(value) => typeof value === "string" || typeof value === "number",
// Zod 4 merges string enums and native enums into one `enum` type and stores
// the members on `entries`. A pure string enum keeps `type: "string"`; a
// native enum can hold numbers, so it publishes the values without a type.
if (typeName === "enum") {
const values = Array.from(
new Set(
Object.values(def.entries as Record<string, unknown>).filter(
(value) => typeof value === "string" || typeof value === "number",
),
),
);
return { enum: Array.from(new Set(values)) };
if (values.every((value) => typeof value === "string")) {
return { type: "string", enum: values };
}
return { enum: values };
}
if (typeName === "ZodArray") {
return { type: "array", items: zodToOpenApiSchema(unwrapped._def.type) };
if (typeName === "array") {
return { type: "array", items: zodToOpenApiSchema(def.element as z.ZodTypeAny) };
}
if (typeName === "ZodRecord") {
if (typeName === "record") {
return {
type: "object",
additionalProperties: zodToOpenApiSchema(unwrapped._def.valueType),
additionalProperties: zodToOpenApiSchema(def.valueType as z.ZodTypeAny),
};
}
if (typeName === "ZodNullable") {
return { ...zodToOpenApiSchema(unwrapped._def.innerType), nullable: true };
if (typeName === "nullable") {
return { ...zodToOpenApiSchema(def.innerType as z.ZodTypeAny), nullable: true };
}
if (typeName === "ZodUnion") {
return { oneOf: unwrapped._def.options.map((option: z.ZodTypeAny) => zodToOpenApiSchema(option)) };
}
if (typeName === "ZodDiscriminatedUnion") {
// Zod 4 represents a plain union and a discriminated union as one `union`
// type with the members on `options`.
if (typeName === "union") {
return {
oneOf: Array.from(unwrapped._def.options.values()).map((option) =>
zodToOpenApiSchema(option as z.ZodTypeAny),
),
oneOf: (def.options as z.ZodTypeAny[]).map((option) => zodToOpenApiSchema(option)),
};
}
if (typeName === "ZodIntersection") {
if (typeName === "intersection") {
return {
allOf: [
zodToOpenApiSchema(unwrapped._def.left),
zodToOpenApiSchema(unwrapped._def.right),
zodToOpenApiSchema(def.left as z.ZodTypeAny),
zodToOpenApiSchema(def.right as z.ZodTypeAny),
],
};
}
if (typeName === "ZodObject") {
const shape = unwrapped._def.shape();
if (typeName === "object") {
const shape = def.shape as Record<string, z.ZodTypeAny>;
const properties: Record<string, JsonSchema> = {};
const required: string[] = [];
for (const [key, value] of Object.entries(shape)) {
const propertySchema = value as z.ZodTypeAny;
properties[key] = zodToOpenApiSchema(propertySchema);
if (!isOptionalSchema(propertySchema)) required.push(key);
properties[key] = zodToOpenApiSchema(value);
if (!isOptionalSchema(value)) required.push(key);
}
const jsonSchema: JsonSchema = { type: "object", properties };
if (required.length > 0) jsonSchema.required = required;
// A `.strict()` Zod object forbids an unknown key. Publish that constraint
// as `additionalProperties: false`, so a client, a gateway, or a handler
// that treats the contract as authoritative rejects an extra property too.
if (unwrapped._def.unknownKeys === "strict") jsonSchema.additionalProperties = false;
// A `.strict()` Zod object forbids an unknown key. Zod 4 records that as a
// `never` catchall. Publish the constraint as `additionalProperties: false`,
// so a client, a gateway, or a handler that treats the contract as
// authoritative rejects an extra property too.
const catchall = def.catchall as z.ZodTypeAny | undefined;
if (catchall && zodDef(catchall).type === "never") {
jsonSchema.additionalProperties = false;
}
return jsonSchema;
}
@@ -445,13 +480,13 @@ function normalizeResponses(responses: Record<string, OpenApiResponse> = {}) {
function parametersFromSchema(schema: z.ZodTypeAny, location: "path" | "query") {
const objectSchema = unwrapSchema(schema);
if (zodTypeName(objectSchema) !== "ZodObject") return [];
const shape = objectSchema._def.shape();
if (zodTypeName(objectSchema) !== "object") return [];
const shape = zodDef(objectSchema).shape as Record<string, z.ZodTypeAny>;
return Object.entries(shape).map(([name, value]) => ({
name,
in: location,
required: location === "path" ? true : !isOptionalSchema(value as z.ZodTypeAny),
schema: zodToOpenApiSchema(value as z.ZodTypeAny),
required: location === "path" ? true : !isOptionalSchema(value),
schema: zodToOpenApiSchema(value),
}));
}
@@ -511,7 +546,7 @@ const ErrorSchema = registry.register(
);
const responses = {
ok: (schema: z.ZodTypeAny = z.record(z.unknown())) => ({
ok: (schema: z.ZodTypeAny = z.record(z.string(), z.unknown())) => ({
description: "Success",
content: { "application/json": { schema } },
}),
@@ -600,11 +635,11 @@ const importRequestBody = (schema: z.ZodTypeAny) => ({
const r = responses;
const externalObjectSummariesBodySchema = z.object({
issueIds: z.array(z.string().uuid()).max(1000),
issueIds: z.array(z.string().guid()).max(1000),
}).strict();
const refreshExternalObjectsBodySchema = z.object({
objectIds: z.array(z.string().uuid()).max(50).optional(),
objectIds: z.array(z.string().guid()).max(50).optional(),
}).strict();
// The start route reads the body directly, so document the accepted fields
@@ -653,9 +688,9 @@ const workTimelineQuerySchema = z.object({
from: z.string().optional(),
to: z.string().optional(),
userId: z.string().optional(),
goalId: z.string().uuid().optional(),
projectId: z.string().uuid().optional(),
issueId: z.string().uuid().optional(),
goalId: z.string().guid().optional(),
projectId: z.string().guid().optional(),
issueId: z.string().guid().optional(),
limit: z.string().optional(),
offset: z.string().optional(),
}).strict();
@@ -709,7 +744,7 @@ const workTimelineResponseSchema = z.object({
function paramsSchemaFromPath(routePath: string): z.ZodObject<z.ZodRawShape> | undefined {
const names = [...routePath.matchAll(/\{([A-Za-z0-9_]+)\}/g)].map((match) => match[1]);
if (names.length === 0) return undefined;
const shape: z.ZodRawShape = {};
const shape: Record<string, z.ZodTypeAny> = {};
for (const name of names) {
shape[name] = z.string();
}
@@ -1713,7 +1748,7 @@ registry.registerPath({
const AgentSecretListResponseSchema = z.object({
secrets: z.array(z.object({
secretRef: z.string().uuid(),
secretRef: z.string().guid(),
key: z.string(),
name: z.string(),
description: z.string().nullable(),
@@ -1735,10 +1770,10 @@ const createAgentSecretProposalSchema = z.discriminatedUnion("kind", [
}),
z.object({
kind: z.literal("binding"),
secretId: z.string().uuid().optional(),
secretId: z.string().guid().optional(),
sourceConfigPath: z.string().min(1).optional(),
secretProposalId: z.string().uuid().optional(),
targetAgentId: z.string().uuid().optional(),
secretProposalId: z.string().guid().optional(),
targetAgentId: z.string().guid().optional(),
configPath: z.string().min(1),
justification: z.string().min(1),
}),
@@ -1760,7 +1795,7 @@ const approveSecretProposalSchema = z.object({
overrides: z.object({
name: z.string().min(1).optional(),
description: z.string().optional().nullable(),
providerConfigId: z.string().uuid().optional().nullable(),
providerConfigId: z.string().guid().optional().nullable(),
}).optional(),
});
@@ -1788,7 +1823,7 @@ registry.registerPath({
path: "/api/agents/me/secret-proposals/{id}",
tags: ["secrets"],
summary: "Withdraw a pending secret proposal",
request: { params: z.object({ id: z.string().uuid() }) },
request: { params: z.object({ id: z.string().guid() }) },
responses: { 200: r.ok(), 401: r.unauthorized, 403: r.forbidden, 404: r.notFound, 409: r.conflict },
});
@@ -3026,7 +3061,7 @@ registry.registerPath({
tags: ["secrets"],
summary: "List company secret proposals for board review",
request: {
params: z.object({ companyId: z.string().uuid() }),
params: z.object({ companyId: z.string().guid() }),
query: z.object({ status: z.enum(["pending", "approved", "rejected", "withdrawn", "expired"]).optional() }),
},
responses: { 200: r.ok(), 401: r.unauthorized, 403: r.forbidden },
@@ -3038,7 +3073,7 @@ registry.registerPath({
tags: ["secrets"],
summary: "Approve and execute a secret proposal as the approving board user",
request: {
params: z.object({ companyId: z.string().uuid(), id: z.string().uuid() }),
params: z.object({ companyId: z.string().guid(), id: z.string().guid() }),
body: jsonBody(approveSecretProposalSchema),
},
responses: { 200: r.ok(), 400: r.badRequest, 401: r.unauthorized, 403: r.forbidden, 404: r.notFound, 409: r.conflict, 422: r.unprocessable },
@@ -3050,7 +3085,7 @@ registry.registerPath({
tags: ["secrets"],
summary: "Reject a pending secret proposal and dependent bindings",
request: {
params: z.object({ companyId: z.string().uuid(), id: z.string().uuid() }),
params: z.object({ companyId: z.string().guid(), id: z.string().guid() }),
body: jsonBody(rejectSecretProposalSchema),
},
responses: { 200: r.ok(), 400: r.badRequest, 401: r.unauthorized, 403: r.forbidden, 404: r.notFound, 409: r.conflict, 422: r.unprocessable },
@@ -3423,9 +3458,9 @@ registry.registerPath({
request: {
params: z.object({ companyId: z.string() }),
query: z.object({
agentId: z.string().uuid().optional(),
agentId: z.string().guid().optional(),
responsibleUserId: z.string().min(1).optional(),
runId: z.string().uuid().optional(),
runId: z.string().guid().optional(),
entityType: z.string().min(1).optional(),
entityId: z.string().min(1).optional(),
action: z.string().min(1).optional(),
@@ -3447,9 +3482,9 @@ registry.registerPath({
request: {
params: z.object({ companyId: z.string() }),
query: z.object({
agentId: z.string().uuid().optional(),
agentId: z.string().guid().optional(),
responsibleUserId: z.string().min(1).optional(),
runId: z.string().uuid().optional(),
runId: z.string().guid().optional(),
entityType: z.string().min(1).optional(),
entityId: z.string().min(1).optional(),
action: z.string().min(1).optional(),
@@ -3484,8 +3519,8 @@ registry.registerPath({
action: z.string().min(1),
entityType: z.string().min(1),
entityId: z.string().min(1),
agentId: z.string().uuid().optional().nullable(),
details: z.record(z.unknown()).optional().nullable(),
agentId: z.string().guid().optional().nullable(),
details: z.record(z.string(), z.unknown()).optional().nullable(),
})),
},
responses: { 200: r.ok(), 400: r.badRequest, 401: r.unauthorized },
@@ -3850,9 +3885,9 @@ registerCurrentRoute({
summary: "List decisions",
query: z.object({
status: z.enum(["open", "decided", "expired", "cancelled"]).optional(),
bundleId: z.string().uuid().optional(),
targetIssueId: z.string().uuid().optional(),
originAgentId: z.string().uuid().optional(),
bundleId: z.string().guid().optional(),
targetIssueId: z.string().guid().optional(),
originAgentId: z.string().guid().optional(),
limit: z.coerce.number().int().positive().max(100).optional(),
}),
responses: { 200: r.ok(), 400: r.badRequest, 401: r.unauthorized, 403: r.forbidden },
@@ -3865,7 +3900,7 @@ registerCurrentRoute({
summary: "Get decision telemetry grouped by rule key",
query: z.object({
groupBy: z.literal("ruleKey"),
originAgentId: z.string().uuid().optional(),
originAgentId: z.string().guid().optional(),
since: z.string().datetime().optional(),
}),
responses: { 200: r.ok(), 400: r.badRequest, 401: r.unauthorized, 403: r.forbidden },
@@ -3920,8 +3955,8 @@ registerCurrentRoute({
summary: "Capture a decision training example",
body: z.object({
sourceKind: decisionTrainingSourceKindSchema,
sourceId: z.string().uuid(),
issueId: z.string().uuid(),
sourceId: z.string().guid(),
issueId: z.string().guid(),
notes: z.string().max(100_000).default(""),
}).strict(),
responses: { 201: r.ok(), 400: r.badRequest, 401: r.unauthorized, 403: r.forbidden, 404: r.notFound, 409: r.conflict },
@@ -3934,8 +3969,8 @@ registerCurrentRoute({
summary: "Preview a decision training snapshot",
body: z.object({
sourceKind: decisionTrainingSourceKindSchema,
sourceId: z.string().uuid(),
issueId: z.string().uuid(),
sourceId: z.string().guid(),
issueId: z.string().guid(),
}).strict(),
responses: { 200: r.ok(), 400: r.badRequest, 401: r.unauthorized, 403: r.forbidden, 404: r.notFound, 409: r.conflict },
});
@@ -3946,7 +3981,7 @@ registerCurrentRoute({
tags: ["decision-training"],
summary: "List decision training examples",
query: z.object({
project: z.string().uuid().optional(),
project: z.string().guid().optional(),
kind: decisionTrainingSourceKindSchema.optional(),
author: z.string().optional(),
q: z.string().max(500).optional(),
@@ -5813,7 +5848,7 @@ registry.registerPath({
request: {
body: jsonBody(z.object({
tool: z.string(),
parameters: z.record(z.unknown()).optional(),
parameters: z.record(z.string(), z.unknown()).optional(),
runContext: z.object({
agentId: z.string(),
runId: z.string(),
@@ -5922,7 +5957,7 @@ registry.registerPath({
summary: "Set company-scoped plugin config",
request: {
params: z.object({ pluginId: z.string() }),
body: jsonBody(z.object({ companyId: z.string(), configJson: z.record(z.unknown()) })),
body: jsonBody(z.object({ companyId: z.string(), configJson: z.record(z.string(), z.unknown()) })),
},
responses: { 200: r.ok(), 400: r.badRequest, 401: r.unauthorized },
});
@@ -5934,7 +5969,7 @@ registry.registerPath({
summary: "Test company-scoped plugin config",
request: {
params: z.object({ pluginId: z.string() }),
body: jsonBody(z.object({ companyId: z.string(), configJson: z.record(z.unknown()) })),
body: jsonBody(z.object({ companyId: z.string(), configJson: z.record(z.string(), z.unknown()) })),
},
responses: { 200: r.ok(), 400: r.badRequest, 401: r.unauthorized },
});
@@ -5996,7 +6031,7 @@ registry.registerPath({
body: jsonBody(z.object({
key: z.string(),
companyId: z.string().optional(),
params: z.record(z.unknown()).optional(),
params: z.record(z.string(), z.unknown()).optional(),
})),
},
responses: { 200: r.ok(), 401: r.unauthorized },
@@ -6012,7 +6047,7 @@ registry.registerPath({
body: jsonBody(z.object({
key: z.string(),
companyId: z.string().optional(),
params: z.record(z.unknown()).optional(),
params: z.record(z.string(), z.unknown()).optional(),
})),
},
responses: { 200: r.ok(), 401: r.unauthorized },
@@ -6027,7 +6062,7 @@ registry.registerPath({
params: z.object({ pluginId: z.string(), key: z.string() }),
body: jsonBody(z.object({
companyId: z.string().optional(),
params: z.record(z.unknown()).optional(),
params: z.record(z.string(), z.unknown()).optional(),
})),
},
responses: { 200: r.ok(), 401: r.unauthorized },
@@ -6042,7 +6077,7 @@ registry.registerPath({
params: z.object({ pluginId: z.string(), key: z.string() }),
body: jsonBody(z.object({
companyId: z.string().optional(),
params: z.record(z.unknown()).optional(),
params: z.record(z.string(), z.unknown()).optional(),
})),
},
responses: { 200: r.ok(), 401: r.unauthorized },
@@ -6810,7 +6845,7 @@ for (const route of [
path: route[1],
tags: ["skills"],
summary: route[2],
...(route[0] === "post" ? { body: z.record(z.unknown()).optional() } : {}),
...(route[0] === "post" ? { body: z.record(z.string(), z.unknown()).optional() } : {}),
});
}
@@ -6884,7 +6919,7 @@ registerCurrentRoute({
summary: "Promote quarantined low-trust output",
body: z.object({
sourceArtifactKind: z.enum(["comment", "document", "work_product", "issue"]),
sourceArtifactId: z.string().uuid(),
sourceArtifactId: z.string().guid(),
title: z.string().trim().min(1).max(200),
summary: z.string().trim().min(1).max(8_000),
}),
@@ -7600,7 +7635,7 @@ const toolGatewaySessionSchema = z.object({
const toolGatewayCallSchema = z.object({
tool: z.string(),
parameters: z.record(z.unknown()).optional(),
parameters: z.record(z.string(), z.unknown()).optional(),
timeoutMs: z.number().int().positive().optional(),
approvedActionRequestId: z.string().optional(),
idempotencyKey: z.string().optional(),
@@ -7613,7 +7648,7 @@ const toolGatewayCompanyBodySchema = z.object({
companyId: z.string(),
}).passthrough();
const mcpGatewayProtocolSchema = z.record(z.unknown());
const mcpGatewayProtocolSchema = z.record(z.string(), z.unknown());
registerCurrentRoute({
method: "get",
+19 -19
View File
@@ -94,9 +94,9 @@ const casePatchSchema = z.object({
summary: z.string().max(8_000).nullable().optional(),
fields: jsonObjectSchema.optional(),
workspaceRef: jsonObjectSchema.nullable().optional(),
parentCaseId: z.string().uuid().nullable().optional(),
parentCaseId: z.string().guid().nullable().optional(),
expectedVersion: z.number().int().positive().optional(),
leaseToken: z.string().uuid().nullable().optional(),
leaseToken: z.string().guid().nullable().optional(),
});
const ingestCaseSchema = z.object({
caseKey: z.string().max(1_024).nullable().optional(),
@@ -104,17 +104,17 @@ const ingestCaseSchema = z.object({
summary: z.string().max(8_000).nullable().optional(),
fields: jsonObjectSchema.optional(),
stageKey: z.string().trim().min(1).max(120).optional(),
parentCaseId: z.string().uuid().nullable().optional(),
parentCaseId: z.string().guid().nullable().optional(),
requestKey: z.string().trim().min(1).max(512).optional(),
workspaceRef: jsonObjectSchema.nullable().optional(),
blockedByCaseIds: z.array(z.string().uuid()).max(100).optional(),
blockedByCaseIds: z.array(z.string().guid()).max(100).optional(),
blockedByCaseKeys: z.array(z.string().max(1_024)).max(100).optional(),
});
const createPipelineSchema = z.object({
key: z.string().trim().min(1).max(120),
name: z.string().trim().min(1).max(200),
description: z.string().max(8_000).nullable().optional(),
projectId: z.string().uuid().nullable().optional(),
projectId: z.string().guid().nullable().optional(),
enforceTransitions: z.boolean().optional(),
stages: z.array(z.object({
key: z.string().trim().min(1).max(120),
@@ -146,7 +146,7 @@ const updateStageSchema = z.object({
});
const updateStageAutomationEnvSchema = z.object({
env: envConfigSchema.nullable(),
baseRoutineRevisionId: z.string().uuid().nullable().optional(),
baseRoutineRevisionId: z.string().guid().nullable().optional(),
});
const replaceTransitionsSchema = z.object({
transitions: z.array(z.object({
@@ -167,16 +167,16 @@ const breakdownCaseSchema = z.object({
});
const claimCaseSchema = z.object({ leaseSeconds: z.number().int().positive().max(86_400).optional() });
const releaseCaseSchema = z.object({
leaseToken: z.string().uuid().nullable().optional(),
leaseToken: z.string().guid().nullable().optional(),
force: z.boolean().optional(),
});
const transitionCaseSchema = z.object({
toStageKey: z.string().trim().min(1).max(120),
expectedVersion: z.number().int().positive(),
leaseToken: z.string().uuid().nullable().optional(),
leaseToken: z.string().guid().nullable().optional(),
reason: z.string().max(4_000).nullable().optional(),
force: z.boolean().optional(),
acceptSuggestionId: z.string().uuid().optional(),
acceptSuggestionId: z.string().guid().optional(),
});
const suggestTransitionSchema = z.object({
toStageKey: z.string().trim().min(1).max(120),
@@ -184,52 +184,52 @@ const suggestTransitionSchema = z.object({
confidence: z.number().min(0).max(1).optional(),
});
const resolveSuggestionSchema = z.object({
suggestionId: z.string().uuid(),
suggestionId: z.string().guid(),
resolution: z.enum(["accept", "dismiss"]),
expectedVersion: z.number().int().positive().optional(),
reason: z.string().max(4_000).nullable().optional(),
leaseToken: z.string().uuid().nullable().optional(),
leaseToken: z.string().guid().nullable().optional(),
});
const acknowledgeDriftSchema = z.object({
expectedVersion: z.number().int().positive().optional(),
});
const retryAutomationQuerySchema = z.object({
scope: pipelineAutomationRetryScopeSchema.default("previous_stage"),
targetStageId: z.string().uuid().optional(),
targetStageId: z.string().guid().optional(),
});
const reviewEditsSchema = z.object({
title: z.string().trim().min(1).max(500).optional(),
summary: z.string().max(8_000).nullable().optional(),
fields: jsonObjectSchema.optional(),
parentCaseId: z.string().uuid().nullable().optional(),
parentCaseId: z.string().guid().nullable().optional(),
});
const reviewCaseSchema = z.object({
decision: z.enum(["approve", "reject", "request_changes"]),
reason: z.string().max(4_000).nullable().optional(),
edits: reviewEditsSchema.optional(),
expectedVersion: z.number().int().positive(),
leaseToken: z.string().uuid().nullable().optional(),
leaseToken: z.string().guid().nullable().optional(),
});
const blockersSchema = z.object({ blockedByCaseIds: z.array(z.string().uuid()).max(100) });
const blockersSchema = z.object({ blockedByCaseIds: z.array(z.string().guid()).max(100) });
const issueLinkRoleSchema = z.enum(["origin", "conversation", "work", "automation"]);
const createIssueLinkSchema = z.object({
issueId: z.string().uuid(),
issueId: z.string().guid(),
role: issueLinkRoleSchema,
});
const bulkReviewSchema = z.object({
items: z.array(reviewCaseSchema.extend({ caseId: z.string().uuid() })).max(100),
items: z.array(reviewCaseSchema.extend({ caseId: z.string().guid() })).max(100),
});
const upsertPipelineDocumentSchema = z.object({
title: z.string().trim().min(1).max(200).optional(),
body: z.string().max(200_000),
baseRevisionId: z.string().uuid().nullable().optional(),
baseRevisionId: z.string().guid().nullable().optional(),
});
const upsertPipelineCaseDocumentSchema = z.object({
title: z.string().trim().min(1).max(200).optional(),
format: z.string().trim().min(1).max(80).optional().default("markdown"),
body: z.string().max(200_000),
changeSummary: z.string().trim().max(1_000).nullable().optional(),
baseRevisionId: z.string().uuid().nullable().optional(),
baseRevisionId: z.string().guid().nullable().optional(),
});
const intakeFieldTypes = new Set(["select", "text", "multiline"]);
+1 -1
View File
@@ -26,7 +26,7 @@ type CursorValue = { createdAt: string; id: string };
const cursorValueSchema = z.object({
createdAt: z.string().datetime({ offset: true }),
id: z.string().uuid(),
id: z.string().guid(),
});
function decodeCursor(cursor: string | undefined): CursorValue | null {
+5 -5
View File
@@ -33,16 +33,16 @@ import { resolveActiveEnvironmentCustomImageTemplateForRuntime } from "./environ
const secretRefSchema = z.object({
type: z.literal("secret_ref"),
secretId: z.string().uuid(),
secretId: z.string().guid(),
version: z.union([z.literal("latest"), z.number().int().positive()]).optional().default("latest"),
}).strict();
const sshEnvironmentConfigSchema = z.object({
host: z.string({ required_error: "SSH environments require a host." }).trim().min(1, "SSH environments require a host."),
host: z.string({ error: "SSH environments require a host." }).trim().min(1, "SSH environments require a host."),
port: z.coerce.number().int().min(1).max(65535).default(22),
username: z.string({ required_error: "SSH environments require a username." }).trim().min(1, "SSH environments require a username."),
username: z.string({ error: "SSH environments require a username." }).trim().min(1, "SSH environments require a username."),
remoteWorkspacePath: z
.string({ required_error: "SSH environments require a remote workspace path." })
.string({ error: "SSH environments require a remote workspace path." })
.trim()
.min(1, "SSH environments require a remote workspace path.")
.refine((value) => value.startsWith("/"), "SSH remote workspace path must be absolute."),
@@ -102,7 +102,7 @@ const pluginEnvironmentConfigSchema = z.object({
/^[a-z0-9][a-z0-9._-]*$/,
"Environment driver key must start with a lowercase alphanumeric and contain only lowercase letters, digits, dots, hyphens, or underscores",
),
driverConfig: z.record(z.unknown()).optional().default({}),
driverConfig: z.record(z.string(), z.unknown()).optional().default({}),
}).strict();
export type ParsedEnvironmentConfig =
@@ -128,8 +128,13 @@ export function pluginManifestValidator(): PluginManifestValidator {
};
}
const details = result.error.errors.map((issue) => ({
path: issue.path,
const details = result.error.issues.map((issue) => ({
// Zod 4 types an issue path as `PropertyKey[]`, which can include a
// symbol. A manifest path only has string or number segments, so map a
// rare symbol segment to its string form for a stable message.
path: issue.path.map((segment) =>
typeof segment === "symbol" ? segment.toString() : segment,
),
message: issue.message,
}));