@treeseed/sdk 0.13.0-rc.122 → 0.13.0-rc.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +1392 -974
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +72 -27
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +34 -34
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.d.ts +2 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.js +13 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +1 -0
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +126 -1
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +35 -1
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +1 -3
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +21 -15
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +3 -42
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +8 -8
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +227 -66
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +54 -19
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +214 -5
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +47 -47
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -0
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +434 -230
- package/dist/agent-capacity/contracts/support/execution-graph.js +20 -18
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +2 -0
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +286 -254
- package/dist/agent-capacity/validation/agent-definition-schema.js +22 -28
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +1 -1
- package/dist/agent-capacity/validation/assignment-records.js +45 -0
- package/dist/capacity/agents/agent-capacity.d.ts +1 -0
- package/dist/capacity/agents/agent-capacity.js +1 -0
- package/dist/capacity-provider/capability-ontology.d.ts +102 -102
- package/dist/capacity-provider/client.d.ts +14 -7
- package/dist/capacity-provider/client.js +1 -4
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +0 -1
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +40 -40
- package/dist/capacity-provider/contracts/governance.d.ts +2 -17
- package/dist/capacity-provider/contracts/index.d.ts +2 -0
- package/dist/capacity-provider/contracts/index.js +2 -0
- package/dist/capacity-provider/core-capability-catalog.d.ts +7 -7
- package/dist/capacity-provider/environment-catalog.d.ts +22 -22
- package/dist/capacity-provider/environment-catalog.js +1 -1
- package/dist/capacity-provider/install-configuration.d.ts +4 -4
- package/dist/capacity-provider/sandbox-contracts.d.ts +54 -54
- package/dist/capacity-provider/source-workspace.d.ts +76 -76
- package/dist/capacity-provider/validation.d.ts +10 -2
- package/dist/capacity-provider/validation.js +52 -22
- package/dist/content/validation/agent-operational-content-schemas.d.ts +120 -118
- package/dist/content/validation/agent-operational-content-schemas.js +2 -0
- package/dist/content/validation/auxiliary-content-schemas.d.ts +92 -92
- package/dist/content/validation/content-model-schemas.d.ts +3155 -2512
- package/dist/content/validation/content-model-schemas.js +97 -87
- package/dist/content/validation/portable-content-data.d.ts +173 -168
- package/dist/content/validation/schema-constraints.d.ts +78 -0
- package/dist/content/validation/schema-constraints.js +149 -0
- package/dist/deployment/ai/storage.d.ts +20 -20
- package/dist/deployment/ai-hosting.d.ts +12 -12
- package/dist/deployment/ai-instance.d.ts +12 -12
- package/dist/deployment/ai-mode.d.ts +34 -34
- package/dist/deployment/hosted-topology-template.d.ts +25 -25
- package/dist/deployment/hosted-topology.d.ts +146 -146
- package/dist/deployment/postgres/transfer.d.ts +2 -2
- package/dist/deployment/schemas.d.ts +504 -504
- package/dist/development/schemas.d.ts +325 -325
- package/dist/graph/context-query-contracts.js +1 -1
- package/dist/guarantees/index.d.ts +26 -2
- package/dist/identity/contracts.js +6 -1
- package/dist/operator-contracts/canonical-command-tree.js +22 -8
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +27 -27
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +25 -25
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +11 -9
- package/dist/operator-contracts/catalog/communication-operations.d.ts +108 -90
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +33 -33
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +27 -27
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +4 -4
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +2 -1
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +5 -5
- package/dist/operator-contracts/catalog/provider-environment-operations.d.ts +3 -3
- package/dist/operator-contracts/catalog/services/secret-operations.d.ts +16 -8
- package/dist/operator-contracts/catalog/services/secret-operations.js +2 -1
- package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +11 -11
- package/dist/operator-contracts/catalog/workdays/selection-commands.js +7 -6
- package/dist/operator-contracts/communication/contracts.d.ts +340 -198
- package/dist/operator-contracts/communication/contracts.js +6 -1
- package/dist/operator-contracts/control-plane-operation.d.ts +7 -0
- package/dist/operator-contracts/control-plane-operation.js +6 -0
- package/dist/operator-contracts/control-plane-operations.d.ts +469 -442
- package/dist/operator-contracts/control-plane-operations.js +26 -10
- package/dist/operator-contracts/inbox/contracts.d.ts +100 -100
- package/dist/operator-contracts/knowledge/contracts.d.ts +6 -6
- package/dist/operator-contracts/mcp.js +4 -3
- package/dist/operator-contracts/workday-lifecycle.d.ts +192 -2
- package/dist/operator-contracts/workday-lifecycle.js +108 -45
- package/dist/platform/agent-schema-verification.js +316 -33
- package/dist/platform/contracts.d.ts +72 -72
- package/dist/platform/schemas.d.ts +144 -36
- package/dist/platform/schemas.js +26 -0
- package/dist/platform/verification.js +4 -0
- package/dist/sdk-types/support/sdk-search-request.d.ts +2 -2
- package/dist/secrets-capability/secret-contracts.d.ts +2 -2
- package/dist/secrets-capability/shared-access.d.ts +1 -1
- package/dist/secrets-capability/shared-resources.d.ts +30 -30
- package/dist/security/encrypted-envelope.d.ts +6 -6
- package/dist/treedx/client.d.ts +4 -4
- package/dist/treedx/index.d.ts +1 -1
- package/dist/treedx/index.js +1 -0
- package/dist/treedx/types.d.ts +286 -0
- package/dist/treedx/types.js +44 -0
- package/dist/types/agents/agent-activity-profile.d.ts +1 -0
- package/guarantees/agent/golden/component-boundaries.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product-custody.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product.guarantee.yaml +12 -0
- package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +837 -0
- package/guarantees/agent/golden/scenes/product-custody.scene.yaml +53 -0
- package/guarantees/agent/golden/scenes/product.scene.yaml +8 -0
- package/guarantees/verifiers/golden.verifiers.yaml +1429 -0
- package/package.json +10 -5
- package/tests/acceptance/golden-product.test.ts +205 -0
- package/tests/acceptance/golden-product.ts +404 -0
- package/tests/acceptance/product/base-red.ts +73 -0
- package/tests/acceptance/product/documentation-examples.ts +68 -0
- package/tests/acceptance/product/intent-runtime.ts +145 -0
- package/tests/acceptance/product/release-output.ts +160 -0
- package/tests/acceptance/product/research-artifact.ts +87 -0
- package/tests/acceptance/product/research-revision.ts +82 -0
- package/tests/acceptance/product/research-source.ts +91 -0
- package/tests/acceptance/product/test-chain.ts +192 -0
- package/treeseed.package.yaml +147 -0
- package/dist/.treeseed-build-complete.json +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { conditionalFields, requiredProperties, uniqueArray as unique } from "./schema-constraints.js";
|
|
3
|
+
import { agentClassSchema as agentClass, agentDefinitionSchema, permissionSetSchema } from "../../agent-capacity/validation/agent-definition-schema.js";
|
|
3
4
|
import {
|
|
4
5
|
BOOK_SCHEMA_VERSION,
|
|
5
6
|
KNOWLEDGE_PAGE_SCHEMA_VERSION,
|
|
@@ -13,33 +14,26 @@ import { agentTestContentSchema, templateProductContentSchema, workdayContentSch
|
|
|
13
14
|
export * from "./agent-operational-content-schemas.js";
|
|
14
15
|
const nonEmpty = z.string().trim().min(1);
|
|
15
16
|
const strings = z.array(z.string());
|
|
16
|
-
const identifier = z.string().
|
|
17
|
-
const slug = z.string().
|
|
18
|
-
const agentClass = z.string().trim().min(1).max(100).regex(/^[a-z][a-z0-9-]*$/u);
|
|
17
|
+
const identifier = z.string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u);
|
|
18
|
+
const slug = z.string().min(1).max(100).regex(/^[a-z0-9]+(?:[._/-][a-z0-9]+)*$/u);
|
|
19
19
|
const identifiers = z.array(identifier);
|
|
20
|
-
const unique = (schema) => schema.superRefine((values, context) => {
|
|
21
|
-
if (new Set(values.map((value) => JSON.stringify(value))).size !== values.length) {
|
|
22
|
-
context.addIssue({ code: z.ZodIssueCode.custom, message: "Values must be unique." });
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
20
|
const date = z.coerce.date();
|
|
26
21
|
const lifecycleStatus = z.enum(["live", "in progress", "exploratory", "planned", "speculative"]);
|
|
27
22
|
const exactRefs = z.array(exactEntityReferenceSchema);
|
|
23
|
+
const exactWorkItemReferenceSchema = z.intersection(exactEntityReferenceSchema, requiredProperties(
|
|
24
|
+
z.object({
|
|
25
|
+
store: z.literal("treedx"),
|
|
26
|
+
model: z.literal("proposal"),
|
|
27
|
+
anchor: z.string().regex(new RegExp("^work-item/[a-z0-9]+(?:-[a-z0-9]+)*$", "u"))
|
|
28
|
+
}).passthrough(),
|
|
29
|
+
["store", "model", "id", "revision", "digest", "repository", "commit", "path", "anchor"],
|
|
30
|
+
"A dependency endpoint must identify an exact proposal work item."
|
|
31
|
+
));
|
|
28
32
|
const exactDependencyLinkSchema = z.object({
|
|
29
33
|
relation: z.literal("depends_on"),
|
|
30
|
-
from:
|
|
31
|
-
to:
|
|
34
|
+
from: exactWorkItemReferenceSchema,
|
|
35
|
+
to: exactWorkItemReferenceSchema
|
|
32
36
|
}).strict().superRefine((link, context) => {
|
|
33
|
-
for (const end of ["from", "to"]) {
|
|
34
|
-
const ref = link[end];
|
|
35
|
-
if (ref.store !== "treedx" || ref.model !== "proposal" || !ref.repository || !ref.commit || !ref.path || !ref.digest || !ref.revision || !/^work-item\/[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(ref.anchor ?? "")) {
|
|
36
|
-
context.addIssue({
|
|
37
|
-
code: z.ZodIssueCode.custom,
|
|
38
|
-
path: [end],
|
|
39
|
-
message: "A dependency endpoint must identify an exact proposal work item."
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
37
|
if (JSON.stringify(link.from) === JSON.stringify(link.to)) context.addIssue({
|
|
44
38
|
code: z.ZodIssueCode.custom,
|
|
45
39
|
message: "A work item cannot depend on itself."
|
|
@@ -82,29 +76,28 @@ const proposalLinks = {
|
|
|
82
76
|
decision_dependencies: z.array(z.object({ projectId: nonEmpty, decisionId: nonEmpty }).strict()).optional(),
|
|
83
77
|
...linked
|
|
84
78
|
};
|
|
85
|
-
const executionPlanWorkItemSchema = z.object({
|
|
86
|
-
id:
|
|
79
|
+
const executionPlanWorkItemSchema = conditionalFields(z.object({
|
|
80
|
+
id: slug,
|
|
81
|
+
priority: z.number().int().safe().optional(),
|
|
87
82
|
activity: z.literal("acting"),
|
|
88
|
-
agentClass
|
|
83
|
+
agentClass,
|
|
89
84
|
workspace: z.enum(["read-only", "treedx", "git"]),
|
|
90
85
|
review: z.enum(["required", "none"]),
|
|
91
86
|
objective: nonEmpty,
|
|
92
87
|
estimate: estimateSchema.optional(),
|
|
93
88
|
reviewEstimate: estimateSchema.optional(),
|
|
94
89
|
maximumReviewCycles: z.number().int().positive().optional(),
|
|
95
|
-
dependsOn: z.array(
|
|
96
|
-
requestedPermissions:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}).strict(),
|
|
100
|
-
requiredCapabilities: z.array(nonEmpty).min(1),
|
|
101
|
-
contextRefs: z.array(exactEntityReferenceSchema).optional(),
|
|
90
|
+
dependsOn: unique(z.array(slug)),
|
|
91
|
+
requestedPermissions: permissionSetSchema,
|
|
92
|
+
requiredCapabilities: unique(z.array(identifier)).optional(),
|
|
93
|
+
contextRefs: unique(exactRefs).optional(),
|
|
102
94
|
acceptanceCriteria: z.array(nonEmpty).min(1)
|
|
103
|
-
}).strict()
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
}).strict(), [
|
|
96
|
+
{ field: "review", equals: "required", alternatives: [["maximumReviewCycles"]], message: "Required review needs a maximum cycle count." },
|
|
97
|
+
{ field: "review", equals: "none", forbidden: { fields: ["reviewEstimate", "maximumReviewCycles"] }, message: "Unreviewed work cannot define review estimates or cycles." }
|
|
98
|
+
]).superRefine((value, context) => {
|
|
106
99
|
if (value.workspace !== "read-only") {
|
|
107
|
-
const mutable = (value.contextRefs ?? []).filter((reference) => reference.store === value.workspace);
|
|
100
|
+
const mutable = (value.contextRefs ?? []).filter((reference) => reference.store === value.workspace && reference.model === "repository");
|
|
108
101
|
if (mutable.length !== 1) context.addIssue({ code: z.ZodIssueCode.custom, path: ["contextRefs"], message: `${value.workspace} work requires exactly one exact ${value.workspace} workspace reference.` });
|
|
109
102
|
}
|
|
110
103
|
});
|
|
@@ -128,11 +121,12 @@ const executionPlanSchema = z.object({ workItems: z.array(executionPlanWorkItemS
|
|
|
128
121
|
};
|
|
129
122
|
if ([...ids].some(cyclic)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["workItems"], message: "Work-item dependencies must be acyclic." });
|
|
130
123
|
});
|
|
131
|
-
const proposalSchema = z.object({
|
|
124
|
+
const proposalSchema = conditionalFields(z.object({
|
|
132
125
|
schemaVersion: z.literal("treeseed.proposal/v1"),
|
|
133
|
-
id:
|
|
134
|
-
projectId:
|
|
126
|
+
id: identifier,
|
|
127
|
+
projectId: identifier,
|
|
135
128
|
title: nonEmpty,
|
|
129
|
+
groupIds: unique(identifiers).optional(),
|
|
136
130
|
request: nonEmpty,
|
|
137
131
|
summary: nonEmpty.optional(),
|
|
138
132
|
status: z.enum(["draft", "discussing", "ready", "decided", "withdrawn"]),
|
|
@@ -140,26 +134,18 @@ const proposalSchema = z.object({
|
|
|
140
134
|
evidenceRefs: unique(exactRefs).optional(),
|
|
141
135
|
discussionRef: exactEntityReferenceSchema.optional(),
|
|
142
136
|
executionPlan: executionPlanSchema.optional()
|
|
143
|
-
}).strict()
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
if (["ready", "decided"].includes(value.status) && !value.summary) {
|
|
157
|
-
context.addIssue({ code: z.ZodIssueCode.custom, path: ["summary"], message: "A ready proposal requires a summary." });
|
|
158
|
-
}
|
|
159
|
-
if (["ready", "decided"].includes(value.status) && !value.executionPlan) {
|
|
160
|
-
context.addIssue({ code: z.ZodIssueCode.custom, path: ["executionPlan"], message: "A ready proposal requires an execution plan." });
|
|
161
|
-
}
|
|
162
|
-
});
|
|
137
|
+
}).strict(), [{
|
|
138
|
+
field: "status",
|
|
139
|
+
in: ["ready", "decided"],
|
|
140
|
+
alternatives: [["summary", "executionPlan"]],
|
|
141
|
+
items: {
|
|
142
|
+
field: "executionPlan",
|
|
143
|
+
key: "workItems",
|
|
144
|
+
required: ["estimate"],
|
|
145
|
+
conditional: { field: "review", equals: "required", required: ["reviewEstimate"] }
|
|
146
|
+
},
|
|
147
|
+
message: "Ready proposals require a summary, an execution plan, and each required independent estimate."
|
|
148
|
+
}]);
|
|
163
149
|
const schemas = {
|
|
164
150
|
page: z.object({
|
|
165
151
|
title: nonEmpty,
|
|
@@ -172,35 +158,40 @@ const schemas = {
|
|
|
172
158
|
summary: nonEmpty.optional(),
|
|
173
159
|
updated_at: date.optional()
|
|
174
160
|
}),
|
|
175
|
-
note: z.object({
|
|
161
|
+
note: conditionalFields(z.object({
|
|
176
162
|
schemaVersion: z.literal("treeseed.note/v1"),
|
|
177
|
-
id:
|
|
178
|
-
projectId:
|
|
163
|
+
id: identifier,
|
|
164
|
+
projectId: identifier,
|
|
179
165
|
classification: z.enum(["general", "feedback", "research", "workday-report"]),
|
|
180
|
-
subjectRefs: exactRefs.min(1),
|
|
166
|
+
subjectRefs: unique(exactRefs.min(1)),
|
|
181
167
|
body: nonEmpty,
|
|
182
168
|
createdAt: z.string().datetime({ offset: true }),
|
|
183
169
|
links: z.array(exactDependencyLinkSchema).optional()
|
|
184
|
-
}).strict()
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
170
|
+
}).strict(), [{
|
|
171
|
+
field: "classification",
|
|
172
|
+
equals: "workday-report",
|
|
173
|
+
contains: { field: "subjectRefs", properties: { store: "postgresql", model: "workday" } },
|
|
174
|
+
path: ["subjectRefs"],
|
|
175
|
+
message: "Workday reports must reference their exact workday."
|
|
176
|
+
}]),
|
|
177
|
+
question: conditionalFields(z.object({
|
|
190
178
|
schemaVersion: z.literal("treeseed.question/v1"),
|
|
191
|
-
id:
|
|
192
|
-
projectId:
|
|
179
|
+
id: identifier,
|
|
180
|
+
projectId: identifier,
|
|
193
181
|
subjectRef: exactEntityReferenceSchema,
|
|
194
182
|
question: nonEmpty,
|
|
195
183
|
status: z.enum(["open", "answered", "withdrawn"]),
|
|
196
|
-
addressedTo:
|
|
184
|
+
addressedTo: unique(z.array(agentClass)).optional(),
|
|
197
185
|
answer: nonEmpty.optional(),
|
|
198
|
-
answerRefs: exactRefs.optional(),
|
|
186
|
+
answerRefs: unique(exactRefs).optional(),
|
|
199
187
|
askedAt: z.string().datetime({ offset: true }),
|
|
200
188
|
answeredAt: z.string().datetime({ offset: true }).optional()
|
|
201
|
-
}).strict()
|
|
202
|
-
|
|
203
|
-
|
|
189
|
+
}).strict(), [{
|
|
190
|
+
field: "status",
|
|
191
|
+
equals: "answered",
|
|
192
|
+
alternatives: [["answer"], ["answerRefs"]],
|
|
193
|
+
message: "Answered questions require an answer or exact answer reference."
|
|
194
|
+
}]),
|
|
204
195
|
objective: z.object({
|
|
205
196
|
schemaVersion: z.literal("treeseed.objective/v1"),
|
|
206
197
|
id: identifier,
|
|
@@ -211,25 +202,44 @@ const schemas = {
|
|
|
211
202
|
evidenceRefs: unique(exactRefs).optional()
|
|
212
203
|
}).strict(),
|
|
213
204
|
proposal: proposalSchema,
|
|
214
|
-
decision: z.object({
|
|
205
|
+
decision: conditionalFields(z.object({
|
|
215
206
|
schemaVersion: z.literal("treeseed.decision/v1"),
|
|
216
|
-
id:
|
|
217
|
-
projectId:
|
|
207
|
+
id: identifier,
|
|
208
|
+
projectId: identifier,
|
|
218
209
|
decisionClass: z.enum(["proposal", "work-review", "publication"]),
|
|
219
210
|
decisionMethod: z.enum(["authority", "approval", "vote"]),
|
|
220
211
|
subjectRef: exactEntityReferenceSchema,
|
|
221
212
|
disposition: z.enum(["approved", "rejected", "request-changes", "deferred", "superseded"]),
|
|
222
213
|
rationale: nonEmpty,
|
|
223
|
-
findingRefs: exactRefs.optional(),
|
|
224
|
-
authorityRefs: exactRefs.min(1),
|
|
225
|
-
decidedByRefs: exactRefs.min(1),
|
|
214
|
+
findingRefs: unique(exactRefs).optional(),
|
|
215
|
+
authorityRefs: unique(exactRefs.min(1)),
|
|
216
|
+
decidedByRefs: unique(exactRefs.min(1)),
|
|
226
217
|
positions: z.array(z.object({ actorRef: exactEntityReferenceSchema, position: z.enum(["approve", "reject", "abstain"]), rationale: z.string().optional(), recordedAt: z.string().datetime({ offset: true }) }).strict()).min(1).optional(),
|
|
227
218
|
decidedAt: z.string().datetime({ offset: true })
|
|
228
|
-
}).strict()
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
219
|
+
}).strict(), [
|
|
220
|
+
{ field: "decisionMethod", in: ["approval", "vote"], alternatives: [["positions"]], path: ["positions"], message: "Approval and vote decisions require signed positions." },
|
|
221
|
+
{
|
|
222
|
+
field: "decisionClass",
|
|
223
|
+
equals: "work-review",
|
|
224
|
+
allowed: { field: "disposition", values: ["approved", "request-changes"] },
|
|
225
|
+
path: ["disposition"],
|
|
226
|
+
message: "Work review must approve or request changes."
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
field: "decisionClass",
|
|
230
|
+
equals: "proposal",
|
|
231
|
+
allowed: { field: "disposition", values: ["approved", "rejected", "deferred", "superseded"] },
|
|
232
|
+
path: ["disposition"],
|
|
233
|
+
message: "Only work review may request changes."
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
field: "decisionClass",
|
|
237
|
+
equals: "publication",
|
|
238
|
+
allowed: { field: "disposition", values: ["approved", "rejected", "deferred", "superseded"] },
|
|
239
|
+
path: ["disposition"],
|
|
240
|
+
message: "Only work review may request changes."
|
|
241
|
+
}
|
|
242
|
+
]),
|
|
233
243
|
book: z.object({
|
|
234
244
|
schemaVersion: z.literal(BOOK_SCHEMA_VERSION),
|
|
235
245
|
id: identifier,
|
|
@@ -393,7 +403,7 @@ function fieldContract(schema) {
|
|
|
393
403
|
let required = true;
|
|
394
404
|
while (current instanceof z.ZodOptional || current instanceof z.ZodNullable || current instanceof z.ZodDefault || current instanceof z.ZodEffects) {
|
|
395
405
|
if (current instanceof z.ZodOptional || current instanceof z.ZodDefault) required = false;
|
|
396
|
-
current = current instanceof z.ZodEffects ? current.innerType() : current.removeDefault
|
|
406
|
+
current = current instanceof z.ZodEffects ? current.innerType() : current instanceof z.ZodDefault ? current.removeDefault() : current.unwrap();
|
|
397
407
|
}
|
|
398
408
|
const contract = { required };
|
|
399
409
|
if (current instanceof z.ZodEnum) return { ...contract, type: "string", values: current.options };
|