@treeseed/sdk 0.13.0-rc.64 → 0.13.0-rc.66

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.
Files changed (34) hide show
  1. package/dist/.treeseed-build-complete.json +1 -1
  2. package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +304 -0
  3. package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.js +44 -0
  4. package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +9 -0
  5. package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.d.ts +25 -0
  6. package/dist/agent-capacity/contracts/capacity/assignments/context-pack-compiler.js +67 -0
  7. package/dist/agent-capacity/validation/agent-definition-schema.d.ts +36 -36
  8. package/dist/agent-capacity/validation/agent-definition-schema.js +2 -0
  9. package/dist/capacity/agents/agent-capacity.d.ts +2 -0
  10. package/dist/capacity/agents/agent-capacity.js +2 -0
  11. package/dist/capacity-provider/capability-ontology.d.ts +296 -7
  12. package/dist/capacity-provider/capability-ontology.js +23 -1
  13. package/dist/content/validation/agent-operational-content-schemas.d.ts +338 -16
  14. package/dist/content/validation/agent-operational-content-schemas.js +18 -3
  15. package/dist/content/validation/content-model-schemas.d.ts +428 -89
  16. package/dist/content/validation/portable-content-data.d.ts +26 -9
  17. package/dist/deployment/schemas.d.ts +352 -0
  18. package/dist/deployment/schemas.js +30 -0
  19. package/dist/entrypoints/clients/control-plane-client.js +5 -3
  20. package/dist/graph/context-query-contracts.d.ts +16 -1
  21. package/dist/graph/context-query-contracts.js +5 -0
  22. package/dist/model-registry/agent-operational-models.js +1 -1
  23. package/dist/operator-contracts/canonical-command-tree.js +16 -1
  24. package/dist/operator-contracts/catalog/communication-operations.d.ts +4 -4
  25. package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +127 -0
  26. package/dist/operator-contracts/catalog/knowledge-share-operations.js +25 -0
  27. package/dist/operator-contracts/communication/contracts.d.ts +12 -12
  28. package/dist/operator-contracts/control-plane-operations.d.ts +129 -4
  29. package/dist/operator-contracts/control-plane-operations.js +2 -0
  30. package/dist/operator-contracts/index.d.ts +1 -0
  31. package/dist/operator-contracts/index.js +1 -0
  32. package/dist/operator-contracts/knowledge/contracts.d.ts +130 -0
  33. package/dist/operator-contracts/knowledge/contracts.js +39 -0
  34. package/package.json +1 -1
@@ -1 +1 @@
1
- {"completedAt":"2026-08-31T12:10:08.221Z"}
1
+ {"completedAt":"2026-09-01T00:39:39.233Z"}
@@ -0,0 +1,304 @@
1
+ import { z } from 'zod';
2
+ export declare const contextSourceSelectorSchema: z.ZodDiscriminatedUnion<"scope", [z.ZodObject<{
3
+ scope: z.ZodLiteral<"current-project">;
4
+ }, "strict", z.ZodTypeAny, {
5
+ scope: "current-project";
6
+ }, {
7
+ scope: "current-project";
8
+ }>, z.ZodObject<{
9
+ scope: z.ZodLiteral<"team-library">;
10
+ }, "strict", z.ZodTypeAny, {
11
+ scope: "team-library";
12
+ }, {
13
+ scope: "team-library";
14
+ }>, z.ZodObject<{
15
+ scope: z.ZodLiteral<"same-team">;
16
+ projectIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
17
+ projectSlugs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
18
+ }, "strict", z.ZodTypeAny, {
19
+ scope: "same-team";
20
+ projectIds: string[];
21
+ projectSlugs: string[];
22
+ }, {
23
+ scope: "same-team";
24
+ projectIds?: string[] | undefined;
25
+ projectSlugs?: string[] | undefined;
26
+ }>, z.ZodObject<{
27
+ scope: z.ZodLiteral<"shared-team">;
28
+ teamId: z.ZodString;
29
+ projectIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
30
+ }, "strict", z.ZodTypeAny, {
31
+ teamId: string;
32
+ scope: "shared-team";
33
+ projectIds: string[];
34
+ }, {
35
+ teamId: string;
36
+ scope: "shared-team";
37
+ projectIds?: string[] | undefined;
38
+ }>]>;
39
+ export declare const assignmentContextSourceSchema: z.ZodObject<{
40
+ id: z.ZodString;
41
+ layer: z.ZodEnum<["core", "agent", "activity", "live", "tool"]>;
42
+ kind: z.ZodString;
43
+ teamId: z.ZodString;
44
+ projectId: z.ZodString;
45
+ path: z.ZodNullable<z.ZodString>;
46
+ digest: z.ZodString;
47
+ disposition: z.ZodEnum<["included", "summarized", "omitted", "failed"]>;
48
+ required: z.ZodBoolean;
49
+ measurement: z.ZodObject<{
50
+ unit: z.ZodEnum<["tokens", "bytes", "items"]>;
51
+ amount: z.ZodNumber;
52
+ provenance: z.ZodString;
53
+ }, "strict", z.ZodTypeAny, {
54
+ provenance: string;
55
+ amount: number;
56
+ unit: "items" | "tokens" | "bytes";
57
+ }, {
58
+ provenance: string;
59
+ amount: number;
60
+ unit: "items" | "tokens" | "bytes";
61
+ }>;
62
+ reason: z.ZodNullable<z.ZodString>;
63
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
64
+ }, "strict", z.ZodTypeAny, {
65
+ path: string | null;
66
+ id: string;
67
+ digest: string;
68
+ required: boolean;
69
+ projectId: string;
70
+ teamId: string;
71
+ kind: string;
72
+ reason: string | null;
73
+ metadata: Record<string, unknown>;
74
+ measurement: {
75
+ provenance: string;
76
+ amount: number;
77
+ unit: "items" | "tokens" | "bytes";
78
+ };
79
+ layer: "live" | "tool" | "agent" | "core" | "activity";
80
+ disposition: "failed" | "included" | "summarized" | "omitted";
81
+ }, {
82
+ path: string | null;
83
+ id: string;
84
+ digest: string;
85
+ required: boolean;
86
+ projectId: string;
87
+ teamId: string;
88
+ kind: string;
89
+ reason: string | null;
90
+ measurement: {
91
+ provenance: string;
92
+ amount: number;
93
+ unit: "items" | "tokens" | "bytes";
94
+ };
95
+ layer: "live" | "tool" | "agent" | "core" | "activity";
96
+ disposition: "failed" | "included" | "summarized" | "omitted";
97
+ metadata?: Record<string, unknown> | undefined;
98
+ }>;
99
+ export declare const assignmentContextPackSchema: z.ZodObject<{
100
+ schemaVersion: z.ZodLiteral<"treeseed.assignment-context-pack/v1">;
101
+ assignmentId: z.ZodString;
102
+ capacity: z.ZodObject<{
103
+ mode: z.ZodEnum<["bounded", "unbounded"]>;
104
+ measurement: z.ZodNullable<z.ZodEnum<["tokens", "bytes", "items"]>>;
105
+ defaultInitial: z.ZodNullable<z.ZodNumber>;
106
+ maximum: z.ZodNullable<z.ZodNumber>;
107
+ reservedOutput: z.ZodNullable<z.ZodNumber>;
108
+ transportPayloadBytes: z.ZodNumber;
109
+ measurementProvenance: z.ZodObject<{
110
+ provider: z.ZodString;
111
+ implementation: z.ZodString;
112
+ version: z.ZodNullable<z.ZodString>;
113
+ }, "strict", z.ZodTypeAny, {
114
+ version: string | null;
115
+ provider: string;
116
+ implementation: string;
117
+ }, {
118
+ version: string | null;
119
+ provider: string;
120
+ implementation: string;
121
+ }>;
122
+ }, "strict", z.ZodTypeAny, {
123
+ maximum: number | null;
124
+ mode: "bounded" | "unbounded";
125
+ measurement: "items" | "tokens" | "bytes" | null;
126
+ defaultInitial: number | null;
127
+ reservedOutput: number | null;
128
+ transportPayloadBytes: number;
129
+ measurementProvenance: {
130
+ version: string | null;
131
+ provider: string;
132
+ implementation: string;
133
+ };
134
+ }, {
135
+ maximum: number | null;
136
+ mode: "bounded" | "unbounded";
137
+ measurement: "items" | "tokens" | "bytes" | null;
138
+ defaultInitial: number | null;
139
+ reservedOutput: number | null;
140
+ transportPayloadBytes: number;
141
+ measurementProvenance: {
142
+ version: string | null;
143
+ provider: string;
144
+ implementation: string;
145
+ };
146
+ }>;
147
+ totals: z.ZodObject<{
148
+ tokens: z.ZodNumber;
149
+ bytes: z.ZodNumber;
150
+ items: z.ZodNumber;
151
+ }, "strict", z.ZodTypeAny, {
152
+ items: number;
153
+ tokens: number;
154
+ bytes: number;
155
+ }, {
156
+ items: number;
157
+ tokens: number;
158
+ bytes: number;
159
+ }>;
160
+ sources: z.ZodArray<z.ZodObject<{
161
+ id: z.ZodString;
162
+ layer: z.ZodEnum<["core", "agent", "activity", "live", "tool"]>;
163
+ kind: z.ZodString;
164
+ teamId: z.ZodString;
165
+ projectId: z.ZodString;
166
+ path: z.ZodNullable<z.ZodString>;
167
+ digest: z.ZodString;
168
+ disposition: z.ZodEnum<["included", "summarized", "omitted", "failed"]>;
169
+ required: z.ZodBoolean;
170
+ measurement: z.ZodObject<{
171
+ unit: z.ZodEnum<["tokens", "bytes", "items"]>;
172
+ amount: z.ZodNumber;
173
+ provenance: z.ZodString;
174
+ }, "strict", z.ZodTypeAny, {
175
+ provenance: string;
176
+ amount: number;
177
+ unit: "items" | "tokens" | "bytes";
178
+ }, {
179
+ provenance: string;
180
+ amount: number;
181
+ unit: "items" | "tokens" | "bytes";
182
+ }>;
183
+ reason: z.ZodNullable<z.ZodString>;
184
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
185
+ }, "strict", z.ZodTypeAny, {
186
+ path: string | null;
187
+ id: string;
188
+ digest: string;
189
+ required: boolean;
190
+ projectId: string;
191
+ teamId: string;
192
+ kind: string;
193
+ reason: string | null;
194
+ metadata: Record<string, unknown>;
195
+ measurement: {
196
+ provenance: string;
197
+ amount: number;
198
+ unit: "items" | "tokens" | "bytes";
199
+ };
200
+ layer: "live" | "tool" | "agent" | "core" | "activity";
201
+ disposition: "failed" | "included" | "summarized" | "omitted";
202
+ }, {
203
+ path: string | null;
204
+ id: string;
205
+ digest: string;
206
+ required: boolean;
207
+ projectId: string;
208
+ teamId: string;
209
+ kind: string;
210
+ reason: string | null;
211
+ measurement: {
212
+ provenance: string;
213
+ amount: number;
214
+ unit: "items" | "tokens" | "bytes";
215
+ };
216
+ layer: "live" | "tool" | "agent" | "core" | "activity";
217
+ disposition: "failed" | "included" | "summarized" | "omitted";
218
+ metadata?: Record<string, unknown> | undefined;
219
+ }>, "many">;
220
+ digest: z.ZodString;
221
+ }, "strict", z.ZodTypeAny, {
222
+ schemaVersion: "treeseed.assignment-context-pack/v1";
223
+ sources: {
224
+ path: string | null;
225
+ id: string;
226
+ digest: string;
227
+ required: boolean;
228
+ projectId: string;
229
+ teamId: string;
230
+ kind: string;
231
+ reason: string | null;
232
+ metadata: Record<string, unknown>;
233
+ measurement: {
234
+ provenance: string;
235
+ amount: number;
236
+ unit: "items" | "tokens" | "bytes";
237
+ };
238
+ layer: "live" | "tool" | "agent" | "core" | "activity";
239
+ disposition: "failed" | "included" | "summarized" | "omitted";
240
+ }[];
241
+ digest: string;
242
+ assignmentId: string;
243
+ capacity: {
244
+ maximum: number | null;
245
+ mode: "bounded" | "unbounded";
246
+ measurement: "items" | "tokens" | "bytes" | null;
247
+ defaultInitial: number | null;
248
+ reservedOutput: number | null;
249
+ transportPayloadBytes: number;
250
+ measurementProvenance: {
251
+ version: string | null;
252
+ provider: string;
253
+ implementation: string;
254
+ };
255
+ };
256
+ totals: {
257
+ items: number;
258
+ tokens: number;
259
+ bytes: number;
260
+ };
261
+ }, {
262
+ schemaVersion: "treeseed.assignment-context-pack/v1";
263
+ sources: {
264
+ path: string | null;
265
+ id: string;
266
+ digest: string;
267
+ required: boolean;
268
+ projectId: string;
269
+ teamId: string;
270
+ kind: string;
271
+ reason: string | null;
272
+ measurement: {
273
+ provenance: string;
274
+ amount: number;
275
+ unit: "items" | "tokens" | "bytes";
276
+ };
277
+ layer: "live" | "tool" | "agent" | "core" | "activity";
278
+ disposition: "failed" | "included" | "summarized" | "omitted";
279
+ metadata?: Record<string, unknown> | undefined;
280
+ }[];
281
+ digest: string;
282
+ assignmentId: string;
283
+ capacity: {
284
+ maximum: number | null;
285
+ mode: "bounded" | "unbounded";
286
+ measurement: "items" | "tokens" | "bytes" | null;
287
+ defaultInitial: number | null;
288
+ reservedOutput: number | null;
289
+ transportPayloadBytes: number;
290
+ measurementProvenance: {
291
+ version: string | null;
292
+ provider: string;
293
+ implementation: string;
294
+ };
295
+ };
296
+ totals: {
297
+ items: number;
298
+ tokens: number;
299
+ bytes: number;
300
+ };
301
+ }>;
302
+ export type ContextSourceSelector = z.infer<typeof contextSourceSelectorSchema>;
303
+ export type AssignmentContextSource = z.infer<typeof assignmentContextSourceSchema>;
304
+ export type AssignmentContextPack = z.infer<typeof assignmentContextPackSchema>;
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ const nonEmpty = z.string().trim().min(1);
3
+ const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
4
+ const contextSourceSelectorSchema = z.discriminatedUnion("scope", [
5
+ z.object({ scope: z.literal("current-project") }).strict(),
6
+ z.object({ scope: z.literal("team-library") }).strict(),
7
+ z.object({ scope: z.literal("same-team"), projectIds: z.array(nonEmpty).default([]), projectSlugs: z.array(nonEmpty).default([]) }).strict(),
8
+ z.object({ scope: z.literal("shared-team"), teamId: nonEmpty, projectIds: z.array(nonEmpty).default([]) }).strict()
9
+ ]);
10
+ const assignmentContextSourceSchema = z.object({
11
+ id: nonEmpty,
12
+ layer: z.enum(["core", "agent", "activity", "live", "tool"]),
13
+ kind: nonEmpty,
14
+ teamId: nonEmpty,
15
+ projectId: nonEmpty,
16
+ path: nonEmpty.nullable(),
17
+ digest,
18
+ disposition: z.enum(["included", "summarized", "omitted", "failed"]),
19
+ required: z.boolean(),
20
+ measurement: z.object({ unit: z.enum(["tokens", "bytes", "items"]), amount: z.number().int().nonnegative(), provenance: nonEmpty }).strict(),
21
+ reason: z.string().nullable(),
22
+ metadata: z.record(z.unknown()).default({})
23
+ }).strict();
24
+ const assignmentContextPackSchema = z.object({
25
+ schemaVersion: z.literal("treeseed.assignment-context-pack/v1"),
26
+ assignmentId: nonEmpty,
27
+ capacity: z.object({
28
+ mode: z.enum(["bounded", "unbounded"]),
29
+ measurement: z.enum(["tokens", "bytes", "items"]).nullable(),
30
+ defaultInitial: z.number().int().positive().nullable(),
31
+ maximum: z.number().int().positive().nullable(),
32
+ reservedOutput: z.number().int().nonnegative().nullable(),
33
+ transportPayloadBytes: z.number().int().positive(),
34
+ measurementProvenance: z.object({ provider: nonEmpty, implementation: nonEmpty, version: z.string().nullable() }).strict()
35
+ }).strict(),
36
+ totals: z.object({ tokens: z.number().int().nonnegative(), bytes: z.number().int().nonnegative(), items: z.number().int().nonnegative() }).strict(),
37
+ sources: z.array(assignmentContextSourceSchema),
38
+ digest
39
+ }).strict();
40
+ export {
41
+ assignmentContextPackSchema,
42
+ assignmentContextSourceSchema,
43
+ contextSourceSelectorSchema
44
+ };
@@ -75,6 +75,15 @@ export interface TreeDxProxyHandle {
75
75
  allowedPaths?: string[];
76
76
  allowedReadPaths?: string[];
77
77
  allowedWritePaths?: string[];
78
+ readRepositories?: Array<{
79
+ projectId: string;
80
+ projectSlug: string;
81
+ repositoryId: string;
82
+ baseRef: string;
83
+ allowedPaths: string[];
84
+ allowedModels: string[];
85
+ source: 'team-library' | 'same-team' | 'shared-team';
86
+ }>;
78
87
  metadata?: Record<string, unknown>;
79
88
  }
80
89
  export interface ProviderAssignmentCapabilityHandleBase {
@@ -0,0 +1,25 @@
1
+ import type { ProviderContextCapacity } from '../../../../capacity-provider/capability-ontology.js';
2
+ import type { AssignmentContextPack, AssignmentContextSource } from './assignment-context-pack.js';
3
+ export interface ContextPackCandidate {
4
+ source: Omit<AssignmentContextSource, 'disposition' | 'measurement' | 'reason'>;
5
+ measurement: {
6
+ unit: 'tokens' | 'bytes' | 'items';
7
+ amount: number;
8
+ provenance: string;
9
+ };
10
+ priority: number;
11
+ mandatory?: boolean;
12
+ minimumBudget?: number;
13
+ maximumBudget?: number;
14
+ summaryMeasurement?: {
15
+ unit: 'tokens' | 'bytes' | 'items';
16
+ amount: number;
17
+ provenance: string;
18
+ };
19
+ omissionReason?: string;
20
+ }
21
+ export declare function compileAssignmentContextPack(input: {
22
+ assignmentId: string;
23
+ capacity: ProviderContextCapacity;
24
+ candidates: ContextPackCandidate[];
25
+ }): AssignmentContextPack;
@@ -0,0 +1,67 @@
1
+ import { createHash } from "node:crypto";
2
+ const canonical = (value) => value === null || typeof value !== "object" ? JSON.stringify(value) : Array.isArray(value) ? `[${value.map(canonical).join(",")}]` : `{${Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(",")}}`;
3
+ function compileAssignmentContextPack(input) {
4
+ const capacityUnit = input.capacity.mode === "bounded" ? input.capacity.measurement : null;
5
+ const budgetUnit = input.capacity.mode === "bounded" ? input.capacity.measurement : "bytes";
6
+ const ordered = [...input.candidates].sort((left, right) => Number(Boolean(right.mandatory)) - Number(Boolean(left.mandatory)) || Number(right.source.required) - Number(left.source.required) || right.priority - left.priority || left.source.id.localeCompare(right.source.id));
7
+ const mandatoryAmount = ordered.filter((candidate) => candidate.mandatory && !candidate.omissionReason).reduce((sum, candidate) => {
8
+ if (candidate.measurement.unit !== budgetUnit) throw new Error(`Context source ${candidate.source.id} uses ${candidate.measurement.unit}, but the offer budgets ${budgetUnit}.`);
9
+ return sum + candidate.measurement.amount;
10
+ }, 0);
11
+ const requiredFloor = ordered.filter((candidate) => candidate.source.required && !candidate.omissionReason).reduce((sum, candidate) => {
12
+ if (candidate.measurement.unit !== budgetUnit) throw new Error(`Context source ${candidate.source.id} uses ${candidate.measurement.unit}, but the offer budgets ${budgetUnit}.`);
13
+ if (candidate.mandatory) return sum + candidate.measurement.amount;
14
+ const summarized = candidate.summaryMeasurement?.unit === budgetUnit && candidate.summaryMeasurement.amount >= (candidate.minimumBudget ?? 0) ? candidate.summaryMeasurement.amount : candidate.measurement.amount;
15
+ return sum + summarized;
16
+ }, 0);
17
+ const maximumInput = input.capacity.mode === "bounded" ? input.capacity.maximum - input.capacity.reservedOutput : input.capacity.transportPayloadBytes;
18
+ if (input.capacity.mode === "bounded" && mandatoryAmount > maximumInput) throw new Error("Mandatory context exceeds the selected provider offer maximum input capacity.");
19
+ if (input.capacity.mode === "bounded" && requiredFloor > maximumInput) throw new Error("Required context exceeds the selected provider offer maximum input capacity.");
20
+ const limit = input.capacity.mode === "bounded" ? Math.min(maximumInput, Math.max(input.capacity.defaultInitial, mandatoryAmount, requiredFloor)) : input.capacity.transportPayloadBytes;
21
+ const sources = [];
22
+ let consumed = 0;
23
+ for (const candidate of ordered) {
24
+ if (candidate.omissionReason) {
25
+ sources.push({ ...candidate.source, disposition: "omitted", measurement: { ...candidate.measurement, amount: 0 }, reason: candidate.omissionReason });
26
+ continue;
27
+ }
28
+ const compatible = candidate.measurement.unit === budgetUnit;
29
+ if (!compatible) throw new Error(`Context source ${candidate.source.id} uses ${candidate.measurement.unit}, but the offer budgets ${budgetUnit}.`);
30
+ if (candidate.maximumBudget !== void 0 && candidate.minimumBudget !== void 0 && candidate.minimumBudget > candidate.maximumBudget) throw new Error(`Context source ${candidate.source.id} has an invalid minimum/maximum budget.`);
31
+ if (candidate.minimumBudget !== void 0 && candidate.measurement.amount < candidate.minimumBudget && candidate.source.required) throw new Error(`Required context source ${candidate.source.id} cannot satisfy its minimum budget.`);
32
+ if (candidate.mandatory && consumed + candidate.measurement.amount > limit) throw new Error(`Mandatory context exceeds the selected provider offer default: ${candidate.source.id}.`);
33
+ if (consumed + candidate.measurement.amount <= limit && (candidate.maximumBudget === void 0 || candidate.measurement.amount <= candidate.maximumBudget)) {
34
+ sources.push({ ...candidate.source, disposition: "included", measurement: candidate.measurement, reason: null });
35
+ consumed += candidate.measurement.amount;
36
+ continue;
37
+ }
38
+ if (!candidate.mandatory && candidate.summaryMeasurement && consumed + candidate.summaryMeasurement.amount <= limit && (candidate.maximumBudget === void 0 || candidate.summaryMeasurement.amount <= candidate.maximumBudget) && (candidate.minimumBudget === void 0 || candidate.summaryMeasurement.amount >= candidate.minimumBudget)) {
39
+ sources.push({ ...candidate.source, disposition: "summarized", measurement: candidate.summaryMeasurement, reason: "provider_context_default" });
40
+ consumed += candidate.summaryMeasurement.amount;
41
+ continue;
42
+ }
43
+ if (candidate.source.required) throw new Error(`Mandatory context exceeds the selected provider offer default: ${candidate.source.id}.`);
44
+ sources.push({ ...candidate.source, disposition: "omitted", measurement: { ...candidate.measurement, amount: 0 }, reason: "provider_context_default" });
45
+ }
46
+ const totals = { tokens: 0, bytes: 0, items: 0 };
47
+ for (const source of sources) totals[source.measurement.unit] += source.measurement.amount;
48
+ const material = {
49
+ schemaVersion: "treeseed.assignment-context-pack/v1",
50
+ assignmentId: input.assignmentId,
51
+ capacity: {
52
+ mode: input.capacity.mode,
53
+ measurement: capacityUnit,
54
+ defaultInitial: input.capacity.mode === "bounded" ? input.capacity.defaultInitial : null,
55
+ maximum: input.capacity.mode === "bounded" ? input.capacity.maximum : null,
56
+ reservedOutput: input.capacity.mode === "bounded" ? input.capacity.reservedOutput : null,
57
+ transportPayloadBytes: input.capacity.transportPayloadBytes,
58
+ measurementProvenance: input.capacity.measurementProvenance
59
+ },
60
+ totals,
61
+ sources
62
+ };
63
+ return { ...material, digest: `sha256:${createHash("sha256").update(canonical(material)).digest("hex")}` };
64
+ }
65
+ export {
66
+ compileAssignmentContextPack
67
+ };