@treeseed/sdk 0.13.0-rc.121 → 0.13.0-rc.123
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 +2365 -1275
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +94 -28
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +38 -38
- 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 +2 -59
- 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 +2 -4
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +22 -16
- 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 +244 -85
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +54 -19
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +216 -70
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/configuration/configuration.d.ts +1 -1
- package/dist/agent-capacity/contracts/configuration/configuration.js +0 -2
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +55 -55
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -23
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +2 -154
- package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +0 -13
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +496 -292
- package/dist/agent-capacity/contracts/support/execution-graph.js +21 -19
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +3 -6
- package/dist/agent-capacity/contracts/support/planning-records.d.ts +1 -87
- package/dist/agent-capacity/grant.d.ts +34 -0
- package/dist/agent-capacity/grant.js +4 -0
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +1178 -1152
- package/dist/agent-capacity/validation/agent-definition-schema.js +21 -28
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +10 -10
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +0 -1
- package/dist/agent-capacity/validation/assignment-records.d.ts +1 -6
- package/dist/agent-capacity/validation/assignment-records.js +49 -35
- package/dist/agent-capacity/validation/configuration.d.ts +1 -1
- package/dist/agent-capacity/validation/configuration.js +2 -6
- package/dist/agent-capacity/validation/grant.d.ts +11 -0
- package/dist/agent-capacity/validation/grant.js +31 -0
- package/dist/capacity/agents/agent-capacity.d.ts +3 -4
- package/dist/capacity/agents/agent-capacity.js +2 -3
- package/dist/capacity-provider/capability-ontology.d.ts +150 -150
- package/dist/capacity-provider/client.d.ts +15 -9
- package/dist/capacity-provider/client.js +1 -10
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +0 -1
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +44 -44
- 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 +188 -188
- package/dist/capacity-provider/environment-catalog.js +1 -1
- package/dist/capacity-provider/install-configuration.d.ts +2 -2
- package/dist/capacity-provider/sandbox-contracts.d.ts +92 -92
- package/dist/capacity-provider/source-workspace.d.ts +166 -68
- package/dist/capacity-provider/source-workspace.js +5 -1
- 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 +144 -142
- package/dist/content/validation/agent-operational-content-schemas.js +2 -0
- package/dist/content/validation/auxiliary-content-schemas.d.ts +158 -158
- package/dist/content/validation/content-model-schemas.d.ts +9105 -5295
- package/dist/content/validation/content-model-schemas.js +192 -115
- package/dist/content/validation/portable-content-data.d.ts +411 -238
- package/dist/content/validation/portable-content-data.js +6 -1
- 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 +24 -24
- package/dist/deployment/ai-hosting.d.ts +18 -18
- package/dist/deployment/ai-instance.d.ts +16 -16
- package/dist/deployment/ai-mode.d.ts +92 -92
- package/dist/deployment/hosted-topology-template.d.ts +44 -44
- package/dist/deployment/hosted-topology.d.ts +335 -335
- package/dist/deployment/postgres/contracts.d.ts +52 -52
- package/dist/deployment/postgres/transfer.d.ts +6 -6
- package/dist/deployment/schemas.d.ts +1114 -1114
- package/dist/development/schemas.d.ts +633 -633
- 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/knowledge/contracts.d.ts +9 -2
- package/dist/knowledge/contracts.js +2 -2
- package/dist/model-registry/discussion-models.js +0 -1
- package/dist/operator-contracts/canonical-command-tree.js +25 -9
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +29 -29
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +30 -30
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +15 -13
- package/dist/operator-contracts/catalog/communication-operations.d.ts +176 -158
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +67 -67
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +65 -65
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +6 -6
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +2 -1
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +10 -10
- 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 +3 -0
- package/dist/operator-contracts/communication/contracts.d.ts +537 -395
- 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 +631 -610
- package/dist/operator-contracts/control-plane-operations.js +26 -12
- package/dist/operator-contracts/inbox/contracts.d.ts +229 -229
- package/dist/operator-contracts/knowledge/contracts.d.ts +16 -16
- package/dist/operator-contracts/mcp.js +4 -3
- package/dist/operator-contracts/workday-lifecycle.d.ts +192 -0
- package/dist/operator-contracts/workday-lifecycle.js +109 -45
- package/dist/platform/agent-schema-verification.d.ts +3 -0
- package/dist/platform/agent-schema-verification.js +377 -0
- 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 +10 -0
- package/dist/sdk-types/support/planning-policy.d.ts +1 -1
- 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 +3 -3
- package/dist/secrets-capability/shared-resources.d.ts +50 -50
- package/dist/secrets-capability/vault-contracts.d.ts +2 -2
- package/dist/security/encrypted-envelope.d.ts +14 -14
- 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/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 +9 -3
- 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
- package/dist/agent-capacity/allocation.d.ts +0 -183
- package/dist/agent-capacity/allocation.js +0 -5
- package/dist/agent-capacity/artifact-mutation-receipt.d.ts +0 -49
- package/dist/agent-capacity/artifact-mutation-receipt.js +0 -36
- package/dist/agent-capacity/artifacts.d.ts +0 -123
- package/dist/agent-capacity/artifacts.js +0 -39
- package/dist/agent-capacity/contracts/support/decision-work.d.ts +0 -227
- package/dist/agent-capacity/contracts/support/decision-work.js +0 -0
- package/dist/agent-capacity/validation/allocation.d.ts +0 -12
- package/dist/agent-capacity/validation/allocation.js +0 -115
|
@@ -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,10 +14,31 @@ 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());
|
|
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
|
+
const identifiers = z.array(identifier);
|
|
16
20
|
const date = z.coerce.date();
|
|
17
21
|
const lifecycleStatus = z.enum(["live", "in progress", "exploratory", "planned", "speculative"]);
|
|
18
|
-
const contributor = nonEmpty;
|
|
19
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
|
+
));
|
|
32
|
+
const exactDependencyLinkSchema = z.object({
|
|
33
|
+
relation: z.literal("depends_on"),
|
|
34
|
+
from: exactWorkItemReferenceSchema,
|
|
35
|
+
to: exactWorkItemReferenceSchema
|
|
36
|
+
}).strict().superRefine((link, context) => {
|
|
37
|
+
if (JSON.stringify(link.from) === JSON.stringify(link.to)) context.addIssue({
|
|
38
|
+
code: z.ZodIssueCode.custom,
|
|
39
|
+
message: "A work item cannot depend on itself."
|
|
40
|
+
});
|
|
41
|
+
});
|
|
20
42
|
const linked = {
|
|
21
43
|
group_ids: strings.optional(),
|
|
22
44
|
related_objectives: strings.optional(),
|
|
@@ -54,29 +76,28 @@ const proposalLinks = {
|
|
|
54
76
|
decision_dependencies: z.array(z.object({ projectId: nonEmpty, decisionId: nonEmpty }).strict()).optional(),
|
|
55
77
|
...linked
|
|
56
78
|
};
|
|
57
|
-
const executionPlanWorkItemSchema = z.object({
|
|
58
|
-
id:
|
|
79
|
+
const executionPlanWorkItemSchema = conditionalFields(z.object({
|
|
80
|
+
id: slug,
|
|
81
|
+
priority: z.number().int().safe().optional(),
|
|
59
82
|
activity: z.literal("acting"),
|
|
60
|
-
agentClass
|
|
83
|
+
agentClass,
|
|
61
84
|
workspace: z.enum(["read-only", "treedx", "git"]),
|
|
62
85
|
review: z.enum(["required", "none"]),
|
|
63
86
|
objective: nonEmpty,
|
|
64
87
|
estimate: estimateSchema.optional(),
|
|
65
88
|
reviewEstimate: estimateSchema.optional(),
|
|
66
89
|
maximumReviewCycles: z.number().int().positive().optional(),
|
|
67
|
-
dependsOn: z.array(
|
|
68
|
-
requestedPermissions:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}).strict(),
|
|
72
|
-
requiredCapabilities: z.array(nonEmpty).min(1),
|
|
73
|
-
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(),
|
|
74
94
|
acceptanceCriteria: z.array(nonEmpty).min(1)
|
|
75
|
-
}).strict()
|
|
76
|
-
|
|
77
|
-
|
|
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) => {
|
|
78
99
|
if (value.workspace !== "read-only") {
|
|
79
|
-
const mutable = (value.contextRefs ?? []).filter((reference) => reference.store === value.workspace);
|
|
100
|
+
const mutable = (value.contextRefs ?? []).filter((reference) => reference.store === value.workspace && reference.model === "repository");
|
|
80
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.` });
|
|
81
102
|
}
|
|
82
103
|
});
|
|
@@ -100,38 +121,30 @@ const executionPlanSchema = z.object({ workItems: z.array(executionPlanWorkItemS
|
|
|
100
121
|
};
|
|
101
122
|
if ([...ids].some(cyclic)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["workItems"], message: "Work-item dependencies must be acyclic." });
|
|
102
123
|
});
|
|
103
|
-
const proposalSchema = z.object({
|
|
124
|
+
const proposalSchema = conditionalFields(z.object({
|
|
104
125
|
schemaVersion: z.literal("treeseed.proposal/v1"),
|
|
105
|
-
id:
|
|
106
|
-
projectId:
|
|
126
|
+
id: identifier,
|
|
127
|
+
projectId: identifier,
|
|
107
128
|
title: nonEmpty,
|
|
108
129
|
request: nonEmpty,
|
|
109
130
|
summary: nonEmpty.optional(),
|
|
110
131
|
status: z.enum(["draft", "discussing", "ready", "decided", "withdrawn"]),
|
|
111
|
-
objectiveRefs:
|
|
112
|
-
evidenceRefs:
|
|
132
|
+
objectiveRefs: unique(exactRefs).optional(),
|
|
133
|
+
evidenceRefs: unique(exactRefs).optional(),
|
|
113
134
|
discussionRef: exactEntityReferenceSchema.optional(),
|
|
114
135
|
executionPlan: executionPlanSchema.optional()
|
|
115
|
-
}).strict()
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
if (["ready", "decided"].includes(value.status) && !value.summary) {
|
|
129
|
-
context.addIssue({ code: z.ZodIssueCode.custom, path: ["summary"], message: "A ready proposal requires a summary." });
|
|
130
|
-
}
|
|
131
|
-
if (["ready", "decided"].includes(value.status) && !value.executionPlan) {
|
|
132
|
-
context.addIssue({ code: z.ZodIssueCode.custom, path: ["executionPlan"], message: "A ready proposal requires an execution plan." });
|
|
133
|
-
}
|
|
134
|
-
});
|
|
136
|
+
}).strict(), [{
|
|
137
|
+
field: "status",
|
|
138
|
+
in: ["ready", "decided"],
|
|
139
|
+
alternatives: [["summary", "executionPlan"]],
|
|
140
|
+
items: {
|
|
141
|
+
field: "executionPlan",
|
|
142
|
+
key: "workItems",
|
|
143
|
+
required: ["estimate"],
|
|
144
|
+
conditional: { field: "review", equals: "required", required: ["reviewEstimate"] }
|
|
145
|
+
},
|
|
146
|
+
message: "Ready proposals require a summary, an execution plan, and each required independent estimate."
|
|
147
|
+
}]);
|
|
135
148
|
const schemas = {
|
|
136
149
|
page: z.object({
|
|
137
150
|
title: nonEmpty,
|
|
@@ -144,88 +157,140 @@ const schemas = {
|
|
|
144
157
|
summary: nonEmpty.optional(),
|
|
145
158
|
updated_at: date.optional()
|
|
146
159
|
}),
|
|
147
|
-
note: z.object({
|
|
160
|
+
note: conditionalFields(z.object({
|
|
148
161
|
schemaVersion: z.literal("treeseed.note/v1"),
|
|
149
|
-
id:
|
|
150
|
-
projectId:
|
|
162
|
+
id: identifier,
|
|
163
|
+
projectId: identifier,
|
|
151
164
|
classification: z.enum(["general", "feedback", "research", "workday-report"]),
|
|
152
|
-
subjectRefs: exactRefs.min(1),
|
|
165
|
+
subjectRefs: unique(exactRefs.min(1)),
|
|
153
166
|
body: nonEmpty,
|
|
154
|
-
createdAt: z.string().datetime({ offset: true })
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
168
|
+
links: z.array(exactDependencyLinkSchema).optional()
|
|
169
|
+
}).strict(), [{
|
|
170
|
+
field: "classification",
|
|
171
|
+
equals: "workday-report",
|
|
172
|
+
contains: { field: "subjectRefs", properties: { store: "postgresql", model: "workday" } },
|
|
173
|
+
path: ["subjectRefs"],
|
|
174
|
+
message: "Workday reports must reference their exact workday."
|
|
175
|
+
}]),
|
|
176
|
+
question: conditionalFields(z.object({
|
|
161
177
|
schemaVersion: z.literal("treeseed.question/v1"),
|
|
162
|
-
id:
|
|
163
|
-
projectId:
|
|
178
|
+
id: identifier,
|
|
179
|
+
projectId: identifier,
|
|
164
180
|
subjectRef: exactEntityReferenceSchema,
|
|
165
181
|
question: nonEmpty,
|
|
166
182
|
status: z.enum(["open", "answered", "withdrawn"]),
|
|
167
|
-
addressedTo:
|
|
183
|
+
addressedTo: unique(z.array(agentClass)).optional(),
|
|
168
184
|
answer: nonEmpty.optional(),
|
|
169
|
-
answerRefs: exactRefs.optional(),
|
|
185
|
+
answerRefs: unique(exactRefs).optional(),
|
|
170
186
|
askedAt: z.string().datetime({ offset: true }),
|
|
171
187
|
answeredAt: z.string().datetime({ offset: true }).optional()
|
|
172
|
-
}).strict()
|
|
173
|
-
|
|
174
|
-
|
|
188
|
+
}).strict(), [{
|
|
189
|
+
field: "status",
|
|
190
|
+
equals: "answered",
|
|
191
|
+
alternatives: [["answer"], ["answerRefs"]],
|
|
192
|
+
message: "Answered questions require an answer or exact answer reference."
|
|
193
|
+
}]),
|
|
175
194
|
objective: z.object({
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
195
|
+
schemaVersion: z.literal("treeseed.objective/v1"),
|
|
196
|
+
id: identifier,
|
|
197
|
+
projectId: identifier,
|
|
198
|
+
title: nonEmpty,
|
|
199
|
+
outcome: nonEmpty,
|
|
200
|
+
status: z.enum(["active", "achieved", "abandoned"]),
|
|
201
|
+
evidenceRefs: unique(exactRefs).optional()
|
|
202
|
+
}).strict(),
|
|
182
203
|
proposal: proposalSchema,
|
|
183
|
-
decision: z.object({
|
|
204
|
+
decision: conditionalFields(z.object({
|
|
184
205
|
schemaVersion: z.literal("treeseed.decision/v1"),
|
|
185
|
-
id:
|
|
186
|
-
projectId:
|
|
206
|
+
id: identifier,
|
|
207
|
+
projectId: identifier,
|
|
187
208
|
decisionClass: z.enum(["proposal", "work-review", "publication"]),
|
|
188
209
|
decisionMethod: z.enum(["authority", "approval", "vote"]),
|
|
189
210
|
subjectRef: exactEntityReferenceSchema,
|
|
190
211
|
disposition: z.enum(["approved", "rejected", "request-changes", "deferred", "superseded"]),
|
|
191
212
|
rationale: nonEmpty,
|
|
192
|
-
findingRefs: exactRefs.optional(),
|
|
193
|
-
authorityRefs: exactRefs.min(1),
|
|
194
|
-
decidedByRefs: exactRefs.min(1),
|
|
213
|
+
findingRefs: unique(exactRefs).optional(),
|
|
214
|
+
authorityRefs: unique(exactRefs.min(1)),
|
|
215
|
+
decidedByRefs: unique(exactRefs.min(1)),
|
|
195
216
|
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(),
|
|
196
217
|
decidedAt: z.string().datetime({ offset: true })
|
|
197
|
-
}).strict()
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
218
|
+
}).strict(), [
|
|
219
|
+
{ field: "decisionMethod", in: ["approval", "vote"], alternatives: [["positions"]], path: ["positions"], message: "Approval and vote decisions require signed positions." },
|
|
220
|
+
{
|
|
221
|
+
field: "decisionClass",
|
|
222
|
+
equals: "work-review",
|
|
223
|
+
allowed: { field: "disposition", values: ["approved", "request-changes"] },
|
|
224
|
+
path: ["disposition"],
|
|
225
|
+
message: "Work review must approve or request changes."
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
field: "decisionClass",
|
|
229
|
+
equals: "proposal",
|
|
230
|
+
allowed: { field: "disposition", values: ["approved", "rejected", "deferred", "superseded"] },
|
|
231
|
+
path: ["disposition"],
|
|
232
|
+
message: "Only work review may request changes."
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
field: "decisionClass",
|
|
236
|
+
equals: "publication",
|
|
237
|
+
allowed: { field: "disposition", values: ["approved", "rejected", "deferred", "superseded"] },
|
|
238
|
+
path: ["disposition"],
|
|
239
|
+
message: "Only work review may request changes."
|
|
240
|
+
}
|
|
241
|
+
]),
|
|
202
242
|
book: z.object({
|
|
203
243
|
schemaVersion: z.literal(BOOK_SCHEMA_VERSION),
|
|
204
|
-
id:
|
|
244
|
+
id: identifier,
|
|
245
|
+
projectId: identifier,
|
|
246
|
+
revision: z.number().int().positive(),
|
|
205
247
|
order: z.number().int().nonnegative(),
|
|
206
|
-
slug
|
|
248
|
+
slug,
|
|
207
249
|
title: nonEmpty,
|
|
208
250
|
description: nonEmpty.optional(),
|
|
209
251
|
summary: nonEmpty,
|
|
210
252
|
status: z.enum(KNOWLEDGE_STATUSES),
|
|
211
253
|
visibility: z.enum(KNOWLEDGE_VISIBILITIES),
|
|
212
|
-
groupIds:
|
|
213
|
-
audience:
|
|
214
|
-
relatedBookIds:
|
|
215
|
-
|
|
254
|
+
groupIds: identifiers.optional(),
|
|
255
|
+
audience: z.array(nonEmpty).optional(),
|
|
256
|
+
relatedBookIds: identifiers.optional(),
|
|
257
|
+
packPolicy: z.enum(["allowed", "restricted", "disabled"]).optional(),
|
|
258
|
+
editorialCoreNoteId: identifier.optional(),
|
|
259
|
+
cover: z.object({ image: nonEmpty.optional(), alt: nonEmpty.optional() }).strict().optional()
|
|
260
|
+
}).strict(),
|
|
216
261
|
knowledge: z.object({
|
|
217
262
|
schemaVersion: z.literal(KNOWLEDGE_PAGE_SCHEMA_VERSION),
|
|
218
|
-
id:
|
|
219
|
-
|
|
220
|
-
|
|
263
|
+
id: identifier,
|
|
264
|
+
projectId: identifier,
|
|
265
|
+
bookRef: exactEntityReferenceSchema.refine((ref) => ref.store === "treedx" && ref.model === "book" && Boolean(ref.revision && ref.digest && ref.path), "Knowledge requires an exact Book path, revision, and digest."),
|
|
266
|
+
slug,
|
|
267
|
+
body: nonEmpty,
|
|
221
268
|
title: nonEmpty,
|
|
222
269
|
description: nonEmpty.optional(),
|
|
223
|
-
summary: nonEmpty,
|
|
270
|
+
summary: nonEmpty.optional(),
|
|
224
271
|
status: z.enum(KNOWLEDGE_STATUSES),
|
|
225
272
|
visibility: z.enum(KNOWLEDGE_VISIBILITIES),
|
|
226
273
|
order: z.number().int().nonnegative().optional(),
|
|
227
|
-
groupIds:
|
|
228
|
-
|
|
274
|
+
groupIds: identifiers.optional(),
|
|
275
|
+
parentId: identifier.optional(),
|
|
276
|
+
contributors: identifiers.optional(),
|
|
277
|
+
relatedBookIds: identifiers.optional(),
|
|
278
|
+
relatedKnowledgeIds: identifiers.optional(),
|
|
279
|
+
relatedNoteIds: identifiers.optional(),
|
|
280
|
+
relatedQuestionIds: identifiers.optional(),
|
|
281
|
+
relatedObjectiveIds: identifiers.optional(),
|
|
282
|
+
relatedProposalIds: identifiers.optional(),
|
|
283
|
+
relatedDecisionIds: identifiers.optional(),
|
|
284
|
+
guaranteeIds: identifiers.optional(),
|
|
285
|
+
audiences: z.object({ primary: z.array(nonEmpty).optional(), secondary: z.array(nonEmpty).optional(), excluded: z.array(nonEmpty).optional() }).strict().optional(),
|
|
286
|
+
relatedRefs: unique(exactRefs).optional(),
|
|
287
|
+
capabilityIds: identifiers.optional(),
|
|
288
|
+
routePatterns: z.array(nonEmpty).optional(),
|
|
289
|
+
resourceTypes: identifiers.optional(),
|
|
290
|
+
actionIds: identifiers.optional(),
|
|
291
|
+
keywords: z.array(nonEmpty).optional(),
|
|
292
|
+
documentationUrls: z.array(nonEmpty).optional()
|
|
293
|
+
}).strict(),
|
|
229
294
|
person: z.object({
|
|
230
295
|
name: nonEmpty,
|
|
231
296
|
description: nonEmpty.optional(),
|
|
@@ -239,36 +304,47 @@ const schemas = {
|
|
|
239
304
|
}),
|
|
240
305
|
agent: agentDefinitionSchema,
|
|
241
306
|
discussion: z.object({
|
|
307
|
+
schemaVersion: z.literal("treeseed.discussion/v1"),
|
|
308
|
+
id: identifier,
|
|
309
|
+
projectId: identifier,
|
|
310
|
+
subjectRef: exactEntityReferenceSchema,
|
|
311
|
+
status: z.enum(["open", "resolved", "closed"]),
|
|
312
|
+
participantClasses: unique(z.array(agentClass)),
|
|
242
313
|
title: nonEmpty,
|
|
314
|
+
teamId: identifier,
|
|
315
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
243
316
|
topic: nonEmpty.optional(),
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
legacy_status: z.enum(["open", "resolved"]).optional(),
|
|
252
|
-
created_at: date.optional(),
|
|
253
|
-
updated_at: date.optional()
|
|
254
|
-
}),
|
|
317
|
+
visibility: z.enum(KNOWLEDGE_VISIBILITIES).optional(),
|
|
318
|
+
participantIds: identifiers.optional(),
|
|
319
|
+
agentIds: identifiers.optional(),
|
|
320
|
+
groupIds: identifiers.optional(),
|
|
321
|
+
parentWorkdayId: identifier.optional(),
|
|
322
|
+
updatedAt: z.string().datetime({ offset: true }).optional()
|
|
323
|
+
}).strict(),
|
|
255
324
|
discussion_message: z.object({
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
325
|
+
schemaVersion: z.literal("treeseed.discussion-message/v1"),
|
|
326
|
+
id: identifier,
|
|
327
|
+
discussionRef: exactEntityReferenceSchema,
|
|
328
|
+
authorRef: exactEntityReferenceSchema,
|
|
329
|
+
body: nonEmpty,
|
|
330
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
331
|
+
replyToRef: exactEntityReferenceSchema.optional(),
|
|
332
|
+
title: nonEmpty.optional(),
|
|
333
|
+
discussionId: identifier.optional(),
|
|
334
|
+
authorId: identifier.optional(),
|
|
335
|
+
authorType: z.enum(["user", "agent", "system"]).optional(),
|
|
260
336
|
intent: z.enum(["discuss", "propose"]).optional(),
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}),
|
|
337
|
+
mentionedAgents: identifiers.optional(),
|
|
338
|
+
recipientIds: identifiers.optional(),
|
|
339
|
+
fileRefs: z.array(z.record(z.unknown())).optional(),
|
|
340
|
+
contextRefs: z.array(z.record(z.unknown())).optional(),
|
|
341
|
+
inboxIntent: z.enum(["comment", "answer", "reply"]).optional(),
|
|
342
|
+
sourceMessageRefs: unique(exactRefs).optional(),
|
|
343
|
+
authorAgentId: identifier.optional(),
|
|
344
|
+
handoffId: identifier.optional(),
|
|
345
|
+
parentWorkdayId: identifier.optional(),
|
|
346
|
+
resultingOperationId: identifier.optional()
|
|
347
|
+
}).strict(),
|
|
272
348
|
discussion_event: z.object({
|
|
273
349
|
title: nonEmpty,
|
|
274
350
|
discussion_id: nonEmpty.optional(),
|
|
@@ -326,7 +402,7 @@ function fieldContract(schema) {
|
|
|
326
402
|
let required = true;
|
|
327
403
|
while (current instanceof z.ZodOptional || current instanceof z.ZodNullable || current instanceof z.ZodDefault || current instanceof z.ZodEffects) {
|
|
328
404
|
if (current instanceof z.ZodOptional || current instanceof z.ZodDefault) required = false;
|
|
329
|
-
current = current instanceof z.ZodEffects ? current.innerType() : current.removeDefault
|
|
405
|
+
current = current instanceof z.ZodEffects ? current.innerType() : current instanceof z.ZodDefault ? current.removeDefault() : current.unwrap();
|
|
330
406
|
}
|
|
331
407
|
const contract = { required };
|
|
332
408
|
if (current instanceof z.ZodEnum) return { ...contract, type: "string", values: current.options };
|
|
@@ -393,6 +469,7 @@ export {
|
|
|
393
469
|
describeContentFrontmatterContract,
|
|
394
470
|
describeContentFrontmatterJsonSchema,
|
|
395
471
|
describeContentFrontmatterSchema,
|
|
472
|
+
exactDependencyLinkSchema,
|
|
396
473
|
isPortableContentModel,
|
|
397
474
|
templateProductContentSchema,
|
|
398
475
|
validateContentFrontmatter,
|