@treeseed/sdk 0.13.0-rc.120 → 0.13.0-rc.122

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 (97) hide show
  1. package/dist/.treeseed-build-complete.json +1 -1
  2. package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +1594 -922
  3. package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +22 -1
  4. package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +40 -40
  5. package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +1 -59
  6. package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +1 -1
  7. package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +1 -1
  8. package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +18 -20
  9. package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +1 -1
  10. package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +0 -67
  11. package/dist/agent-capacity/contracts/configuration/configuration.d.ts +1 -1
  12. package/dist/agent-capacity/contracts/configuration/configuration.js +0 -2
  13. package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +8 -8
  14. package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +0 -23
  15. package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +2 -154
  16. package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +0 -13
  17. package/dist/agent-capacity/contracts/support/execution-graph.d.ts +176 -176
  18. package/dist/agent-capacity/contracts/support/execution-graph.js +1 -1
  19. package/dist/agent-capacity/contracts/support/financial-records.d.ts +1 -6
  20. package/dist/agent-capacity/contracts/support/planning-records.d.ts +1 -87
  21. package/dist/agent-capacity/grant.d.ts +34 -0
  22. package/dist/agent-capacity/grant.js +4 -0
  23. package/dist/agent-capacity/validation/agent-definition-schema.d.ts +1042 -1042
  24. package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +11 -11
  25. package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +0 -1
  26. package/dist/agent-capacity/validation/assignment-records.d.ts +1 -6
  27. package/dist/agent-capacity/validation/assignment-records.js +4 -35
  28. package/dist/agent-capacity/validation/configuration.d.ts +1 -1
  29. package/dist/agent-capacity/validation/configuration.js +2 -6
  30. package/dist/agent-capacity/validation/grant.d.ts +11 -0
  31. package/dist/agent-capacity/validation/grant.js +31 -0
  32. package/dist/capacity/agents/agent-capacity.d.ts +2 -4
  33. package/dist/capacity/agents/agent-capacity.js +1 -3
  34. package/dist/capacity-provider/capability-ontology.d.ts +138 -138
  35. package/dist/capacity-provider/client.d.ts +1 -2
  36. package/dist/capacity-provider/client.js +0 -6
  37. package/dist/capacity-provider/contracts/environment-profiles.d.ts +8 -8
  38. package/dist/capacity-provider/core-capability-catalog.d.ts +4 -4
  39. package/dist/capacity-provider/environment-catalog.d.ts +166 -166
  40. package/dist/capacity-provider/install-configuration.d.ts +2 -2
  41. package/dist/capacity-provider/sandbox-contracts.d.ts +52 -52
  42. package/dist/capacity-provider/source-workspace.d.ts +102 -4
  43. package/dist/capacity-provider/source-workspace.js +5 -1
  44. package/dist/content/validation/agent-operational-content-schemas.d.ts +108 -108
  45. package/dist/content/validation/auxiliary-content-schemas.d.ts +108 -108
  46. package/dist/content/validation/content-model-schemas.d.ts +9473 -6284
  47. package/dist/content/validation/content-model-schemas.js +116 -48
  48. package/dist/content/validation/portable-content-data.d.ts +351 -181
  49. package/dist/content/validation/portable-content-data.js +6 -1
  50. package/dist/deployment/ai/storage.d.ts +14 -14
  51. package/dist/deployment/ai-hosting.d.ts +10 -10
  52. package/dist/deployment/ai-instance.d.ts +14 -14
  53. package/dist/deployment/ai-mode.d.ts +82 -82
  54. package/dist/deployment/hosted-topology-template.d.ts +24 -24
  55. package/dist/deployment/hosted-topology.d.ts +219 -219
  56. package/dist/deployment/postgres/contracts.d.ts +52 -52
  57. package/dist/deployment/postgres/transfer.d.ts +4 -4
  58. package/dist/deployment/schemas.d.ts +780 -780
  59. package/dist/development/schemas.d.ts +440 -440
  60. package/dist/development/schemas.js +1 -1
  61. package/dist/knowledge/contracts.d.ts +9 -2
  62. package/dist/knowledge/contracts.js +2 -2
  63. package/dist/model-registry/discussion-models.js +0 -1
  64. package/dist/operator-contracts/canonical-command-tree.js +9 -2
  65. package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +2 -2
  66. package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +17 -17
  67. package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +4 -4
  68. package/dist/operator-contracts/catalog/communication-operations.d.ts +100 -100
  69. package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +40 -40
  70. package/dist/operator-contracts/catalog/inbox-operations.d.ts +54 -54
  71. package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +5 -5
  72. package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +10 -10
  73. package/dist/operator-contracts/catalog/services/secret-operations.d.ts +8 -8
  74. package/dist/operator-contracts/communication/contracts.d.ts +273 -273
  75. package/dist/operator-contracts/control-plane-operations.d.ts +236 -242
  76. package/dist/operator-contracts/control-plane-operations.js +0 -2
  77. package/dist/operator-contracts/inbox/contracts.d.ts +204 -204
  78. package/dist/operator-contracts/knowledge/contracts.d.ts +16 -16
  79. package/dist/platform/agent-schema-verification.d.ts +3 -0
  80. package/dist/platform/agent-schema-verification.js +94 -0
  81. package/dist/platform/verification.js +6 -0
  82. package/dist/sdk-types/support/planning-policy.d.ts +1 -1
  83. package/dist/secrets-capability/shared-access.d.ts +2 -2
  84. package/dist/secrets-capability/shared-resources.d.ts +46 -46
  85. package/dist/secrets-capability/vault-contracts.d.ts +2 -2
  86. package/dist/security/encrypted-envelope.d.ts +8 -8
  87. package/package.json +3 -2
  88. package/dist/agent-capacity/allocation.d.ts +0 -183
  89. package/dist/agent-capacity/allocation.js +0 -5
  90. package/dist/agent-capacity/artifact-mutation-receipt.d.ts +0 -49
  91. package/dist/agent-capacity/artifact-mutation-receipt.js +0 -36
  92. package/dist/agent-capacity/artifacts.d.ts +0 -123
  93. package/dist/agent-capacity/artifacts.js +0 -39
  94. package/dist/agent-capacity/contracts/support/decision-work.d.ts +0 -227
  95. package/dist/agent-capacity/contracts/support/decision-work.js +0 -0
  96. package/dist/agent-capacity/validation/allocation.d.ts +0 -12
  97. package/dist/agent-capacity/validation/allocation.js +0 -115
@@ -80,6 +80,7 @@ const assignmentAttemptSchema = z.object({
80
80
  projectId: identifier,
81
81
  workdayId: identifier,
82
82
  nodeId: identifier,
83
+ agentClass: z.string().regex(/^[a-z][a-z0-9-]*$/u),
83
84
  workItemId: identifier.optional(),
84
85
  nodeRevision: z.number().int().positive(),
85
86
  graphRevision: z.number().int().positive(),
@@ -103,7 +104,27 @@ const assignmentAttemptSchema = z.object({
103
104
  createdAt: timestamp,
104
105
  startedAt: timestamp.optional(),
105
106
  finishedAt: timestamp.optional()
106
- }).strict();
107
+ }).strict().superRefine((attempt, context) => {
108
+ const workspace = attempt.workspace;
109
+ const sourceWriters = attempt.grant.sourceWrite;
110
+ const contentWriters = attempt.grant.contentWrite;
111
+ const invalid = (path, message) => context.addIssue({
112
+ code: z.ZodIssueCode.custom,
113
+ path,
114
+ message
115
+ });
116
+ if (workspace.mode === "read-only") {
117
+ if (sourceWriters.length) invalid(["grant", "sourceWrite"], "Read-only assignments cannot write source.");
118
+ if (contentWriters.length) invalid(["grant", "contentWrite"], "Read-only assignments cannot write TreeDX content.");
119
+ } else if (workspace.mode === "git") {
120
+ if (contentWriters.length) invalid(["grant", "contentWrite"], "Git assignments cannot mutate TreeDX content.");
121
+ if (sourceWriters.some((repository) => repository !== workspace.repository)) invalid(["grant", "sourceWrite"], "Git writes must stay in the one assigned repository.");
122
+ } else {
123
+ if (sourceWriters.length) invalid(["grant", "sourceWrite"], "TreeDX assignments cannot mutate Git source.");
124
+ if (contentWriters.some((reference) => reference.store !== "treedx" || reference.repository !== workspace.repository))
125
+ invalid(["grant", "contentWrite"], "TreeDX writes must stay in the one assigned repository.");
126
+ }
127
+ });
107
128
  const verificationRecordSchema = z.object({
108
129
  command: z.string().min(1),
109
130
  status: z.enum(["passed", "failed", "skipped"]),
@@ -51,13 +51,13 @@ export declare const assignmentContextSourceSchema: z.ZodObject<{
51
51
  amount: z.ZodNumber;
52
52
  provenance: z.ZodString;
53
53
  }, "strict", z.ZodTypeAny, {
54
- provenance: string;
55
54
  amount: number;
56
- unit: "items" | "tokens" | "bytes";
57
- }, {
58
55
  provenance: string;
56
+ unit: "tokens" | "bytes" | "items";
57
+ }, {
59
58
  amount: number;
60
- unit: "items" | "tokens" | "bytes";
59
+ provenance: string;
60
+ unit: "tokens" | "bytes" | "items";
61
61
  }>;
62
62
  reason: z.ZodNullable<z.ZodString>;
63
63
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -69,15 +69,15 @@ export declare const assignmentContextSourceSchema: z.ZodObject<{
69
69
  required: boolean;
70
70
  projectId: string;
71
71
  teamId: string;
72
- reason: string | null;
73
72
  metadata: Record<string, unknown>;
74
73
  measurement: {
75
- provenance: string;
76
74
  amount: number;
77
- unit: "items" | "tokens" | "bytes";
75
+ provenance: string;
76
+ unit: "tokens" | "bytes" | "items";
78
77
  };
79
- layer: "agent" | "live" | "core" | "tool" | "activity";
78
+ reason: string | null;
80
79
  disposition: "failed" | "included" | "summarized" | "omitted";
80
+ layer: "agent" | "live" | "activity" | "core" | "tool";
81
81
  }, {
82
82
  path: string | null;
83
83
  kind: string;
@@ -86,14 +86,14 @@ export declare const assignmentContextSourceSchema: z.ZodObject<{
86
86
  required: boolean;
87
87
  projectId: string;
88
88
  teamId: string;
89
- reason: string | null;
90
89
  measurement: {
91
- provenance: string;
92
90
  amount: number;
93
- unit: "items" | "tokens" | "bytes";
91
+ provenance: string;
92
+ unit: "tokens" | "bytes" | "items";
94
93
  };
95
- layer: "agent" | "live" | "core" | "tool" | "activity";
94
+ reason: string | null;
96
95
  disposition: "failed" | "included" | "summarized" | "omitted";
96
+ layer: "agent" | "live" | "activity" | "core" | "tool";
97
97
  metadata?: Record<string, unknown> | undefined;
98
98
  }>;
99
99
  export declare const assignmentContextPackSchema: z.ZodObject<{
@@ -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: "items" | "tokens" | "bytes" | null;
125
+ measurement: "tokens" | "bytes" | "items" | 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: "items" | "tokens" | "bytes" | null;
137
+ measurement: "tokens" | "bytes" | "items" | 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;
153
152
  tokens: number;
154
153
  bytes: number;
155
- }, {
156
154
  items: number;
155
+ }, {
157
156
  tokens: number;
158
157
  bytes: number;
158
+ items: number;
159
159
  }>;
160
160
  sources: z.ZodArray<z.ZodObject<{
161
161
  id: z.ZodString;
@@ -172,13 +172,13 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
172
172
  amount: z.ZodNumber;
173
173
  provenance: z.ZodString;
174
174
  }, "strict", z.ZodTypeAny, {
175
- provenance: string;
176
175
  amount: number;
177
- unit: "items" | "tokens" | "bytes";
178
- }, {
179
176
  provenance: string;
177
+ unit: "tokens" | "bytes" | "items";
178
+ }, {
180
179
  amount: number;
181
- unit: "items" | "tokens" | "bytes";
180
+ provenance: string;
181
+ unit: "tokens" | "bytes" | "items";
182
182
  }>;
183
183
  reason: z.ZodNullable<z.ZodString>;
184
184
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -190,15 +190,15 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
190
190
  required: boolean;
191
191
  projectId: string;
192
192
  teamId: string;
193
- reason: string | null;
194
193
  metadata: Record<string, unknown>;
195
194
  measurement: {
196
- provenance: string;
197
195
  amount: number;
198
- unit: "items" | "tokens" | "bytes";
196
+ provenance: string;
197
+ unit: "tokens" | "bytes" | "items";
199
198
  };
200
- layer: "agent" | "live" | "core" | "tool" | "activity";
199
+ reason: string | null;
201
200
  disposition: "failed" | "included" | "summarized" | "omitted";
201
+ layer: "agent" | "live" | "activity" | "core" | "tool";
202
202
  }, {
203
203
  path: string | null;
204
204
  kind: string;
@@ -207,14 +207,14 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
207
207
  required: boolean;
208
208
  projectId: string;
209
209
  teamId: string;
210
- reason: string | null;
211
210
  measurement: {
212
- provenance: string;
213
211
  amount: number;
214
- unit: "items" | "tokens" | "bytes";
212
+ provenance: string;
213
+ unit: "tokens" | "bytes" | "items";
215
214
  };
216
- layer: "agent" | "live" | "core" | "tool" | "activity";
215
+ reason: string | null;
217
216
  disposition: "failed" | "included" | "summarized" | "omitted";
217
+ layer: "agent" | "live" | "activity" | "core" | "tool";
218
218
  metadata?: Record<string, unknown> | undefined;
219
219
  }>, "many">;
220
220
  digest: z.ZodString;
@@ -228,22 +228,22 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
228
228
  required: boolean;
229
229
  projectId: string;
230
230
  teamId: string;
231
- reason: string | null;
232
231
  metadata: Record<string, unknown>;
233
232
  measurement: {
234
- provenance: string;
235
233
  amount: number;
236
- unit: "items" | "tokens" | "bytes";
234
+ provenance: string;
235
+ unit: "tokens" | "bytes" | "items";
237
236
  };
238
- layer: "agent" | "live" | "core" | "tool" | "activity";
237
+ reason: string | null;
239
238
  disposition: "failed" | "included" | "summarized" | "omitted";
239
+ layer: "agent" | "live" | "activity" | "core" | "tool";
240
240
  }[];
241
241
  digest: string;
242
242
  assignmentId: string;
243
243
  capacity: {
244
244
  maximum: number | null;
245
245
  mode: "bounded" | "unbounded";
246
- measurement: "items" | "tokens" | "bytes" | null;
246
+ measurement: "tokens" | "bytes" | "items" | null;
247
247
  defaultInitial: number | null;
248
248
  reservedOutput: number | null;
249
249
  transportPayloadBytes: number;
@@ -254,9 +254,9 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
254
254
  };
255
255
  };
256
256
  totals: {
257
- items: number;
258
257
  tokens: number;
259
258
  bytes: number;
259
+ items: number;
260
260
  };
261
261
  }, {
262
262
  schemaVersion: "treeseed.assignment-context-pack/v1";
@@ -268,14 +268,14 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
268
268
  required: boolean;
269
269
  projectId: string;
270
270
  teamId: string;
271
- reason: string | null;
272
271
  measurement: {
273
- provenance: string;
274
272
  amount: number;
275
- unit: "items" | "tokens" | "bytes";
273
+ provenance: string;
274
+ unit: "tokens" | "bytes" | "items";
276
275
  };
277
- layer: "agent" | "live" | "core" | "tool" | "activity";
276
+ reason: string | null;
278
277
  disposition: "failed" | "included" | "summarized" | "omitted";
278
+ layer: "agent" | "live" | "activity" | "core" | "tool";
279
279
  metadata?: Record<string, unknown> | undefined;
280
280
  }[];
281
281
  digest: string;
@@ -283,7 +283,7 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
283
283
  capacity: {
284
284
  maximum: number | null;
285
285
  mode: "bounded" | "unbounded";
286
- measurement: "items" | "tokens" | "bytes" | null;
286
+ measurement: "tokens" | "bytes" | "items" | 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;
298
297
  tokens: number;
299
298
  bytes: number;
299
+ items: number;
300
300
  };
301
301
  }>;
302
302
  export type ContextSourceSelector = z.infer<typeof contextSourceSelectorSchema>;
@@ -2,8 +2,7 @@ export type AgentExecutionMode = 'planning' | 'acting';
2
2
  import type { AgentWorkExecutionMode } from '../../support/authority/execution-mode.js';
3
3
  export type ProviderAssignmentStatus = 'pending' | 'leased' | 'running' | 'completed' | 'failed' | 'returned' | 'expired' | 'cancelled';
4
4
  export type ProviderAssignmentLeaseState = 'unleased' | 'leased' | 'released' | 'expired';
5
- export type AgentModeRunStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
6
- export type ProviderAssignmentSynthesisSource = 'approved_decision' | 'planning_input_request' | 'capacity_plan' | 'living_execution_graph' | 'workday_demand' | 'verification_failure' | 'fallback_queue';
5
+ export type ProviderAssignmentSynthesisSource = 'living_execution_graph';
7
6
  export declare const AGENT_ASSIGNMENT_WORKSPACE_ACCESS_MODES: readonly ["context_only", "workspace_write", "brokered_workspace", "full_workspace_no_credentials", "trusted_direct"];
8
7
  export type AgentAssignmentWorkspaceAccessMode = (typeof AGENT_ASSIGNMENT_WORKSPACE_ACCESS_MODES)[number];
9
8
  export type AgentAssignmentCapabilityHandleKind = 'repository_access' | 'treedx_workspace' | 'workflow_operation' | 'secret_use';
@@ -14,7 +13,6 @@ export interface WorkdayCapacityEnvelope {
14
13
  workDayId?: string | null;
15
14
  environment?: string | null;
16
15
  executionMode?: AgentWorkExecutionMode;
17
- allocationSetId?: string | null;
18
16
  availableSeconds?: number | null;
19
17
  requestedSeconds?: number | null;
20
18
  reservedSeconds?: number | null;
@@ -35,23 +33,6 @@ export interface AgentCapacityEnvelope extends WorkdayCapacityEnvelope {
35
33
  reservedNativeAmount?: number | null;
36
34
  limits?: Record<string, unknown>;
37
35
  }
38
- export interface DecisionExecutionInput {
39
- teamId: string;
40
- projectId: string;
41
- projectAgentClassId: string;
42
- mode: AgentExecutionMode;
43
- executionMode?: AgentWorkExecutionMode;
44
- activityType?: import('../../../../types/agents.js').AgentActivityType;
45
- workGraphNodeId?: string | null;
46
- estimateId?: string | null;
47
- taskId?: string | null;
48
- workDayId?: string | null;
49
- agentId?: string | null;
50
- handlerId?: string | null;
51
- capacity: AgentCapacityEnvelope;
52
- input: Record<string, unknown>;
53
- metadata?: Record<string, unknown>;
54
- }
55
36
  export interface TreeDxProxyHandle {
56
37
  id: string;
57
38
  teamId: string;
@@ -166,7 +147,6 @@ export interface ProviderAssignment {
166
147
  handoffParentId?: string | null;
167
148
  handoffDepth?: number;
168
149
  sourceMessageRefs?: string[];
169
- allocationSetId: string | null;
170
150
  projectAgentClassId: string;
171
151
  reservationId: string | null;
172
152
  workDayId: string | null;
@@ -182,7 +162,6 @@ export interface ProviderAssignment {
182
162
  agentId: string | null;
183
163
  handlerId: string | null;
184
164
  capacityEnvelope: AgentCapacityEnvelope;
185
- decisionInput: DecisionExecutionInput | Record<string, unknown>;
186
165
  workspaceContext: Record<string, unknown>;
187
166
  allowedOutputs: Record<string, unknown>;
188
167
  explanation: Record<string, unknown>;
@@ -227,7 +206,6 @@ export interface ProviderAssignmentLifecycleRequest {
227
206
  output?: Record<string, unknown> | null;
228
207
  summary?: Record<string, unknown> | null;
229
208
  fallbackOutput?: Record<string, unknown> | null;
230
- modeRunId?: string | null;
231
209
  metadata?: Record<string, unknown>;
232
210
  completion?: import('../../support/time-capacity.js').AssignmentCompletionEvidence | null;
233
211
  performance?: import('../../support/time-capacity.js').AssignmentPerformanceSummary | null;
@@ -251,39 +229,3 @@ export interface ProviderAssignmentLifecycleResult {
251
229
  diagnostics?: Record<string, unknown> | null;
252
230
  leaseDiagnostics?: Record<string, unknown> | null;
253
231
  }
254
- export interface AgentModeRunUsageSettlement {
255
- capacityUsageActualId: string | null;
256
- capacityLedgerEntryId: string | null;
257
- activeSeconds: number | null;
258
- elapsedSeconds: number | null;
259
- actualUsd: number | null;
260
- nativeUsage: Record<string, unknown> | null;
261
- metadata: Record<string, unknown>;
262
- }
263
- export interface AgentModeRun {
264
- id: string;
265
- teamId: string;
266
- projectId: string;
267
- providerAssignmentId: string;
268
- capacityProviderId: string;
269
- executionProviderId: string | null;
270
- projectAgentClassId: string;
271
- agentId: string | null;
272
- handlerId: string | null;
273
- mode: AgentExecutionMode;
274
- executionMode?: AgentWorkExecutionMode;
275
- status: AgentModeRunStatus;
276
- selectedInput: Record<string, unknown>;
277
- capacityEnvelope: AgentCapacityEnvelope;
278
- outputs: Record<string, unknown>;
279
- traceRefs: Record<string, unknown>;
280
- usageActual: AgentModeRunUsageSettlement | Record<string, unknown>;
281
- validation: Record<string, unknown>;
282
- fallbackReason: string | null;
283
- startedAt: string | null;
284
- completedAt: string | null;
285
- failedAt: string | null;
286
- metadata: Record<string, unknown>;
287
- createdAt: string;
288
- updatedAt: string;
289
- }
@@ -24,7 +24,7 @@ export declare function allocateWorkdayCapacity(input: {
24
24
  }): {
25
25
  [k: string]: {
26
26
  shareSeconds: number;
27
- phase: "planning" | "ended" | "acting";
27
+ phase: "planning" | "acting" | "ended";
28
28
  phaseRemainingSeconds: number;
29
29
  weight: number;
30
30
  committedSeconds: number;
@@ -95,7 +95,7 @@ function calculateAssignmentAllocation(input) {
95
95
  for (const entry of constraints) nonnegative(entry.remainingSeconds);
96
96
  constraints.sort((a, b) => a.remainingSeconds - b.remainingSeconds || a.id.localeCompare(b.id));
97
97
  const availableSeconds = Math.floor(constraints[0].remainingSeconds);
98
- const desiredSeconds = input.planningTurnMaximumSeconds ?? calibration.seconds;
98
+ const desiredSeconds = calibration.seconds;
99
99
  const allocatedSeconds = Math.min(Math.max(minimumSeconds, desiredSeconds), availableSeconds);
100
100
  return {
101
101
  admitted: availableSeconds >= minimumSeconds,
@@ -10,12 +10,12 @@ export declare const workdayPolicySchema: z.ZodObject<{
10
10
  projectPercentages: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
11
11
  agentClassPercentages: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>>;
12
12
  }, "strict", z.ZodTypeAny, {
13
+ durationSeconds: number;
13
14
  planningPercent: number;
14
15
  allocationWeight: number;
15
16
  planningTurnMaximumSeconds: number;
16
17
  projectPercentages: Record<string, number>;
17
18
  agentClassPercentages: Record<string, Record<string, number>>;
18
- durationSeconds: number;
19
19
  maximumConcurrency: number;
20
20
  communicationConcurrency: number;
21
21
  }, {
@@ -49,12 +49,12 @@ export declare const workdayAllocationOverridesSchema: z.ZodObject<{
49
49
  }>;
50
50
  /** One canonical default; team-owned overrides use this same policy contract. */
51
51
  export declare const DEFAULT_WORKDAY_POLICY: Readonly<{
52
+ durationSeconds: number;
52
53
  planningPercent: number;
53
54
  allocationWeight: number;
54
55
  planningTurnMaximumSeconds: number;
55
56
  projectPercentages: Record<string, number>;
56
57
  agentClassPercentages: Record<string, Record<string, number>>;
57
- durationSeconds: number;
58
58
  maximumConcurrency: number;
59
59
  communicationConcurrency: number;
60
60
  }>;
@@ -72,12 +72,12 @@ export declare const workdayProfileSchema: z.ZodObject<{
72
72
  projectPercentages: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
73
73
  agentClassPercentages: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>>;
74
74
  }, "strict", z.ZodTypeAny, {
75
+ durationSeconds: number;
75
76
  planningPercent: number;
76
77
  allocationWeight: number;
77
78
  planningTurnMaximumSeconds: number;
78
79
  projectPercentages: Record<string, number>;
79
80
  agentClassPercentages: Record<string, Record<string, number>>;
80
- durationSeconds: number;
81
81
  maximumConcurrency: number;
82
82
  communicationConcurrency: number;
83
83
  }, {
@@ -95,12 +95,12 @@ export declare const workdayProfileSchema: z.ZodObject<{
95
95
  teamId: string;
96
96
  revision: number;
97
97
  policy: {
98
+ durationSeconds: number;
98
99
  planningPercent: number;
99
100
  allocationWeight: number;
100
101
  planningTurnMaximumSeconds: number;
101
102
  projectPercentages: Record<string, number>;
102
103
  agentClassPercentages: Record<string, Record<string, number>>;
103
- durationSeconds: number;
104
104
  maximumConcurrency: number;
105
105
  communicationConcurrency: number;
106
106
  };
@@ -137,12 +137,12 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
137
137
  projectPercentages: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
138
138
  agentClassPercentages: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>>;
139
139
  }, "strict", z.ZodTypeAny, {
140
+ durationSeconds: number;
140
141
  planningPercent: number;
141
142
  allocationWeight: number;
142
143
  planningTurnMaximumSeconds: number;
143
144
  projectPercentages: Record<string, number>;
144
145
  agentClassPercentages: Record<string, Record<string, number>>;
145
- durationSeconds: number;
146
146
  maximumConcurrency: number;
147
147
  communicationConcurrency: number;
148
148
  }, {
@@ -168,14 +168,14 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
168
168
  state: "active" | "pending" | "complete";
169
169
  round: number;
170
170
  assignmentIds: string[];
171
- completedAt?: string | undefined;
172
171
  startedAt?: string | undefined;
172
+ completedAt?: string | undefined;
173
173
  }, {
174
174
  state: "active" | "pending" | "complete";
175
175
  round: number;
176
176
  assignmentIds: string[];
177
- completedAt?: string | undefined;
178
177
  startedAt?: string | undefined;
178
+ completedAt?: string | undefined;
179
179
  }>, "many">;
180
180
  admittedSecondsByProject: z.ZodRecord<z.ZodString, z.ZodNumber>;
181
181
  admittedSecondsByAgentClass: z.ZodRecord<z.ZodString, z.ZodNumber>;
@@ -187,18 +187,18 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
187
187
  state: "active" | "planned" | "closing" | "ended";
188
188
  schemaVersion: "treeseed.workday/v1";
189
189
  teamId: string;
190
- executionMode: "production" | "simulation";
190
+ executionMode: "simulation" | "production";
191
191
  startsAt: string;
192
192
  endsAt: string;
193
193
  policyId: string;
194
194
  policyRevision: number;
195
195
  policySnapshot: {
196
+ durationSeconds: number;
196
197
  planningPercent: number;
197
198
  allocationWeight: number;
198
199
  planningTurnMaximumSeconds: number;
199
200
  projectPercentages: Record<string, number>;
200
201
  agentClassPercentages: Record<string, Record<string, number>>;
201
- durationSeconds: number;
202
202
  maximumConcurrency: number;
203
203
  communicationConcurrency: number;
204
204
  };
@@ -206,20 +206,20 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
206
206
  state: "active" | "pending" | "complete";
207
207
  round: number;
208
208
  assignmentIds: string[];
209
- completedAt?: string | undefined;
210
209
  startedAt?: string | undefined;
210
+ completedAt?: string | undefined;
211
211
  }[];
212
212
  admittedSecondsByProject: Record<string, number>;
213
213
  admittedSecondsByAgentClass: Record<string, number>;
214
+ endedAt?: string | undefined;
214
215
  activatedAt?: string | undefined;
215
216
  closingAt?: string | undefined;
216
- endedAt?: string | undefined;
217
217
  }, {
218
218
  id: string;
219
219
  state: "active" | "planned" | "closing" | "ended";
220
220
  schemaVersion: "treeseed.workday/v1";
221
221
  teamId: string;
222
- executionMode: "production" | "simulation";
222
+ executionMode: "simulation" | "production";
223
223
  startsAt: string;
224
224
  endsAt: string;
225
225
  policyId: string;
@@ -238,20 +238,19 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
238
238
  state: "active" | "pending" | "complete";
239
239
  round: number;
240
240
  assignmentIds: string[];
241
- completedAt?: string | undefined;
242
241
  startedAt?: string | undefined;
242
+ completedAt?: string | undefined;
243
243
  }[];
244
244
  admittedSecondsByProject: Record<string, number>;
245
245
  admittedSecondsByAgentClass: Record<string, number>;
246
+ endedAt?: string | undefined;
246
247
  activatedAt?: string | undefined;
247
248
  closingAt?: string | undefined;
248
- endedAt?: string | undefined;
249
249
  }>;
250
250
  export interface FairReadyNode {
251
251
  id: string;
252
252
  projectId: string;
253
253
  agentClass: string;
254
- graphPriority: number;
255
254
  readyAt: string;
256
255
  }
257
256
  export interface FairUsage {
@@ -271,7 +270,6 @@ export declare function selectFairReadyNode(nodes: FairReadyNode[], usage: FairU
271
270
  id: string;
272
271
  projectId: string;
273
272
  agentClass: string;
274
- graphPriority: number;
275
273
  readyAt: string;
276
274
  } | null;
277
275
  export declare function compilePlanningRounds(workdayId: string, agentIds: string[], planningTurnMaximumSeconds: number, round?: number): {
@@ -299,18 +297,18 @@ export declare function compileWorkday(input: {
299
297
  state: "active" | "planned" | "closing" | "ended";
300
298
  schemaVersion: "treeseed.workday/v1";
301
299
  teamId: string;
302
- executionMode: "production" | "simulation";
300
+ executionMode: "simulation" | "production";
303
301
  startsAt: string;
304
302
  endsAt: string;
305
303
  policyId: string;
306
304
  policyRevision: number;
307
305
  policySnapshot: {
306
+ durationSeconds: number;
308
307
  planningPercent: number;
309
308
  allocationWeight: number;
310
309
  planningTurnMaximumSeconds: number;
311
310
  projectPercentages: Record<string, number>;
312
311
  agentClassPercentages: Record<string, Record<string, number>>;
313
- durationSeconds: number;
314
312
  maximumConcurrency: number;
315
313
  communicationConcurrency: number;
316
314
  };
@@ -318,14 +316,14 @@ export declare function compileWorkday(input: {
318
316
  state: "active" | "pending" | "complete";
319
317
  round: number;
320
318
  assignmentIds: string[];
321
- completedAt?: string | undefined;
322
319
  startedAt?: string | undefined;
320
+ completedAt?: string | undefined;
323
321
  }[];
324
322
  admittedSecondsByProject: Record<string, number>;
325
323
  admittedSecondsByAgentClass: Record<string, number>;
324
+ endedAt?: string | undefined;
326
325
  activatedAt?: string | undefined;
327
326
  closingAt?: string | undefined;
328
- endedAt?: string | undefined;
329
327
  };
330
328
  export type WorkdayPolicy = z.infer<typeof workdayPolicySchema>;
331
329
  export type AppliedWorkday = z.infer<typeof appliedWorkdaySchema>;
@@ -75,7 +75,7 @@ function selectFairReadyNode(nodes, usage, policy) {
75
75
  const classWeights = Object.fromEntries([...new Set(projectNodes.map((node) => node.agentClass))].map((agentClass) => [agentClass, policy.agentClassPercentages[projectId]?.[agentClass] ?? 1]));
76
76
  const projectClassActual = new Map([...classActual].filter(([key]) => key.startsWith(`${projectId}:`)).map(([key, value]) => [key.slice(projectId.length + 1), value]));
77
77
  const classes = [...new Set(projectNodes.map((node) => node.agentClass))].sort((left, right) => shareDebt(right, classWeights, projectClassActual) - shareDebt(left, classWeights, projectClassActual) || left.localeCompare(right));
78
- const selected = projectNodes.filter((node) => node.agentClass === classes[0]).sort((left, right) => right.graphPriority - left.graphPriority || Date.parse(left.readyAt) - Date.parse(right.readyAt) || left.id.localeCompare(right.id))[0] ?? null;
78
+ const selected = projectNodes.filter((node) => node.agentClass === classes[0]).sort((left, right) => Date.parse(left.readyAt) - Date.parse(right.readyAt) || left.id.localeCompare(right.id))[0] ?? null;
79
79
  return selected ? { ...selected, explanation: {
80
80
  projectTargetPercent: 100 * projectWeights[projectId] / Object.values(projectWeights).reduce((sum, weight) => sum + weight, 0),
81
81
  projectDeficitSeconds: shareDebt(projectId, projectWeights, projectActual),