@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.
Files changed (126) hide show
  1. package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +1392 -974
  2. package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +72 -27
  3. package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +34 -34
  4. package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.d.ts +2 -0
  5. package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.js +13 -0
  6. package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +1 -0
  7. package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +126 -1
  8. package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +35 -1
  9. package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +1 -3
  10. package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +21 -15
  11. package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +3 -42
  12. package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +8 -8
  13. package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +227 -66
  14. package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +54 -19
  15. package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +214 -5
  16. package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
  17. package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +47 -47
  18. package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -0
  19. package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
  20. package/dist/agent-capacity/contracts/support/execution-graph.d.ts +434 -230
  21. package/dist/agent-capacity/contracts/support/execution-graph.js +20 -18
  22. package/dist/agent-capacity/contracts/support/financial-records.d.ts +2 -0
  23. package/dist/agent-capacity/validation/agent-definition-schema.d.ts +286 -254
  24. package/dist/agent-capacity/validation/agent-definition-schema.js +22 -28
  25. package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +1 -1
  26. package/dist/agent-capacity/validation/assignment-records.js +45 -0
  27. package/dist/capacity/agents/agent-capacity.d.ts +1 -0
  28. package/dist/capacity/agents/agent-capacity.js +1 -0
  29. package/dist/capacity-provider/capability-ontology.d.ts +102 -102
  30. package/dist/capacity-provider/client.d.ts +14 -7
  31. package/dist/capacity-provider/client.js +1 -4
  32. package/dist/capacity-provider/contracts/capacity-facts.d.ts +0 -1
  33. package/dist/capacity-provider/contracts/environment-profiles.d.ts +40 -40
  34. package/dist/capacity-provider/contracts/governance.d.ts +2 -17
  35. package/dist/capacity-provider/contracts/index.d.ts +2 -0
  36. package/dist/capacity-provider/contracts/index.js +2 -0
  37. package/dist/capacity-provider/core-capability-catalog.d.ts +7 -7
  38. package/dist/capacity-provider/environment-catalog.d.ts +22 -22
  39. package/dist/capacity-provider/environment-catalog.js +1 -1
  40. package/dist/capacity-provider/install-configuration.d.ts +4 -4
  41. package/dist/capacity-provider/sandbox-contracts.d.ts +54 -54
  42. package/dist/capacity-provider/source-workspace.d.ts +76 -76
  43. package/dist/capacity-provider/validation.d.ts +10 -2
  44. package/dist/capacity-provider/validation.js +52 -22
  45. package/dist/content/validation/agent-operational-content-schemas.d.ts +120 -118
  46. package/dist/content/validation/agent-operational-content-schemas.js +2 -0
  47. package/dist/content/validation/auxiliary-content-schemas.d.ts +92 -92
  48. package/dist/content/validation/content-model-schemas.d.ts +3155 -2512
  49. package/dist/content/validation/content-model-schemas.js +97 -87
  50. package/dist/content/validation/portable-content-data.d.ts +173 -168
  51. package/dist/content/validation/schema-constraints.d.ts +78 -0
  52. package/dist/content/validation/schema-constraints.js +149 -0
  53. package/dist/deployment/ai/storage.d.ts +20 -20
  54. package/dist/deployment/ai-hosting.d.ts +12 -12
  55. package/dist/deployment/ai-instance.d.ts +12 -12
  56. package/dist/deployment/ai-mode.d.ts +34 -34
  57. package/dist/deployment/hosted-topology-template.d.ts +25 -25
  58. package/dist/deployment/hosted-topology.d.ts +146 -146
  59. package/dist/deployment/postgres/transfer.d.ts +2 -2
  60. package/dist/deployment/schemas.d.ts +504 -504
  61. package/dist/development/schemas.d.ts +325 -325
  62. package/dist/graph/context-query-contracts.js +1 -1
  63. package/dist/guarantees/index.d.ts +26 -2
  64. package/dist/identity/contracts.js +6 -1
  65. package/dist/operator-contracts/canonical-command-tree.js +22 -8
  66. package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +27 -27
  67. package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +25 -25
  68. package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +11 -9
  69. package/dist/operator-contracts/catalog/communication-operations.d.ts +108 -90
  70. package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +33 -33
  71. package/dist/operator-contracts/catalog/inbox-operations.d.ts +27 -27
  72. package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +4 -4
  73. package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +2 -1
  74. package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +5 -5
  75. package/dist/operator-contracts/catalog/provider-environment-operations.d.ts +3 -3
  76. package/dist/operator-contracts/catalog/services/secret-operations.d.ts +16 -8
  77. package/dist/operator-contracts/catalog/services/secret-operations.js +2 -1
  78. package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +11 -11
  79. package/dist/operator-contracts/catalog/workdays/selection-commands.js +7 -6
  80. package/dist/operator-contracts/communication/contracts.d.ts +340 -198
  81. package/dist/operator-contracts/communication/contracts.js +6 -1
  82. package/dist/operator-contracts/control-plane-operation.d.ts +7 -0
  83. package/dist/operator-contracts/control-plane-operation.js +6 -0
  84. package/dist/operator-contracts/control-plane-operations.d.ts +469 -442
  85. package/dist/operator-contracts/control-plane-operations.js +26 -10
  86. package/dist/operator-contracts/inbox/contracts.d.ts +100 -100
  87. package/dist/operator-contracts/knowledge/contracts.d.ts +6 -6
  88. package/dist/operator-contracts/mcp.js +4 -3
  89. package/dist/operator-contracts/workday-lifecycle.d.ts +192 -2
  90. package/dist/operator-contracts/workday-lifecycle.js +108 -45
  91. package/dist/platform/agent-schema-verification.js +316 -33
  92. package/dist/platform/contracts.d.ts +72 -72
  93. package/dist/platform/schemas.d.ts +144 -36
  94. package/dist/platform/schemas.js +26 -0
  95. package/dist/platform/verification.js +4 -0
  96. package/dist/sdk-types/support/sdk-search-request.d.ts +2 -2
  97. package/dist/secrets-capability/secret-contracts.d.ts +2 -2
  98. package/dist/secrets-capability/shared-access.d.ts +1 -1
  99. package/dist/secrets-capability/shared-resources.d.ts +30 -30
  100. package/dist/security/encrypted-envelope.d.ts +6 -6
  101. package/dist/treedx/client.d.ts +4 -4
  102. package/dist/treedx/index.d.ts +1 -1
  103. package/dist/treedx/index.js +1 -0
  104. package/dist/treedx/types.d.ts +286 -0
  105. package/dist/treedx/types.js +44 -0
  106. package/dist/types/agents/agent-activity-profile.d.ts +1 -0
  107. package/guarantees/agent/golden/component-boundaries.guarantee.yaml +12 -0
  108. package/guarantees/agent/golden/product-custody.guarantee.yaml +12 -0
  109. package/guarantees/agent/golden/product.guarantee.yaml +12 -0
  110. package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +837 -0
  111. package/guarantees/agent/golden/scenes/product-custody.scene.yaml +53 -0
  112. package/guarantees/agent/golden/scenes/product.scene.yaml +8 -0
  113. package/guarantees/verifiers/golden.verifiers.yaml +1429 -0
  114. package/package.json +10 -5
  115. package/tests/acceptance/golden-product.test.ts +205 -0
  116. package/tests/acceptance/golden-product.ts +404 -0
  117. package/tests/acceptance/product/base-red.ts +73 -0
  118. package/tests/acceptance/product/documentation-examples.ts +68 -0
  119. package/tests/acceptance/product/intent-runtime.ts +145 -0
  120. package/tests/acceptance/product/release-output.ts +160 -0
  121. package/tests/acceptance/product/research-artifact.ts +87 -0
  122. package/tests/acceptance/product/research-revision.ts +82 -0
  123. package/tests/acceptance/product/research-source.ts +91 -0
  124. package/tests/acceptance/product/test-chain.ts +192 -0
  125. package/treeseed.package.yaml +147 -0
  126. package/dist/.treeseed-build-complete.json +0 -1
@@ -1,13 +1,16 @@
1
1
  import { z } from "zod";
2
- import { activityProfileSchema } from "../../../validation/agent-definition-schema.js";
3
- const identifier = z.string().trim().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u);
2
+ import { conditionalFields, uniqueArray } from "../../../../content/validation/schema-constraints.js";
3
+ import { activityProfileSchema, agentClassSchema } from "../../../validation/agent-definition-schema.js";
4
+ import { AGENT_TOOL_GROUPS } from "../../../../types/agents.js";
5
+ const identifierPattern = /^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u;
6
+ const identifier = z.string().trim().min(1).max(200).regex(identifierPattern);
7
+ const canonicalIdentifier = z.string().min(1).max(200).regex(identifierPattern);
4
8
  const timestamp = z.string().datetime({ offset: true });
5
9
  const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
6
10
  const commit = z.string().regex(/^[a-f0-9]{40}$/u);
7
- const uniqueStrings = z.array(z.string().min(1)).superRefine((items, context) => {
8
- if (new Set(items).size !== items.length) context.addIssue({ code: z.ZodIssueCode.custom, message: "Values must be unique." });
9
- });
10
- const exactEntityReferenceSchema = z.object({
11
+ const uniqueStrings = uniqueArray(z.array(z.string().min(1)));
12
+ const writablePaths = uniqueArray(z.array(z.string().min(1)).min(1));
13
+ const exactEntityReferenceSchema = conditionalFields(z.object({
11
14
  store: z.enum(["treedx", "postgresql", "git", "url"]),
12
15
  model: z.string().min(1),
13
16
  id: identifier,
@@ -20,36 +23,36 @@ const exactEntityReferenceSchema = z.object({
20
23
  startLine: z.number().int().positive().optional(),
21
24
  endLine: z.number().int().positive().optional(),
22
25
  url: z.string().url().optional()
23
- }).strict().superRefine((reference, context) => {
24
- if (reference.endLine && !reference.startLine) context.addIssue({ code: z.ZodIssueCode.custom, path: ["startLine"], message: "startLine is required with endLine." });
25
- if (reference.store === "treedx" && !(reference.commit || reference.revision && reference.digest)) context.addIssue({ code: z.ZodIssueCode.custom, message: "TreeDX references require commit or revision and digest." });
26
- if (reference.store === "git" && !(reference.repository && reference.commit)) context.addIssue({ code: z.ZodIssueCode.custom, message: "Git references require repository and commit." });
27
- if (reference.store === "url" && !reference.url) context.addIssue({ code: z.ZodIssueCode.custom, message: "URL references require url." });
28
- });
26
+ }).strict(), [
27
+ { field: "endLine", alternatives: [["startLine"]], path: ["startLine"], message: "startLine is required with endLine." },
28
+ { field: "store", equals: "treedx", alternatives: [["revision", "digest"], ["commit"]], message: "TreeDX references require commit or revision and digest." },
29
+ { field: "store", equals: "git", alternatives: [["repository", "commit"]], message: "Git references require repository and commit." },
30
+ { field: "store", equals: "url", alternatives: [["url"]], message: "URL references require url." }
31
+ ]);
29
32
  const assignmentReferenceSchema = z.discriminatedUnion("kind", [
30
33
  z.object({ kind: z.literal("git"), repository: z.string().min(1), commit, branch: z.string().min(1).optional(), path: z.string().min(1).optional() }).strict(),
31
34
  z.object({ kind: z.literal("treedx"), projectId: identifier, repository: z.string().min(1), commit, path: z.string().min(1), workspaceId: identifier.optional() }).strict(),
32
35
  z.object({ kind: z.literal("url"), url: z.string().url(), digest: digest.optional() }).strict()
33
36
  ]);
37
+ const exactReferences = uniqueArray(z.array(exactEntityReferenceSchema));
34
38
  const exactGrantSchema = z.object({
35
- contentRead: z.array(exactEntityReferenceSchema),
36
- contentWrite: z.array(exactEntityReferenceSchema),
39
+ contentRead: exactReferences,
40
+ contentWrite: exactReferences,
37
41
  sourceRead: uniqueStrings,
38
42
  sourceWrite: uniqueStrings,
39
- tools: uniqueStrings
43
+ tools: uniqueArray(z.array(z.enum(AGENT_TOOL_GROUPS)))
40
44
  }).strict();
41
45
  const assignmentWorkspaceSchema = z.discriminatedUnion("mode", [
42
46
  z.object({ mode: z.literal("read-only") }).strict(),
43
- z.object({ mode: z.literal("treedx"), workspaceId: identifier, repository: z.string().min(1), baseCommit: commit, writablePaths: uniqueStrings.refine((paths) => paths.length > 0) }).strict(),
44
- z.object({ mode: z.literal("git"), repository: z.string().min(1), baseCommit: commit, branch: z.string().min(1), writablePaths: uniqueStrings.refine((paths) => paths.length > 0) }).strict()
47
+ z.object({ mode: z.literal("treedx"), workspaceId: identifier, repository: z.string().min(1), baseCommit: commit, writablePaths }).strict(),
48
+ z.object({ mode: z.literal("git"), repository: z.string().min(1), baseCommit: commit, branch: z.string().min(1), writablePaths }).strict()
45
49
  ]);
46
50
  const estimateSchema = z.object({
47
- minimumSeconds: z.number().int().positive(),
48
51
  expectedSeconds: z.number().int().positive(),
49
52
  maximumSeconds: z.number().int().positive(),
50
53
  rationale: z.string().optional()
51
- }).strict().refine((value) => value.minimumSeconds <= value.expectedSeconds && value.expectedSeconds <= value.maximumSeconds, {
52
- message: "Estimate must satisfy minimumSeconds <= expectedSeconds <= maximumSeconds."
54
+ }).strict().refine((value) => value.expectedSeconds <= value.maximumSeconds, {
55
+ message: "Estimate must satisfy expectedSeconds <= maximumSeconds."
53
56
  });
54
57
  const effectiveActivityProfileSchema = activityProfileSchema.omit({ dependsOn: true }).extend({
55
58
  profileRef: exactEntityReferenceSchema,
@@ -85,13 +88,13 @@ const assignmentAttemptSchema = z.object({
85
88
  nodeRevision: z.number().int().positive(),
86
89
  graphRevision: z.number().int().positive(),
87
90
  sourceRef: exactEntityReferenceSchema,
88
- authorityRefs: z.array(exactEntityReferenceSchema).min(1),
91
+ authorityRefs: uniqueArray(z.array(exactEntityReferenceSchema).min(1)),
89
92
  effectiveProfile: effectiveActivityProfileSchema,
90
- requiredCapabilities: uniqueStrings,
93
+ requiredCapabilities: uniqueArray(z.array(canonicalIdentifier)),
91
94
  grant: exactGrantSchema,
92
95
  provider: providerSelectionSchema,
93
- contextRefs: z.array(exactEntityReferenceSchema),
94
- predecessorResultIds: uniqueStrings,
96
+ contextRefs: exactReferences,
97
+ predecessorResultIds: uniqueArray(z.array(canonicalIdentifier)),
95
98
  acceptanceCriteria: z.array(z.string().trim().min(1)).min(1).optional(),
96
99
  workspace: assignmentWorkspaceSchema,
97
100
  estimate: estimateSchema,
@@ -136,7 +139,7 @@ const usageSchema = z.object({
136
139
  elapsedSeconds: z.number().int().nonnegative(),
137
140
  modelInputTokens: z.number().int().nonnegative().optional(),
138
141
  modelOutputTokens: z.number().int().nonnegative().optional(),
139
- native: z.record(z.number().nonnegative()).optional()
142
+ native: z.record(z.number().finite().nonnegative()).optional()
140
143
  }).strict();
141
144
  const diagnosticSchema = z.object({
142
145
  code: identifier,
@@ -161,18 +164,57 @@ const assignmentResultSchema = z.object({
161
164
  assignmentId: identifier,
162
165
  status: z.enum(["completed", "blocked", "failed"]),
163
166
  summary: z.string().min(1),
164
- references: z.array(assignmentReferenceSchema),
167
+ references: uniqueArray(z.array(assignmentReferenceSchema)),
165
168
  verification: z.array(verificationRecordSchema),
166
169
  usage: usageSchema,
167
170
  diagnostics: z.array(diagnosticSchema),
168
171
  timingAwareness: assignmentTimingAwarenessReceiptSchema.optional(),
169
172
  completedAt: timestamp
170
173
  }).strict();
174
+ const leaseSchema = z.object({
175
+ schemaVersion: z.literal("treeseed.lease/v1"),
176
+ id: canonicalIdentifier,
177
+ assignmentId: canonicalIdentifier,
178
+ providerId: canonicalIdentifier,
179
+ state: z.enum(["active", "released", "expired", "revoked"]),
180
+ acquiredAt: timestamp,
181
+ expiresAt: timestamp,
182
+ releasedAt: timestamp.optional(),
183
+ revision: z.number().int().positive()
184
+ }).strict();
185
+ const reservationSchema = z.object({
186
+ schemaVersion: z.literal("treeseed.reservation/v1"),
187
+ id: canonicalIdentifier,
188
+ assignmentId: canonicalIdentifier,
189
+ workdayId: canonicalIdentifier,
190
+ providerId: canonicalIdentifier,
191
+ estimatedSeconds: z.number().int().positive(),
192
+ state: z.enum(["held", "consumed", "released", "expired"]),
193
+ reservedAt: timestamp,
194
+ closedAt: timestamp.optional()
195
+ }).strict();
196
+ const usageSettlementSchema = z.object({
197
+ schemaVersion: z.literal("treeseed.usage-settlement/v1"),
198
+ id: canonicalIdentifier,
199
+ idempotencyKey: canonicalIdentifier,
200
+ assignmentId: canonicalIdentifier,
201
+ reservationId: canonicalIdentifier,
202
+ workdayId: canonicalIdentifier,
203
+ teamId: canonicalIdentifier,
204
+ projectId: canonicalIdentifier,
205
+ agentClass: agentClassSchema,
206
+ providerId: canonicalIdentifier,
207
+ actualSeconds: z.number().int().nonnegative(),
208
+ nativeUsage: z.record(z.number().finite().nonnegative()),
209
+ cost: z.number().finite().nonnegative().optional(),
210
+ currency: z.string().regex(/^[A-Z]{3}$/u).optional(),
211
+ settledAt: timestamp
212
+ }).strict();
171
213
  const authorizedContextItemSchema = z.object({
172
214
  ref: exactEntityReferenceSchema,
173
215
  mediaType: z.string().min(1),
174
216
  digest,
175
- value: z.any()
217
+ value: z.unknown().refine((value) => value !== void 0, { message: "Authorized context requires its value payload." })
176
218
  }).strict();
177
219
  const assignmentContextSchema = z.object({
178
220
  assignment: assignmentAttemptSchema,
@@ -192,6 +234,9 @@ export {
192
234
  estimateSchema,
193
235
  exactEntityReferenceSchema,
194
236
  exactGrantSchema,
237
+ leaseSchema,
238
+ reservationSchema,
195
239
  usageSchema,
240
+ usageSettlementSchema,
196
241
  verificationRecordSchema
197
242
  };
@@ -53,11 +53,11 @@ export declare const assignmentContextSourceSchema: z.ZodObject<{
53
53
  }, "strict", z.ZodTypeAny, {
54
54
  amount: number;
55
55
  provenance: string;
56
- unit: "tokens" | "bytes" | "items";
56
+ unit: "items" | "tokens" | "bytes";
57
57
  }, {
58
58
  amount: number;
59
59
  provenance: string;
60
- unit: "tokens" | "bytes" | "items";
60
+ unit: "items" | "tokens" | "bytes";
61
61
  }>;
62
62
  reason: z.ZodNullable<z.ZodString>;
63
63
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -65,15 +65,15 @@ export declare const assignmentContextSourceSchema: z.ZodObject<{
65
65
  path: string | null;
66
66
  kind: string;
67
67
  id: string;
68
- digest: string;
69
68
  required: boolean;
70
- projectId: string;
71
69
  teamId: string;
70
+ projectId: string;
72
71
  metadata: Record<string, unknown>;
72
+ digest: string;
73
73
  measurement: {
74
74
  amount: number;
75
75
  provenance: string;
76
- unit: "tokens" | "bytes" | "items";
76
+ unit: "items" | "tokens" | "bytes";
77
77
  };
78
78
  reason: string | null;
79
79
  disposition: "failed" | "included" | "summarized" | "omitted";
@@ -82,14 +82,14 @@ export declare const assignmentContextSourceSchema: z.ZodObject<{
82
82
  path: string | null;
83
83
  kind: string;
84
84
  id: string;
85
- digest: string;
86
85
  required: boolean;
87
- projectId: string;
88
86
  teamId: string;
87
+ projectId: string;
88
+ digest: string;
89
89
  measurement: {
90
90
  amount: number;
91
91
  provenance: string;
92
- unit: "tokens" | "bytes" | "items";
92
+ unit: "items" | "tokens" | "bytes";
93
93
  };
94
94
  reason: string | null;
95
95
  disposition: "failed" | "included" | "summarized" | "omitted";
@@ -122,7 +122,7 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
122
122
  }, "strict", z.ZodTypeAny, {
123
123
  maximum: number | null;
124
124
  mode: "bounded" | "unbounded";
125
- measurement: "tokens" | "bytes" | "items" | null;
125
+ measurement: "items" | "tokens" | "bytes" | null;
126
126
  defaultInitial: number | null;
127
127
  reservedOutput: number | null;
128
128
  transportPayloadBytes: number;
@@ -134,7 +134,7 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
134
134
  }, {
135
135
  maximum: number | null;
136
136
  mode: "bounded" | "unbounded";
137
- measurement: "tokens" | "bytes" | "items" | null;
137
+ measurement: "items" | "tokens" | "bytes" | null;
138
138
  defaultInitial: number | null;
139
139
  reservedOutput: number | null;
140
140
  transportPayloadBytes: number;
@@ -149,13 +149,13 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
149
149
  bytes: z.ZodNumber;
150
150
  items: z.ZodNumber;
151
151
  }, "strict", z.ZodTypeAny, {
152
+ items: number;
152
153
  tokens: number;
153
154
  bytes: number;
154
- items: number;
155
155
  }, {
156
+ items: number;
156
157
  tokens: number;
157
158
  bytes: number;
158
- items: number;
159
159
  }>;
160
160
  sources: z.ZodArray<z.ZodObject<{
161
161
  id: z.ZodString;
@@ -174,11 +174,11 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
174
174
  }, "strict", z.ZodTypeAny, {
175
175
  amount: number;
176
176
  provenance: string;
177
- unit: "tokens" | "bytes" | "items";
177
+ unit: "items" | "tokens" | "bytes";
178
178
  }, {
179
179
  amount: number;
180
180
  provenance: string;
181
- unit: "tokens" | "bytes" | "items";
181
+ unit: "items" | "tokens" | "bytes";
182
182
  }>;
183
183
  reason: z.ZodNullable<z.ZodString>;
184
184
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -186,15 +186,15 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
186
186
  path: string | null;
187
187
  kind: string;
188
188
  id: string;
189
- digest: string;
190
189
  required: boolean;
191
- projectId: string;
192
190
  teamId: string;
191
+ projectId: string;
193
192
  metadata: Record<string, unknown>;
193
+ digest: string;
194
194
  measurement: {
195
195
  amount: number;
196
196
  provenance: string;
197
- unit: "tokens" | "bytes" | "items";
197
+ unit: "items" | "tokens" | "bytes";
198
198
  };
199
199
  reason: string | null;
200
200
  disposition: "failed" | "included" | "summarized" | "omitted";
@@ -203,14 +203,14 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
203
203
  path: string | null;
204
204
  kind: string;
205
205
  id: string;
206
- digest: string;
207
206
  required: boolean;
208
- projectId: string;
209
207
  teamId: string;
208
+ projectId: string;
209
+ digest: string;
210
210
  measurement: {
211
211
  amount: number;
212
212
  provenance: string;
213
- unit: "tokens" | "bytes" | "items";
213
+ unit: "items" | "tokens" | "bytes";
214
214
  };
215
215
  reason: string | null;
216
216
  disposition: "failed" | "included" | "summarized" | "omitted";
@@ -220,30 +220,30 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
220
220
  digest: z.ZodString;
221
221
  }, "strict", z.ZodTypeAny, {
222
222
  schemaVersion: "treeseed.assignment-context-pack/v1";
223
+ assignmentId: string;
224
+ digest: string;
223
225
  sources: {
224
226
  path: string | null;
225
227
  kind: string;
226
228
  id: string;
227
- digest: string;
228
229
  required: boolean;
229
- projectId: string;
230
230
  teamId: string;
231
+ projectId: string;
231
232
  metadata: Record<string, unknown>;
233
+ digest: string;
232
234
  measurement: {
233
235
  amount: number;
234
236
  provenance: string;
235
- unit: "tokens" | "bytes" | "items";
237
+ unit: "items" | "tokens" | "bytes";
236
238
  };
237
239
  reason: string | null;
238
240
  disposition: "failed" | "included" | "summarized" | "omitted";
239
241
  layer: "agent" | "live" | "activity" | "core" | "tool";
240
242
  }[];
241
- digest: string;
242
- assignmentId: string;
243
243
  capacity: {
244
244
  maximum: number | null;
245
245
  mode: "bounded" | "unbounded";
246
- measurement: "tokens" | "bytes" | "items" | null;
246
+ measurement: "items" | "tokens" | "bytes" | null;
247
247
  defaultInitial: number | null;
248
248
  reservedOutput: number | null;
249
249
  transportPayloadBytes: number;
@@ -254,36 +254,36 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
254
254
  };
255
255
  };
256
256
  totals: {
257
+ items: number;
257
258
  tokens: number;
258
259
  bytes: number;
259
- items: number;
260
260
  };
261
261
  }, {
262
262
  schemaVersion: "treeseed.assignment-context-pack/v1";
263
+ assignmentId: string;
264
+ digest: string;
263
265
  sources: {
264
266
  path: string | null;
265
267
  kind: string;
266
268
  id: string;
267
- digest: string;
268
269
  required: boolean;
269
- projectId: string;
270
270
  teamId: string;
271
+ projectId: string;
272
+ digest: string;
271
273
  measurement: {
272
274
  amount: number;
273
275
  provenance: string;
274
- unit: "tokens" | "bytes" | "items";
276
+ unit: "items" | "tokens" | "bytes";
275
277
  };
276
278
  reason: string | null;
277
279
  disposition: "failed" | "included" | "summarized" | "omitted";
278
280
  layer: "agent" | "live" | "activity" | "core" | "tool";
279
281
  metadata?: Record<string, unknown> | undefined;
280
282
  }[];
281
- digest: string;
282
- assignmentId: string;
283
283
  capacity: {
284
284
  maximum: number | null;
285
285
  mode: "bounded" | "unbounded";
286
- measurement: "tokens" | "bytes" | "items" | null;
286
+ measurement: "items" | "tokens" | "bytes" | null;
287
287
  defaultInitial: number | null;
288
288
  reservedOutput: number | null;
289
289
  transportPayloadBytes: number;
@@ -294,9 +294,9 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
294
294
  };
295
295
  };
296
296
  totals: {
297
+ items: number;
297
298
  tokens: number;
298
299
  bytes: number;
299
- items: number;
300
300
  };
301
301
  }>;
302
302
  export type ContextSourceSelector = z.infer<typeof contextSourceSelectorSchema>;
@@ -0,0 +1,2 @@
1
+ /** Assignment paths are relative, traversal-free, and bounded by their workspace grant. */
2
+ export declare function assignmentPathAllowed(path: string, allowed: readonly string[]): boolean;
@@ -0,0 +1,13 @@
1
+ function assignmentPathAllowed(path, allowed) {
2
+ const safe = (value) => value.length > 0 && !value.includes("\\") && !value.includes("\0") && value.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== "..");
3
+ if (!safe(path) || /[*?]/u.test(path)) return false;
4
+ return allowed.some((value) => {
5
+ const prefix = value.replace(/\/$/u, "");
6
+ if (prefix === "." || prefix === "**") return true;
7
+ const directory = prefix.endsWith("/**") ? prefix.slice(0, -3) : prefix;
8
+ return safe(directory) && !/[*?]/u.test(directory) && (path === directory || path.startsWith(`${directory}/`));
9
+ });
10
+ }
11
+ export {
12
+ assignmentPathAllowed
13
+ };
@@ -144,6 +144,7 @@ export interface ProviderAssignment {
144
144
  parentWorkdayId?: string | null;
145
145
  parentAssignmentId?: string | null;
146
146
  handoffRootId?: string | null;
147
+ operationHandoffId?: string | null;
147
148
  handoffParentId?: string | null;
148
149
  handoffDepth?: number;
149
150
  sourceMessageRefs?: string[];
@@ -1,3 +1,129 @@
1
+ import { z } from 'zod';
2
+ export declare const availabilityWindowSchema: z.ZodObject<{
3
+ startsAt: z.ZodString;
4
+ endsAt: z.ZodString;
5
+ }, "strict", z.ZodTypeAny, {
6
+ startsAt: string;
7
+ endsAt: string;
8
+ }, {
9
+ startsAt: string;
10
+ endsAt: string;
11
+ }>;
12
+ export declare const nativeLimitSchema: z.ZodObject<{
13
+ name: z.ZodString;
14
+ unit: z.ZodString;
15
+ maximum: z.ZodNumber;
16
+ }, "strict", z.ZodTypeAny, {
17
+ maximum: number;
18
+ name: string;
19
+ unit: string;
20
+ }, {
21
+ maximum: number;
22
+ name: string;
23
+ unit: string;
24
+ }>;
25
+ export declare const providerOfferSchema: z.ZodObject<{
26
+ schemaVersion: z.ZodLiteral<"treeseed.provider-offer/v1">;
27
+ id: z.ZodString;
28
+ providerId: z.ZodString;
29
+ revision: z.ZodNumber;
30
+ runtimeBuild: z.ZodString;
31
+ capabilities: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
32
+ toolGroups: z.ZodEffects<z.ZodArray<z.ZodEnum<["discussion", "source.read", "source.write", "verification", "release"]>, "many">, ("discussion" | "source.read" | "source.write" | "verification" | "release")[], ("discussion" | "source.read" | "source.write" | "verification" | "release")[]>;
33
+ maximumConcurrency: z.ZodNumber;
34
+ availability: z.ZodArray<z.ZodObject<{
35
+ startsAt: z.ZodString;
36
+ endsAt: z.ZodString;
37
+ }, "strict", z.ZodTypeAny, {
38
+ startsAt: string;
39
+ endsAt: string;
40
+ }, {
41
+ startsAt: string;
42
+ endsAt: string;
43
+ }>, "many">;
44
+ nativeLimits: z.ZodArray<z.ZodObject<{
45
+ name: z.ZodString;
46
+ unit: z.ZodString;
47
+ maximum: z.ZodNumber;
48
+ }, "strict", z.ZodTypeAny, {
49
+ maximum: number;
50
+ name: string;
51
+ unit: string;
52
+ }, {
53
+ maximum: number;
54
+ name: string;
55
+ unit: string;
56
+ }>, "many">;
57
+ validFrom: z.ZodString;
58
+ validUntil: z.ZodOptional<z.ZodString>;
59
+ }, "strict", z.ZodTypeAny, {
60
+ id: string;
61
+ schemaVersion: "treeseed.provider-offer/v1";
62
+ revision: number;
63
+ capabilities: string[];
64
+ providerId: string;
65
+ runtimeBuild: string;
66
+ maximumConcurrency: number;
67
+ toolGroups: ("discussion" | "source.read" | "source.write" | "verification" | "release")[];
68
+ availability: {
69
+ startsAt: string;
70
+ endsAt: string;
71
+ }[];
72
+ nativeLimits: {
73
+ maximum: number;
74
+ name: string;
75
+ unit: string;
76
+ }[];
77
+ validFrom: string;
78
+ validUntil?: string | undefined;
79
+ }, {
80
+ id: string;
81
+ schemaVersion: "treeseed.provider-offer/v1";
82
+ revision: number;
83
+ capabilities: string[];
84
+ providerId: string;
85
+ runtimeBuild: string;
86
+ maximumConcurrency: number;
87
+ toolGroups: ("discussion" | "source.read" | "source.write" | "verification" | "release")[];
88
+ availability: {
89
+ startsAt: string;
90
+ endsAt: string;
91
+ }[];
92
+ nativeLimits: {
93
+ maximum: number;
94
+ name: string;
95
+ unit: string;
96
+ }[];
97
+ validFrom: string;
98
+ validUntil?: string | undefined;
99
+ }>;
100
+ export declare const providerStateSchema: z.ZodObject<{
101
+ schemaVersion: z.ZodLiteral<"treeseed.provider-state/v1">;
102
+ providerId: z.ZodString;
103
+ offerId: z.ZodString;
104
+ healthy: z.ZodBoolean;
105
+ activeAssignmentIds: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
106
+ observedNativeUsage: z.ZodRecord<z.ZodString, z.ZodNumber>;
107
+ observedAt: z.ZodString;
108
+ }, "strict", z.ZodTypeAny, {
109
+ schemaVersion: "treeseed.provider-state/v1";
110
+ providerId: string;
111
+ observedAt: string;
112
+ offerId: string;
113
+ healthy: boolean;
114
+ activeAssignmentIds: string[];
115
+ observedNativeUsage: Record<string, number>;
116
+ }, {
117
+ schemaVersion: "treeseed.provider-state/v1";
118
+ providerId: string;
119
+ observedAt: string;
120
+ offerId: string;
121
+ healthy: boolean;
122
+ activeAssignmentIds: string[];
123
+ observedNativeUsage: Record<string, number>;
124
+ }>;
125
+ export type ProviderOffer = z.infer<typeof providerOfferSchema>;
126
+ export type ProviderState = z.infer<typeof providerStateSchema>;
1
127
  export declare const CAPACITY_SUPPLY_POLICY_CONTRACT: "treeseed.capacity-supply-policy/v1";
2
128
  export interface CapacitySupplyPolicy {
3
129
  contract: typeof CAPACITY_SUPPLY_POLICY_CONTRACT;
@@ -22,7 +148,6 @@ export interface CapacitySupplyCandidate {
22
148
  availableConcurrency: number;
23
149
  preferred?: boolean;
24
150
  estimatedCost?: number | null;
25
- minimumAssignmentDuration?: import('../../../../capacity-provider/contracts/governance.js').MinimumAssignmentDuration;
26
151
  }
27
152
  export interface CapacitySupplySelection {
28
153
  selected: CapacitySupplyCandidate | null;
@@ -1,4 +1,38 @@
1
+ import { z } from "zod";
2
+ import { uniqueArray } from "../../../../content/validation/schema-constraints.js";
3
+ import { AGENT_TOOL_GROUPS } from "../../../../types/agents.js";
4
+ import { assignmentAttemptSchema, leaseSchema } from "../assignments/agent-execution.js";
5
+ const identifier = leaseSchema.shape.id, timestamp = leaseSchema.shape.acquiredAt;
6
+ const availabilityWindowSchema = z.object({ startsAt: timestamp, endsAt: timestamp }).strict();
7
+ const nativeLimitSchema = z.object({ name: identifier, unit: identifier, maximum: z.number().finite().positive() }).strict();
8
+ const providerOfferSchema = z.object({
9
+ schemaVersion: z.literal("treeseed.provider-offer/v1"),
10
+ id: identifier,
11
+ providerId: identifier,
12
+ revision: z.number().int().positive(),
13
+ runtimeBuild: assignmentAttemptSchema.innerType().shape.provider.shape.runtimeBuild,
14
+ capabilities: uniqueArray(z.array(identifier)),
15
+ toolGroups: uniqueArray(z.array(z.enum(AGENT_TOOL_GROUPS))),
16
+ maximumConcurrency: z.number().int().positive(),
17
+ availability: z.array(availabilityWindowSchema).min(1),
18
+ nativeLimits: z.array(nativeLimitSchema),
19
+ validFrom: timestamp,
20
+ validUntil: timestamp.optional()
21
+ }).strict();
22
+ const providerStateSchema = z.object({
23
+ schemaVersion: z.literal("treeseed.provider-state/v1"),
24
+ providerId: identifier,
25
+ offerId: identifier,
26
+ healthy: z.boolean(),
27
+ activeAssignmentIds: uniqueArray(z.array(identifier)),
28
+ observedNativeUsage: z.record(z.number().finite().nonnegative()),
29
+ observedAt: timestamp
30
+ }).strict();
1
31
  const CAPACITY_SUPPLY_POLICY_CONTRACT = "treeseed.capacity-supply-policy/v1";
2
32
  export {
3
- CAPACITY_SUPPLY_POLICY_CONTRACT
33
+ CAPACITY_SUPPLY_POLICY_CONTRACT,
34
+ availabilityWindowSchema,
35
+ nativeLimitSchema,
36
+ providerOfferSchema,
37
+ providerStateSchema
4
38
  };
@@ -20,6 +20,7 @@ export declare function allocateWorkdayCapacity(input: {
20
20
  committedSeconds: number;
21
21
  planningCommittedSeconds: number;
22
22
  maximumAdditionalSeconds: number;
23
+ actingReady: boolean;
23
24
  }>;
24
25
  }): {
25
26
  [k: string]: {
@@ -57,20 +58,17 @@ export interface AssignmentAllocationConstraint {
57
58
  }
58
59
  export declare function calculateAssignmentAllocation(input: {
59
60
  estimate: {
60
- minimumSeconds: number;
61
61
  expectedSeconds: number;
62
62
  maximumSeconds: number;
63
63
  };
64
64
  measurements: AllocationMeasurement[];
65
65
  constraints: AssignmentAllocationConstraint[];
66
- providerMinimumSeconds?: number;
67
66
  providerMaximumSeconds?: number;
68
67
  profileMaximumSeconds?: number;
69
68
  planningTurnMaximumSeconds?: number;
70
69
  }): {
71
70
  admitted: boolean;
72
71
  allocatedSeconds: number;
73
- minimumSeconds: number;
74
72
  desiredSeconds: number;
75
73
  calibration: {
76
74
  seconds: number;