@treeseed/sdk 0.13.0-rc.122 → 0.13.0-rc.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +1392 -974
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +72 -27
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +34 -34
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.d.ts +2 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.js +13 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +1 -0
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +126 -1
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +35 -1
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +1 -3
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +21 -15
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +3 -42
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +8 -8
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +227 -66
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +54 -19
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +214 -5
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +47 -47
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -0
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +434 -230
- package/dist/agent-capacity/contracts/support/execution-graph.js +20 -18
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +2 -0
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +286 -254
- package/dist/agent-capacity/validation/agent-definition-schema.js +22 -28
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +1 -1
- package/dist/agent-capacity/validation/assignment-records.js +45 -0
- package/dist/capacity/agents/agent-capacity.d.ts +1 -0
- package/dist/capacity/agents/agent-capacity.js +1 -0
- package/dist/capacity-provider/capability-ontology.d.ts +102 -102
- package/dist/capacity-provider/client.d.ts +14 -7
- package/dist/capacity-provider/client.js +1 -4
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +0 -1
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +40 -40
- package/dist/capacity-provider/contracts/governance.d.ts +2 -17
- package/dist/capacity-provider/contracts/index.d.ts +2 -0
- package/dist/capacity-provider/contracts/index.js +2 -0
- package/dist/capacity-provider/core-capability-catalog.d.ts +7 -7
- package/dist/capacity-provider/environment-catalog.d.ts +22 -22
- package/dist/capacity-provider/environment-catalog.js +1 -1
- package/dist/capacity-provider/install-configuration.d.ts +4 -4
- package/dist/capacity-provider/sandbox-contracts.d.ts +54 -54
- package/dist/capacity-provider/source-workspace.d.ts +76 -76
- package/dist/capacity-provider/validation.d.ts +10 -2
- package/dist/capacity-provider/validation.js +52 -22
- package/dist/content/validation/agent-operational-content-schemas.d.ts +120 -118
- package/dist/content/validation/agent-operational-content-schemas.js +2 -0
- package/dist/content/validation/auxiliary-content-schemas.d.ts +92 -92
- package/dist/content/validation/content-model-schemas.d.ts +3155 -2512
- package/dist/content/validation/content-model-schemas.js +97 -87
- package/dist/content/validation/portable-content-data.d.ts +173 -168
- package/dist/content/validation/schema-constraints.d.ts +78 -0
- package/dist/content/validation/schema-constraints.js +149 -0
- package/dist/deployment/ai/storage.d.ts +20 -20
- package/dist/deployment/ai-hosting.d.ts +12 -12
- package/dist/deployment/ai-instance.d.ts +12 -12
- package/dist/deployment/ai-mode.d.ts +34 -34
- package/dist/deployment/hosted-topology-template.d.ts +25 -25
- package/dist/deployment/hosted-topology.d.ts +146 -146
- package/dist/deployment/postgres/transfer.d.ts +2 -2
- package/dist/deployment/schemas.d.ts +504 -504
- package/dist/development/schemas.d.ts +325 -325
- package/dist/graph/context-query-contracts.js +1 -1
- package/dist/guarantees/index.d.ts +26 -2
- package/dist/identity/contracts.js +6 -1
- package/dist/operator-contracts/canonical-command-tree.js +22 -8
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +27 -27
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +25 -25
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +11 -9
- package/dist/operator-contracts/catalog/communication-operations.d.ts +108 -90
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +33 -33
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +27 -27
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +4 -4
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +2 -1
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +5 -5
- package/dist/operator-contracts/catalog/provider-environment-operations.d.ts +3 -3
- package/dist/operator-contracts/catalog/services/secret-operations.d.ts +16 -8
- package/dist/operator-contracts/catalog/services/secret-operations.js +2 -1
- package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +11 -11
- package/dist/operator-contracts/catalog/workdays/selection-commands.js +7 -6
- package/dist/operator-contracts/communication/contracts.d.ts +340 -198
- package/dist/operator-contracts/communication/contracts.js +6 -1
- package/dist/operator-contracts/control-plane-operation.d.ts +7 -0
- package/dist/operator-contracts/control-plane-operation.js +6 -0
- package/dist/operator-contracts/control-plane-operations.d.ts +469 -442
- package/dist/operator-contracts/control-plane-operations.js +26 -10
- package/dist/operator-contracts/inbox/contracts.d.ts +100 -100
- package/dist/operator-contracts/knowledge/contracts.d.ts +6 -6
- package/dist/operator-contracts/mcp.js +4 -3
- package/dist/operator-contracts/workday-lifecycle.d.ts +192 -2
- package/dist/operator-contracts/workday-lifecycle.js +108 -45
- package/dist/platform/agent-schema-verification.js +316 -33
- package/dist/platform/contracts.d.ts +72 -72
- package/dist/platform/schemas.d.ts +144 -36
- package/dist/platform/schemas.js +26 -0
- package/dist/platform/verification.js +4 -0
- package/dist/sdk-types/support/sdk-search-request.d.ts +2 -2
- package/dist/secrets-capability/secret-contracts.d.ts +2 -2
- package/dist/secrets-capability/shared-access.d.ts +1 -1
- package/dist/secrets-capability/shared-resources.d.ts +30 -30
- package/dist/security/encrypted-envelope.d.ts +6 -6
- package/dist/treedx/client.d.ts +4 -4
- package/dist/treedx/index.d.ts +1 -1
- package/dist/treedx/index.js +1 -0
- package/dist/treedx/types.d.ts +286 -0
- package/dist/treedx/types.js +44 -0
- package/dist/types/agents/agent-activity-profile.d.ts +1 -0
- package/guarantees/agent/golden/component-boundaries.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product-custody.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product.guarantee.yaml +12 -0
- package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +837 -0
- package/guarantees/agent/golden/scenes/product-custody.scene.yaml +53 -0
- package/guarantees/agent/golden/scenes/product.scene.yaml +8 -0
- package/guarantees/verifiers/golden.verifiers.yaml +1429 -0
- package/package.json +10 -5
- package/tests/acceptance/golden-product.test.ts +205 -0
- package/tests/acceptance/golden-product.ts +404 -0
- package/tests/acceptance/product/base-red.ts +73 -0
- package/tests/acceptance/product/documentation-examples.ts +68 -0
- package/tests/acceptance/product/intent-runtime.ts +145 -0
- package/tests/acceptance/product/release-output.ts +160 -0
- package/tests/acceptance/product/research-artifact.ts +87 -0
- package/tests/acceptance/product/research-revision.ts +82 -0
- package/tests/acceptance/product/research-source.ts +91 -0
- package/tests/acceptance/product/test-chain.ts +192 -0
- package/treeseed.package.yaml +147 -0
- package/dist/.treeseed-build-complete.json +0 -1
|
@@ -1,39 +1,60 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type AgentWorkExecutionMode } from '../../support/authority/execution-mode.js';
|
|
3
|
+
export declare const weightMapSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodNumber>, Record<string, number>, Record<string, number>>;
|
|
4
|
+
export declare const projectWeightSchema: z.ZodObject<{
|
|
5
|
+
projectId: z.ZodString;
|
|
6
|
+
weight: z.ZodNumber;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
projectId: string;
|
|
9
|
+
weight: number;
|
|
10
|
+
}, {
|
|
11
|
+
projectId: string;
|
|
12
|
+
weight: number;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const agentClassWeightSchema: z.ZodObject<{
|
|
15
|
+
agentClass: z.ZodString;
|
|
16
|
+
weight: z.ZodNumber;
|
|
17
|
+
}, "strict", z.ZodTypeAny, {
|
|
18
|
+
agentClass: string;
|
|
19
|
+
weight: number;
|
|
20
|
+
}, {
|
|
21
|
+
agentClass: string;
|
|
22
|
+
weight: number;
|
|
23
|
+
}>;
|
|
3
24
|
export declare const workdayPolicySchema: z.ZodObject<{
|
|
4
25
|
durationSeconds: z.ZodNumber;
|
|
5
26
|
maximumConcurrency: z.ZodNumber;
|
|
6
|
-
planningPercent: z.
|
|
7
|
-
allocationWeight: z.
|
|
8
|
-
planningTurnMaximumSeconds: z.
|
|
27
|
+
planningPercent: z.ZodNumber;
|
|
28
|
+
allocationWeight: z.ZodNumber;
|
|
29
|
+
planningTurnMaximumSeconds: z.ZodNumber;
|
|
9
30
|
communicationConcurrency: z.ZodNumber;
|
|
10
|
-
projectPercentages: z.
|
|
11
|
-
agentClassPercentages: z.
|
|
31
|
+
projectPercentages: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
32
|
+
agentClassPercentages: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
12
33
|
}, "strict", z.ZodTypeAny, {
|
|
13
34
|
durationSeconds: number;
|
|
35
|
+
maximumConcurrency: number;
|
|
14
36
|
planningPercent: number;
|
|
15
37
|
allocationWeight: number;
|
|
16
38
|
planningTurnMaximumSeconds: number;
|
|
39
|
+
communicationConcurrency: number;
|
|
17
40
|
projectPercentages: Record<string, number>;
|
|
18
41
|
agentClassPercentages: Record<string, Record<string, number>>;
|
|
19
|
-
maximumConcurrency: number;
|
|
20
|
-
communicationConcurrency: number;
|
|
21
42
|
}, {
|
|
22
43
|
durationSeconds: number;
|
|
23
44
|
maximumConcurrency: number;
|
|
45
|
+
planningPercent: number;
|
|
46
|
+
allocationWeight: number;
|
|
47
|
+
planningTurnMaximumSeconds: number;
|
|
24
48
|
communicationConcurrency: number;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
planningTurnMaximumSeconds?: number | undefined;
|
|
28
|
-
projectPercentages?: Record<string, number> | undefined;
|
|
29
|
-
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
49
|
+
projectPercentages: Record<string, number>;
|
|
50
|
+
agentClassPercentages: Record<string, Record<string, number>>;
|
|
30
51
|
}>;
|
|
31
52
|
export declare const workdayAllocationOverridesSchema: z.ZodObject<{
|
|
32
|
-
planningPercent: z.ZodOptional<z.
|
|
33
|
-
allocationWeight: z.ZodOptional<z.
|
|
34
|
-
planningTurnMaximumSeconds: z.ZodOptional<z.
|
|
35
|
-
projectPercentages: z.ZodOptional<z.
|
|
36
|
-
agentClassPercentages: z.ZodOptional<z.
|
|
53
|
+
planningPercent: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
allocationWeight: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
planningTurnMaximumSeconds: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
projectPercentages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
57
|
+
agentClassPercentages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>>;
|
|
37
58
|
}, "strict", z.ZodTypeAny, {
|
|
38
59
|
planningPercent?: number | undefined;
|
|
39
60
|
allocationWeight?: number | undefined;
|
|
@@ -50,13 +71,13 @@ export declare const workdayAllocationOverridesSchema: z.ZodObject<{
|
|
|
50
71
|
/** One canonical default; team-owned overrides use this same policy contract. */
|
|
51
72
|
export declare const DEFAULT_WORKDAY_POLICY: Readonly<{
|
|
52
73
|
durationSeconds: number;
|
|
74
|
+
maximumConcurrency: number;
|
|
53
75
|
planningPercent: number;
|
|
54
76
|
allocationWeight: number;
|
|
55
77
|
planningTurnMaximumSeconds: number;
|
|
78
|
+
communicationConcurrency: number;
|
|
56
79
|
projectPercentages: Record<string, number>;
|
|
57
80
|
agentClassPercentages: Record<string, Record<string, number>>;
|
|
58
|
-
maximumConcurrency: number;
|
|
59
|
-
communicationConcurrency: number;
|
|
60
81
|
}>;
|
|
61
82
|
export declare const workdayProfileSchema: z.ZodObject<{
|
|
62
83
|
id: z.ZodLiteral<"default">;
|
|
@@ -65,95 +86,96 @@ export declare const workdayProfileSchema: z.ZodObject<{
|
|
|
65
86
|
policy: z.ZodObject<{
|
|
66
87
|
durationSeconds: z.ZodNumber;
|
|
67
88
|
maximumConcurrency: z.ZodNumber;
|
|
68
|
-
planningPercent: z.
|
|
69
|
-
allocationWeight: z.
|
|
70
|
-
planningTurnMaximumSeconds: z.
|
|
89
|
+
planningPercent: z.ZodNumber;
|
|
90
|
+
allocationWeight: z.ZodNumber;
|
|
91
|
+
planningTurnMaximumSeconds: z.ZodNumber;
|
|
71
92
|
communicationConcurrency: z.ZodNumber;
|
|
72
|
-
projectPercentages: z.
|
|
73
|
-
agentClassPercentages: z.
|
|
93
|
+
projectPercentages: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
94
|
+
agentClassPercentages: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
74
95
|
}, "strict", z.ZodTypeAny, {
|
|
75
96
|
durationSeconds: number;
|
|
97
|
+
maximumConcurrency: number;
|
|
76
98
|
planningPercent: number;
|
|
77
99
|
allocationWeight: number;
|
|
78
100
|
planningTurnMaximumSeconds: number;
|
|
101
|
+
communicationConcurrency: number;
|
|
79
102
|
projectPercentages: Record<string, number>;
|
|
80
103
|
agentClassPercentages: Record<string, Record<string, number>>;
|
|
81
|
-
maximumConcurrency: number;
|
|
82
|
-
communicationConcurrency: number;
|
|
83
104
|
}, {
|
|
84
105
|
durationSeconds: number;
|
|
85
106
|
maximumConcurrency: number;
|
|
107
|
+
planningPercent: number;
|
|
108
|
+
allocationWeight: number;
|
|
109
|
+
planningTurnMaximumSeconds: number;
|
|
86
110
|
communicationConcurrency: number;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
planningTurnMaximumSeconds?: number | undefined;
|
|
90
|
-
projectPercentages?: Record<string, number> | undefined;
|
|
91
|
-
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
111
|
+
projectPercentages: Record<string, number>;
|
|
112
|
+
agentClassPercentages: Record<string, Record<string, number>>;
|
|
92
113
|
}>;
|
|
93
114
|
}, "strict", z.ZodTypeAny, {
|
|
94
115
|
id: "default";
|
|
95
|
-
teamId: string;
|
|
96
116
|
revision: number;
|
|
117
|
+
teamId: string;
|
|
97
118
|
policy: {
|
|
98
119
|
durationSeconds: number;
|
|
120
|
+
maximumConcurrency: number;
|
|
99
121
|
planningPercent: number;
|
|
100
122
|
allocationWeight: number;
|
|
101
123
|
planningTurnMaximumSeconds: number;
|
|
124
|
+
communicationConcurrency: number;
|
|
102
125
|
projectPercentages: Record<string, number>;
|
|
103
126
|
agentClassPercentages: Record<string, Record<string, number>>;
|
|
104
|
-
maximumConcurrency: number;
|
|
105
|
-
communicationConcurrency: number;
|
|
106
127
|
};
|
|
107
128
|
}, {
|
|
108
129
|
id: "default";
|
|
109
|
-
teamId: string;
|
|
110
130
|
revision: number;
|
|
131
|
+
teamId: string;
|
|
111
132
|
policy: {
|
|
112
133
|
durationSeconds: number;
|
|
113
134
|
maximumConcurrency: number;
|
|
135
|
+
planningPercent: number;
|
|
136
|
+
allocationWeight: number;
|
|
137
|
+
planningTurnMaximumSeconds: number;
|
|
114
138
|
communicationConcurrency: number;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
planningTurnMaximumSeconds?: number | undefined;
|
|
118
|
-
projectPercentages?: Record<string, number> | undefined;
|
|
119
|
-
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
139
|
+
projectPercentages: Record<string, number>;
|
|
140
|
+
agentClassPercentages: Record<string, Record<string, number>>;
|
|
120
141
|
};
|
|
121
142
|
}>;
|
|
122
143
|
export type WorkdayProfile = z.infer<typeof workdayProfileSchema>;
|
|
123
|
-
export declare const appliedWorkdaySchema: z.ZodObject<{
|
|
144
|
+
export declare const appliedWorkdaySchema: z.ZodEffects<z.ZodObject<{
|
|
124
145
|
schemaVersion: z.ZodLiteral<"treeseed.workday/v1">;
|
|
125
146
|
id: z.ZodString;
|
|
126
147
|
teamId: z.ZodString;
|
|
127
148
|
executionMode: z.ZodEnum<["simulation", "production"]>;
|
|
149
|
+
reportingAgentId: z.ZodOptional<z.ZodString>;
|
|
128
150
|
policyId: z.ZodString;
|
|
129
151
|
policyRevision: z.ZodNumber;
|
|
130
152
|
policySnapshot: z.ZodObject<{
|
|
131
153
|
durationSeconds: z.ZodNumber;
|
|
132
154
|
maximumConcurrency: z.ZodNumber;
|
|
133
|
-
planningPercent: z.
|
|
134
|
-
allocationWeight: z.
|
|
135
|
-
planningTurnMaximumSeconds: z.
|
|
155
|
+
planningPercent: z.ZodNumber;
|
|
156
|
+
allocationWeight: z.ZodNumber;
|
|
157
|
+
planningTurnMaximumSeconds: z.ZodNumber;
|
|
136
158
|
communicationConcurrency: z.ZodNumber;
|
|
137
|
-
projectPercentages: z.
|
|
138
|
-
agentClassPercentages: z.
|
|
159
|
+
projectPercentages: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
160
|
+
agentClassPercentages: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
139
161
|
}, "strict", z.ZodTypeAny, {
|
|
140
162
|
durationSeconds: number;
|
|
163
|
+
maximumConcurrency: number;
|
|
141
164
|
planningPercent: number;
|
|
142
165
|
allocationWeight: number;
|
|
143
166
|
planningTurnMaximumSeconds: number;
|
|
167
|
+
communicationConcurrency: number;
|
|
144
168
|
projectPercentages: Record<string, number>;
|
|
145
169
|
agentClassPercentages: Record<string, Record<string, number>>;
|
|
146
|
-
maximumConcurrency: number;
|
|
147
|
-
communicationConcurrency: number;
|
|
148
170
|
}, {
|
|
149
171
|
durationSeconds: number;
|
|
150
172
|
maximumConcurrency: number;
|
|
173
|
+
planningPercent: number;
|
|
174
|
+
allocationWeight: number;
|
|
175
|
+
planningTurnMaximumSeconds: number;
|
|
151
176
|
communicationConcurrency: number;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
planningTurnMaximumSeconds?: number | undefined;
|
|
155
|
-
projectPercentages?: Record<string, number> | undefined;
|
|
156
|
-
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
177
|
+
projectPercentages: Record<string, number>;
|
|
178
|
+
agentClassPercentages: Record<string, Record<string, number>>;
|
|
157
179
|
}>;
|
|
158
180
|
state: z.ZodEnum<["planned", "active", "closing", "ended"]>;
|
|
159
181
|
startsAt: z.ZodString;
|
|
@@ -161,7 +183,7 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
|
|
|
161
183
|
planningRounds: z.ZodArray<z.ZodObject<{
|
|
162
184
|
round: z.ZodNumber;
|
|
163
185
|
state: z.ZodEnum<["pending", "active", "complete"]>;
|
|
164
|
-
assignmentIds: z.ZodArray<z.ZodString, "many">;
|
|
186
|
+
assignmentIds: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
165
187
|
startedAt: z.ZodOptional<z.ZodString>;
|
|
166
188
|
completedAt: z.ZodOptional<z.ZodString>;
|
|
167
189
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -182,26 +204,130 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
|
|
|
182
204
|
activatedAt: z.ZodOptional<z.ZodString>;
|
|
183
205
|
closingAt: z.ZodOptional<z.ZodString>;
|
|
184
206
|
endedAt: z.ZodOptional<z.ZodString>;
|
|
207
|
+
reportRef: z.ZodOptional<z.ZodObject<{
|
|
208
|
+
kind: z.ZodLiteral<"treedx">;
|
|
209
|
+
projectId: z.ZodString;
|
|
210
|
+
repository: z.ZodString;
|
|
211
|
+
commit: z.ZodString;
|
|
212
|
+
path: z.ZodString;
|
|
213
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
214
|
+
}, "strict", z.ZodTypeAny, {
|
|
215
|
+
path: string;
|
|
216
|
+
kind: "treedx";
|
|
217
|
+
commit: string;
|
|
218
|
+
repository: string;
|
|
219
|
+
projectId: string;
|
|
220
|
+
workspaceId?: string | undefined;
|
|
221
|
+
}, {
|
|
222
|
+
path: string;
|
|
223
|
+
kind: "treedx";
|
|
224
|
+
commit: string;
|
|
225
|
+
repository: string;
|
|
226
|
+
projectId: string;
|
|
227
|
+
workspaceId?: string | undefined;
|
|
228
|
+
}>>;
|
|
185
229
|
}, "strict", z.ZodTypeAny, {
|
|
186
230
|
id: string;
|
|
187
231
|
state: "active" | "planned" | "closing" | "ended";
|
|
188
232
|
schemaVersion: "treeseed.workday/v1";
|
|
189
233
|
teamId: string;
|
|
190
234
|
executionMode: "simulation" | "production";
|
|
235
|
+
policyId: string;
|
|
236
|
+
policyRevision: number;
|
|
237
|
+
policySnapshot: {
|
|
238
|
+
durationSeconds: number;
|
|
239
|
+
maximumConcurrency: number;
|
|
240
|
+
planningPercent: number;
|
|
241
|
+
allocationWeight: number;
|
|
242
|
+
planningTurnMaximumSeconds: number;
|
|
243
|
+
communicationConcurrency: number;
|
|
244
|
+
projectPercentages: Record<string, number>;
|
|
245
|
+
agentClassPercentages: Record<string, Record<string, number>>;
|
|
246
|
+
};
|
|
191
247
|
startsAt: string;
|
|
192
248
|
endsAt: string;
|
|
249
|
+
planningRounds: {
|
|
250
|
+
state: "active" | "pending" | "complete";
|
|
251
|
+
round: number;
|
|
252
|
+
assignmentIds: string[];
|
|
253
|
+
startedAt?: string | undefined;
|
|
254
|
+
completedAt?: string | undefined;
|
|
255
|
+
}[];
|
|
256
|
+
admittedSecondsByProject: Record<string, number>;
|
|
257
|
+
admittedSecondsByAgentClass: Record<string, number>;
|
|
258
|
+
endedAt?: string | undefined;
|
|
259
|
+
reportingAgentId?: string | undefined;
|
|
260
|
+
activatedAt?: string | undefined;
|
|
261
|
+
closingAt?: string | undefined;
|
|
262
|
+
reportRef?: {
|
|
263
|
+
path: string;
|
|
264
|
+
kind: "treedx";
|
|
265
|
+
commit: string;
|
|
266
|
+
repository: string;
|
|
267
|
+
projectId: string;
|
|
268
|
+
workspaceId?: string | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
id: string;
|
|
272
|
+
state: "active" | "planned" | "closing" | "ended";
|
|
273
|
+
schemaVersion: "treeseed.workday/v1";
|
|
274
|
+
teamId: string;
|
|
275
|
+
executionMode: "simulation" | "production";
|
|
193
276
|
policyId: string;
|
|
194
277
|
policyRevision: number;
|
|
195
278
|
policySnapshot: {
|
|
196
279
|
durationSeconds: number;
|
|
280
|
+
maximumConcurrency: number;
|
|
197
281
|
planningPercent: number;
|
|
198
282
|
allocationWeight: number;
|
|
199
283
|
planningTurnMaximumSeconds: number;
|
|
284
|
+
communicationConcurrency: number;
|
|
200
285
|
projectPercentages: Record<string, number>;
|
|
201
286
|
agentClassPercentages: Record<string, Record<string, number>>;
|
|
287
|
+
};
|
|
288
|
+
startsAt: string;
|
|
289
|
+
endsAt: string;
|
|
290
|
+
planningRounds: {
|
|
291
|
+
state: "active" | "pending" | "complete";
|
|
292
|
+
round: number;
|
|
293
|
+
assignmentIds: string[];
|
|
294
|
+
startedAt?: string | undefined;
|
|
295
|
+
completedAt?: string | undefined;
|
|
296
|
+
}[];
|
|
297
|
+
admittedSecondsByProject: Record<string, number>;
|
|
298
|
+
admittedSecondsByAgentClass: Record<string, number>;
|
|
299
|
+
endedAt?: string | undefined;
|
|
300
|
+
reportingAgentId?: string | undefined;
|
|
301
|
+
activatedAt?: string | undefined;
|
|
302
|
+
closingAt?: string | undefined;
|
|
303
|
+
reportRef?: {
|
|
304
|
+
path: string;
|
|
305
|
+
kind: "treedx";
|
|
306
|
+
commit: string;
|
|
307
|
+
repository: string;
|
|
308
|
+
projectId: string;
|
|
309
|
+
workspaceId?: string | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
}>, {
|
|
312
|
+
id: string;
|
|
313
|
+
state: "active" | "planned" | "closing" | "ended";
|
|
314
|
+
schemaVersion: "treeseed.workday/v1";
|
|
315
|
+
teamId: string;
|
|
316
|
+
executionMode: "simulation" | "production";
|
|
317
|
+
policyId: string;
|
|
318
|
+
policyRevision: number;
|
|
319
|
+
policySnapshot: {
|
|
320
|
+
durationSeconds: number;
|
|
202
321
|
maximumConcurrency: number;
|
|
322
|
+
planningPercent: number;
|
|
323
|
+
allocationWeight: number;
|
|
324
|
+
planningTurnMaximumSeconds: number;
|
|
203
325
|
communicationConcurrency: number;
|
|
326
|
+
projectPercentages: Record<string, number>;
|
|
327
|
+
agentClassPercentages: Record<string, Record<string, number>>;
|
|
204
328
|
};
|
|
329
|
+
startsAt: string;
|
|
330
|
+
endsAt: string;
|
|
205
331
|
planningRounds: {
|
|
206
332
|
state: "active" | "pending" | "complete";
|
|
207
333
|
round: number;
|
|
@@ -212,28 +338,37 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
|
|
|
212
338
|
admittedSecondsByProject: Record<string, number>;
|
|
213
339
|
admittedSecondsByAgentClass: Record<string, number>;
|
|
214
340
|
endedAt?: string | undefined;
|
|
341
|
+
reportingAgentId?: string | undefined;
|
|
215
342
|
activatedAt?: string | undefined;
|
|
216
343
|
closingAt?: string | undefined;
|
|
344
|
+
reportRef?: {
|
|
345
|
+
path: string;
|
|
346
|
+
kind: "treedx";
|
|
347
|
+
commit: string;
|
|
348
|
+
repository: string;
|
|
349
|
+
projectId: string;
|
|
350
|
+
workspaceId?: string | undefined;
|
|
351
|
+
} | undefined;
|
|
217
352
|
}, {
|
|
218
353
|
id: string;
|
|
219
354
|
state: "active" | "planned" | "closing" | "ended";
|
|
220
355
|
schemaVersion: "treeseed.workday/v1";
|
|
221
356
|
teamId: string;
|
|
222
357
|
executionMode: "simulation" | "production";
|
|
223
|
-
startsAt: string;
|
|
224
|
-
endsAt: string;
|
|
225
358
|
policyId: string;
|
|
226
359
|
policyRevision: number;
|
|
227
360
|
policySnapshot: {
|
|
228
361
|
durationSeconds: number;
|
|
229
362
|
maximumConcurrency: number;
|
|
363
|
+
planningPercent: number;
|
|
364
|
+
allocationWeight: number;
|
|
365
|
+
planningTurnMaximumSeconds: number;
|
|
230
366
|
communicationConcurrency: number;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
planningTurnMaximumSeconds?: number | undefined;
|
|
234
|
-
projectPercentages?: Record<string, number> | undefined;
|
|
235
|
-
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
367
|
+
projectPercentages: Record<string, number>;
|
|
368
|
+
agentClassPercentages: Record<string, Record<string, number>>;
|
|
236
369
|
};
|
|
370
|
+
startsAt: string;
|
|
371
|
+
endsAt: string;
|
|
237
372
|
planningRounds: {
|
|
238
373
|
state: "active" | "pending" | "complete";
|
|
239
374
|
round: number;
|
|
@@ -244,11 +379,21 @@ export declare const appliedWorkdaySchema: z.ZodObject<{
|
|
|
244
379
|
admittedSecondsByProject: Record<string, number>;
|
|
245
380
|
admittedSecondsByAgentClass: Record<string, number>;
|
|
246
381
|
endedAt?: string | undefined;
|
|
382
|
+
reportingAgentId?: string | undefined;
|
|
247
383
|
activatedAt?: string | undefined;
|
|
248
384
|
closingAt?: string | undefined;
|
|
385
|
+
reportRef?: {
|
|
386
|
+
path: string;
|
|
387
|
+
kind: "treedx";
|
|
388
|
+
commit: string;
|
|
389
|
+
repository: string;
|
|
390
|
+
projectId: string;
|
|
391
|
+
workspaceId?: string | undefined;
|
|
392
|
+
} | undefined;
|
|
249
393
|
}>;
|
|
250
394
|
export interface FairReadyNode {
|
|
251
395
|
id: string;
|
|
396
|
+
priority?: number;
|
|
252
397
|
projectId: string;
|
|
253
398
|
agentClass: string;
|
|
254
399
|
readyAt: string;
|
|
@@ -260,6 +405,10 @@ export interface FairUsage {
|
|
|
260
405
|
}
|
|
261
406
|
/** Select work only; provider selection is a later hard-gated admission step. */
|
|
262
407
|
export declare function selectFairReadyNode(nodes: FairReadyNode[], usage: FairUsage[], policy: z.infer<typeof workdayPolicySchema>): {
|
|
408
|
+
input: {
|
|
409
|
+
nodes: FairReadyNode[];
|
|
410
|
+
usage: FairUsage[];
|
|
411
|
+
};
|
|
263
412
|
explanation: {
|
|
264
413
|
projectTargetPercent: number;
|
|
265
414
|
projectDeficitSeconds: number;
|
|
@@ -268,6 +417,7 @@ export declare function selectFairReadyNode(nodes: FairReadyNode[], usage: FairU
|
|
|
268
417
|
readyNodeCount: number;
|
|
269
418
|
};
|
|
270
419
|
id: string;
|
|
420
|
+
priority?: number;
|
|
271
421
|
projectId: string;
|
|
272
422
|
agentClass: string;
|
|
273
423
|
readyAt: string;
|
|
@@ -280,7 +430,8 @@ export declare function compilePlanningRounds(workdayId: string, agentIds: strin
|
|
|
280
430
|
dependsOn: string[];
|
|
281
431
|
}[];
|
|
282
432
|
export declare function workdayPlanningEndsAt(plan: Pick<AppliedWorkday, 'startsAt' | 'policySnapshot'>): string;
|
|
283
|
-
|
|
433
|
+
/** The percentage reserves an initial planning window; later phase choice follows live graph readiness. */
|
|
434
|
+
export declare function workdayPhase(plan: Pick<AppliedWorkday, 'startsAt' | 'endsAt' | 'policySnapshot'>, now: string, actingReady: boolean): 'planning' | 'acting' | 'ended';
|
|
284
435
|
/** Shared by read-only plan and mutating start; callers persist this exact value. */
|
|
285
436
|
export declare function compileWorkday(input: {
|
|
286
437
|
id: string;
|
|
@@ -292,26 +443,27 @@ export declare function compileWorkday(input: {
|
|
|
292
443
|
agentIds: string[];
|
|
293
444
|
startsAt: string;
|
|
294
445
|
activityTypes?: string[];
|
|
446
|
+
reportingAgentId?: string;
|
|
295
447
|
}): {
|
|
296
448
|
id: string;
|
|
297
449
|
state: "active" | "planned" | "closing" | "ended";
|
|
298
450
|
schemaVersion: "treeseed.workday/v1";
|
|
299
451
|
teamId: string;
|
|
300
452
|
executionMode: "simulation" | "production";
|
|
301
|
-
startsAt: string;
|
|
302
|
-
endsAt: string;
|
|
303
453
|
policyId: string;
|
|
304
454
|
policyRevision: number;
|
|
305
455
|
policySnapshot: {
|
|
306
456
|
durationSeconds: number;
|
|
457
|
+
maximumConcurrency: number;
|
|
307
458
|
planningPercent: number;
|
|
308
459
|
allocationWeight: number;
|
|
309
460
|
planningTurnMaximumSeconds: number;
|
|
461
|
+
communicationConcurrency: number;
|
|
310
462
|
projectPercentages: Record<string, number>;
|
|
311
463
|
agentClassPercentages: Record<string, Record<string, number>>;
|
|
312
|
-
maximumConcurrency: number;
|
|
313
|
-
communicationConcurrency: number;
|
|
314
464
|
};
|
|
465
|
+
startsAt: string;
|
|
466
|
+
endsAt: string;
|
|
315
467
|
planningRounds: {
|
|
316
468
|
state: "active" | "pending" | "complete";
|
|
317
469
|
round: number;
|
|
@@ -322,8 +474,17 @@ export declare function compileWorkday(input: {
|
|
|
322
474
|
admittedSecondsByProject: Record<string, number>;
|
|
323
475
|
admittedSecondsByAgentClass: Record<string, number>;
|
|
324
476
|
endedAt?: string | undefined;
|
|
477
|
+
reportingAgentId?: string | undefined;
|
|
325
478
|
activatedAt?: string | undefined;
|
|
326
479
|
closingAt?: string | undefined;
|
|
480
|
+
reportRef?: {
|
|
481
|
+
path: string;
|
|
482
|
+
kind: "treedx";
|
|
483
|
+
commit: string;
|
|
484
|
+
repository: string;
|
|
485
|
+
projectId: string;
|
|
486
|
+
workspaceId?: string | undefined;
|
|
487
|
+
} | undefined;
|
|
327
488
|
};
|
|
328
489
|
export type WorkdayPolicy = z.infer<typeof workdayPolicySchema>;
|
|
329
490
|
export type AppliedWorkday = z.infer<typeof appliedWorkdaySchema>;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { conditionalFields, minimumProperties, uniqueArray } from "../../../../content/validation/schema-constraints.js";
|
|
2
3
|
import { AGENT_WORK_EXECUTION_MODES } from "../../support/authority/execution-mode.js";
|
|
4
|
+
import { assignmentReferenceSchema, leaseSchema } from "../assignments/agent-execution.js";
|
|
5
|
+
import { agentClassSchema } from "../../../validation/agent-definition-schema.js";
|
|
3
6
|
const identifier = z.string().trim().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u);
|
|
4
|
-
const positiveWeights = z.record(z.number().positive());
|
|
7
|
+
const positiveWeights = z.record(z.number().finite().positive());
|
|
8
|
+
const weightMapSchema = minimumProperties(z.record(z.number().int().positive()), 1, "At least one integer weight is required.");
|
|
9
|
+
const projectWeightSchema = z.object({ projectId: leaseSchema.shape.id, weight: z.number().int().positive() }).strict();
|
|
10
|
+
const agentClassWeightSchema = z.object({ agentClass: agentClassSchema, weight: z.number().int().positive() }).strict();
|
|
5
11
|
const workdayPolicySchema = z.object({
|
|
6
12
|
durationSeconds: z.number().int().positive(),
|
|
7
13
|
maximumConcurrency: z.number().int().positive(),
|
|
8
|
-
planningPercent: z.number().min(0).max(100)
|
|
9
|
-
allocationWeight: z.number().
|
|
10
|
-
planningTurnMaximumSeconds: z.number().int().positive()
|
|
14
|
+
planningPercent: z.number().min(0).max(100),
|
|
15
|
+
allocationWeight: z.number().finite().positive(),
|
|
16
|
+
planningTurnMaximumSeconds: z.number().int().positive(),
|
|
11
17
|
communicationConcurrency: z.number().int().positive(),
|
|
12
|
-
projectPercentages: positiveWeights
|
|
13
|
-
agentClassPercentages: z.record(positiveWeights)
|
|
18
|
+
projectPercentages: positiveWeights,
|
|
19
|
+
agentClassPercentages: z.record(positiveWeights)
|
|
14
20
|
}).strict();
|
|
15
21
|
const workdayAllocationOverridesSchema = workdayPolicySchema.pick({
|
|
16
22
|
planningPercent: true,
|
|
@@ -22,7 +28,12 @@ const workdayAllocationOverridesSchema = workdayPolicySchema.pick({
|
|
|
22
28
|
const DEFAULT_WORKDAY_POLICY = Object.freeze(workdayPolicySchema.parse({
|
|
23
29
|
durationSeconds: 28800,
|
|
24
30
|
maximumConcurrency: 1,
|
|
25
|
-
communicationConcurrency: 1
|
|
31
|
+
communicationConcurrency: 1,
|
|
32
|
+
planningPercent: 20,
|
|
33
|
+
allocationWeight: 1,
|
|
34
|
+
planningTurnMaximumSeconds: 180,
|
|
35
|
+
projectPercentages: {},
|
|
36
|
+
agentClassPercentages: {}
|
|
26
37
|
}));
|
|
27
38
|
const workdayProfileSchema = z.object({
|
|
28
39
|
id: z.literal("default"),
|
|
@@ -30,11 +41,12 @@ const workdayProfileSchema = z.object({
|
|
|
30
41
|
revision: z.number().int().positive(),
|
|
31
42
|
policy: workdayPolicySchema
|
|
32
43
|
}).strict();
|
|
33
|
-
const appliedWorkdaySchema = z.object({
|
|
44
|
+
const appliedWorkdaySchema = conditionalFields(z.object({
|
|
34
45
|
schemaVersion: z.literal("treeseed.workday/v1"),
|
|
35
46
|
id: identifier,
|
|
36
47
|
teamId: identifier,
|
|
37
48
|
executionMode: z.enum(AGENT_WORK_EXECUTION_MODES),
|
|
49
|
+
reportingAgentId: identifier.optional(),
|
|
38
50
|
policyId: identifier,
|
|
39
51
|
policyRevision: z.number().int().positive(),
|
|
40
52
|
policySnapshot: workdayPolicySchema,
|
|
@@ -44,7 +56,7 @@ const appliedWorkdaySchema = z.object({
|
|
|
44
56
|
planningRounds: z.array(z.object({
|
|
45
57
|
round: z.number().int().positive(),
|
|
46
58
|
state: z.enum(["pending", "active", "complete"]),
|
|
47
|
-
assignmentIds: z.array(identifier),
|
|
59
|
+
assignmentIds: uniqueArray(z.array(identifier)),
|
|
48
60
|
startedAt: z.string().datetime({ offset: true }).optional(),
|
|
49
61
|
completedAt: z.string().datetime({ offset: true }).optional()
|
|
50
62
|
}).strict()),
|
|
@@ -52,16 +64,32 @@ const appliedWorkdaySchema = z.object({
|
|
|
52
64
|
admittedSecondsByAgentClass: z.record(z.number().int().nonnegative()),
|
|
53
65
|
activatedAt: z.string().datetime({ offset: true }).optional(),
|
|
54
66
|
closingAt: z.string().datetime({ offset: true }).optional(),
|
|
55
|
-
endedAt: z.string().datetime({ offset: true }).optional()
|
|
56
|
-
|
|
67
|
+
endedAt: z.string().datetime({ offset: true }).optional(),
|
|
68
|
+
reportRef: assignmentReferenceSchema.options[1].optional()
|
|
69
|
+
}).strict(), [{
|
|
70
|
+
field: "state",
|
|
71
|
+
equals: "ended",
|
|
72
|
+
alternatives: [["reportRef"]],
|
|
73
|
+
path: ["reportRef"],
|
|
74
|
+
message: "An ended workday requires its exact TreeDX closeout report."
|
|
75
|
+
}]);
|
|
76
|
+
function weightedAmount(amount, weight, weights) {
|
|
77
|
+
const values = Object.values(weights), total = values.reduce((sum, value) => sum + value, 0) || 1;
|
|
78
|
+
const product = amount * weight;
|
|
79
|
+
if (amount === 0) return 0;
|
|
80
|
+
const minimumNormal = 2 ** -1022;
|
|
81
|
+
if (Number.isFinite(total) && Number.isFinite(product) && total >= minimumNormal && Math.abs(product) >= minimumNormal) return product / total;
|
|
82
|
+
const scale = Math.max(...values);
|
|
83
|
+
return amount * (weight / scale) / values.reduce((sum, value) => sum + value / scale, 0);
|
|
84
|
+
}
|
|
57
85
|
function shareDebt(id, weights, actual) {
|
|
58
86
|
const weight = weights[id] ?? 1;
|
|
59
|
-
const totalWeight = Object.values(weights).reduce((sum, value) => sum + value, 0) || 1;
|
|
60
87
|
const totalActual = [...actual.values()].reduce((sum, value) => sum + value, 0);
|
|
61
|
-
return totalActual
|
|
88
|
+
return weightedAmount(totalActual, weight, weights) - (actual.get(id) ?? 0);
|
|
62
89
|
}
|
|
63
90
|
function selectFairReadyNode(nodes, usage, policy) {
|
|
64
91
|
if (!nodes.length) return null;
|
|
92
|
+
for (const node of nodes) if (node.priority !== void 0 && !Number.isSafeInteger(node.priority)) throw new Error("execution_node_priority_invalid");
|
|
65
93
|
const projectActual = /* @__PURE__ */ new Map();
|
|
66
94
|
const classActual = /* @__PURE__ */ new Map();
|
|
67
95
|
for (const entry of usage) {
|
|
@@ -75,11 +103,14 @@ function selectFairReadyNode(nodes, usage, policy) {
|
|
|
75
103
|
const classWeights = Object.fromEntries([...new Set(projectNodes.map((node) => node.agentClass))].map((agentClass) => [agentClass, policy.agentClassPercentages[projectId]?.[agentClass] ?? 1]));
|
|
76
104
|
const projectClassActual = new Map([...classActual].filter(([key]) => key.startsWith(`${projectId}:`)).map(([key, value]) => [key.slice(projectId.length + 1), value]));
|
|
77
105
|
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) => Date.parse(left.readyAt) - Date.parse(right.readyAt) || left.id.localeCompare(right.id))[0] ?? null;
|
|
79
|
-
return selected ? { ...selected,
|
|
80
|
-
|
|
106
|
+
const selected = projectNodes.filter((node) => node.agentClass === classes[0]).sort((left, right) => (right.priority ?? 0) - (left.priority ?? 0) || Date.parse(left.readyAt) - Date.parse(right.readyAt) || left.id.localeCompare(right.id))[0] ?? null;
|
|
107
|
+
return selected ? { ...selected, input: structuredClone({
|
|
108
|
+
nodes: [...nodes].sort((left, right) => left.id.localeCompare(right.id)),
|
|
109
|
+
usage: [...usage].sort((left, right) => left.projectId.localeCompare(right.projectId) || left.agentClass.localeCompare(right.agentClass) || left.seconds - right.seconds)
|
|
110
|
+
}), explanation: {
|
|
111
|
+
projectTargetPercent: weightedAmount(100, projectWeights[projectId], projectWeights),
|
|
81
112
|
projectDeficitSeconds: shareDebt(projectId, projectWeights, projectActual),
|
|
82
|
-
classTargetPercent: 100
|
|
113
|
+
classTargetPercent: weightedAmount(100, classWeights[selected.agentClass], classWeights),
|
|
83
114
|
classDeficitSeconds: shareDebt(selected.agentClass, classWeights, projectClassActual),
|
|
84
115
|
readyNodeCount: nodes.length
|
|
85
116
|
} } : null;
|
|
@@ -97,9 +128,9 @@ function compilePlanningRounds(workdayId, agentIds, planningTurnMaximumSeconds,
|
|
|
97
128
|
function workdayPlanningEndsAt(plan) {
|
|
98
129
|
return new Date(Date.parse(plan.startsAt) + plan.policySnapshot.durationSeconds * plan.policySnapshot.planningPercent * 10).toISOString();
|
|
99
130
|
}
|
|
100
|
-
function workdayPhase(plan, now) {
|
|
131
|
+
function workdayPhase(plan, now, actingReady) {
|
|
101
132
|
if (Date.parse(now) >= Date.parse(plan.endsAt)) return "ended";
|
|
102
|
-
return Date.parse(now) < Date.parse(workdayPlanningEndsAt(plan)) ? "planning" : "acting";
|
|
133
|
+
return Date.parse(now) < Date.parse(workdayPlanningEndsAt(plan)) || !actingReady ? "planning" : "acting";
|
|
103
134
|
}
|
|
104
135
|
function compileWorkday(input) {
|
|
105
136
|
const policy = workdayPolicySchema.parse(input.policy);
|
|
@@ -110,6 +141,7 @@ function compileWorkday(input) {
|
|
|
110
141
|
id: input.id,
|
|
111
142
|
teamId: input.teamId,
|
|
112
143
|
executionMode: input.executionMode,
|
|
144
|
+
...input.reportingAgentId === void 0 ? {} : { reportingAgentId: input.reportingAgentId },
|
|
113
145
|
policyId: input.policyId,
|
|
114
146
|
policyRevision: input.policyRevision,
|
|
115
147
|
policySnapshot: policy,
|
|
@@ -123,10 +155,13 @@ function compileWorkday(input) {
|
|
|
123
155
|
}
|
|
124
156
|
export {
|
|
125
157
|
DEFAULT_WORKDAY_POLICY,
|
|
158
|
+
agentClassWeightSchema,
|
|
126
159
|
appliedWorkdaySchema,
|
|
127
160
|
compilePlanningRounds,
|
|
128
161
|
compileWorkday,
|
|
162
|
+
projectWeightSchema,
|
|
129
163
|
selectFairReadyNode,
|
|
164
|
+
weightMapSchema,
|
|
130
165
|
workdayAllocationOverridesSchema,
|
|
131
166
|
workdayPhase,
|
|
132
167
|
workdayPlanningEndsAt,
|