@treeseed/sdk 0.13.0-rc.121 → 0.13.0-rc.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +2365 -1275
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +94 -28
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +38 -38
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.d.ts +2 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.js +13 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +2 -59
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +126 -1
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +35 -1
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +2 -4
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +22 -16
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +3 -42
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +8 -8
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +244 -85
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +54 -19
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +216 -70
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/configuration/configuration.d.ts +1 -1
- package/dist/agent-capacity/contracts/configuration/configuration.js +0 -2
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +55 -55
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -23
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +2 -154
- package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +0 -13
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +496 -292
- package/dist/agent-capacity/contracts/support/execution-graph.js +21 -19
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +3 -6
- package/dist/agent-capacity/contracts/support/planning-records.d.ts +1 -87
- package/dist/agent-capacity/grant.d.ts +34 -0
- package/dist/agent-capacity/grant.js +4 -0
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +1178 -1152
- package/dist/agent-capacity/validation/agent-definition-schema.js +21 -28
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +10 -10
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +0 -1
- package/dist/agent-capacity/validation/assignment-records.d.ts +1 -6
- package/dist/agent-capacity/validation/assignment-records.js +49 -35
- package/dist/agent-capacity/validation/configuration.d.ts +1 -1
- package/dist/agent-capacity/validation/configuration.js +2 -6
- package/dist/agent-capacity/validation/grant.d.ts +11 -0
- package/dist/agent-capacity/validation/grant.js +31 -0
- package/dist/capacity/agents/agent-capacity.d.ts +3 -4
- package/dist/capacity/agents/agent-capacity.js +2 -3
- package/dist/capacity-provider/capability-ontology.d.ts +150 -150
- package/dist/capacity-provider/client.d.ts +15 -9
- package/dist/capacity-provider/client.js +1 -10
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +0 -1
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +44 -44
- package/dist/capacity-provider/contracts/governance.d.ts +2 -17
- package/dist/capacity-provider/contracts/index.d.ts +2 -0
- package/dist/capacity-provider/contracts/index.js +2 -0
- package/dist/capacity-provider/core-capability-catalog.d.ts +7 -7
- package/dist/capacity-provider/environment-catalog.d.ts +188 -188
- package/dist/capacity-provider/environment-catalog.js +1 -1
- package/dist/capacity-provider/install-configuration.d.ts +2 -2
- package/dist/capacity-provider/sandbox-contracts.d.ts +92 -92
- package/dist/capacity-provider/source-workspace.d.ts +166 -68
- package/dist/capacity-provider/source-workspace.js +5 -1
- package/dist/capacity-provider/validation.d.ts +10 -2
- package/dist/capacity-provider/validation.js +52 -22
- package/dist/content/validation/agent-operational-content-schemas.d.ts +144 -142
- package/dist/content/validation/agent-operational-content-schemas.js +2 -0
- package/dist/content/validation/auxiliary-content-schemas.d.ts +158 -158
- package/dist/content/validation/content-model-schemas.d.ts +9105 -5295
- package/dist/content/validation/content-model-schemas.js +192 -115
- package/dist/content/validation/portable-content-data.d.ts +411 -238
- package/dist/content/validation/portable-content-data.js +6 -1
- package/dist/content/validation/schema-constraints.d.ts +78 -0
- package/dist/content/validation/schema-constraints.js +149 -0
- package/dist/deployment/ai/storage.d.ts +24 -24
- package/dist/deployment/ai-hosting.d.ts +18 -18
- package/dist/deployment/ai-instance.d.ts +16 -16
- package/dist/deployment/ai-mode.d.ts +92 -92
- package/dist/deployment/hosted-topology-template.d.ts +44 -44
- package/dist/deployment/hosted-topology.d.ts +335 -335
- package/dist/deployment/postgres/contracts.d.ts +52 -52
- package/dist/deployment/postgres/transfer.d.ts +6 -6
- package/dist/deployment/schemas.d.ts +1114 -1114
- package/dist/development/schemas.d.ts +633 -633
- package/dist/graph/context-query-contracts.js +1 -1
- package/dist/guarantees/index.d.ts +26 -2
- package/dist/identity/contracts.js +6 -1
- package/dist/knowledge/contracts.d.ts +9 -2
- package/dist/knowledge/contracts.js +2 -2
- package/dist/model-registry/discussion-models.js +0 -1
- package/dist/operator-contracts/canonical-command-tree.js +25 -9
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +29 -29
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +30 -30
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +15 -13
- package/dist/operator-contracts/catalog/communication-operations.d.ts +176 -158
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +67 -67
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +65 -65
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +6 -6
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +2 -1
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +10 -10
- package/dist/operator-contracts/catalog/provider-environment-operations.d.ts +3 -3
- package/dist/operator-contracts/catalog/services/secret-operations.d.ts +16 -8
- package/dist/operator-contracts/catalog/services/secret-operations.js +2 -1
- package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +11 -11
- package/dist/operator-contracts/catalog/workdays/selection-commands.js +3 -0
- package/dist/operator-contracts/communication/contracts.d.ts +537 -395
- package/dist/operator-contracts/communication/contracts.js +6 -1
- package/dist/operator-contracts/control-plane-operation.d.ts +7 -0
- package/dist/operator-contracts/control-plane-operation.js +6 -0
- package/dist/operator-contracts/control-plane-operations.d.ts +631 -610
- package/dist/operator-contracts/control-plane-operations.js +26 -12
- package/dist/operator-contracts/inbox/contracts.d.ts +229 -229
- package/dist/operator-contracts/knowledge/contracts.d.ts +16 -16
- package/dist/operator-contracts/mcp.js +4 -3
- package/dist/operator-contracts/workday-lifecycle.d.ts +192 -0
- package/dist/operator-contracts/workday-lifecycle.js +109 -45
- package/dist/platform/agent-schema-verification.d.ts +3 -0
- package/dist/platform/agent-schema-verification.js +377 -0
- package/dist/platform/contracts.d.ts +72 -72
- package/dist/platform/schemas.d.ts +144 -36
- package/dist/platform/schemas.js +26 -0
- package/dist/platform/verification.js +10 -0
- package/dist/sdk-types/support/planning-policy.d.ts +1 -1
- package/dist/sdk-types/support/sdk-search-request.d.ts +2 -2
- package/dist/secrets-capability/secret-contracts.d.ts +2 -2
- package/dist/secrets-capability/shared-access.d.ts +3 -3
- package/dist/secrets-capability/shared-resources.d.ts +50 -50
- package/dist/secrets-capability/vault-contracts.d.ts +2 -2
- package/dist/security/encrypted-envelope.d.ts +14 -14
- package/dist/treedx/client.d.ts +4 -4
- package/dist/treedx/index.d.ts +1 -1
- package/dist/treedx/index.js +1 -0
- package/dist/treedx/types.d.ts +286 -0
- package/dist/treedx/types.js +44 -0
- package/guarantees/agent/golden/component-boundaries.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product-custody.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product.guarantee.yaml +12 -0
- package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +837 -0
- package/guarantees/agent/golden/scenes/product-custody.scene.yaml +53 -0
- package/guarantees/agent/golden/scenes/product.scene.yaml +8 -0
- package/guarantees/verifiers/golden.verifiers.yaml +1429 -0
- package/package.json +9 -3
- package/tests/acceptance/golden-product.test.ts +205 -0
- package/tests/acceptance/golden-product.ts +404 -0
- package/tests/acceptance/product/base-red.ts +73 -0
- package/tests/acceptance/product/documentation-examples.ts +68 -0
- package/tests/acceptance/product/intent-runtime.ts +145 -0
- package/tests/acceptance/product/release-output.ts +160 -0
- package/tests/acceptance/product/research-artifact.ts +87 -0
- package/tests/acceptance/product/research-revision.ts +82 -0
- package/tests/acceptance/product/research-source.ts +91 -0
- package/tests/acceptance/product/test-chain.ts +192 -0
- package/treeseed.package.yaml +147 -0
- package/dist/.treeseed-build-complete.json +0 -1
- package/dist/agent-capacity/allocation.d.ts +0 -183
- package/dist/agent-capacity/allocation.js +0 -5
- package/dist/agent-capacity/artifact-mutation-receipt.d.ts +0 -49
- package/dist/agent-capacity/artifact-mutation-receipt.js +0 -36
- package/dist/agent-capacity/artifacts.d.ts +0 -123
- package/dist/agent-capacity/artifacts.js +0 -39
- package/dist/agent-capacity/contracts/support/decision-work.d.ts +0 -227
- package/dist/agent-capacity/contracts/support/decision-work.js +0 -0
- package/dist/agent-capacity/validation/allocation.d.ts +0 -12
- package/dist/agent-capacity/validation/allocation.js +0 -115
|
@@ -1,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,11 +20,12 @@ 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]: {
|
|
26
27
|
shareSeconds: number;
|
|
27
|
-
phase: "planning" | "
|
|
28
|
+
phase: "planning" | "acting" | "ended";
|
|
28
29
|
phaseRemainingSeconds: number;
|
|
29
30
|
weight: number;
|
|
30
31
|
committedSeconds: number;
|
|
@@ -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;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { workdayPhase } from "./workday-allocation.js";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
function nonnegative(value) {
|
|
3
4
|
if (!Number.isFinite(value) || value < 0) throw new Error("allocation_amount_invalid");
|
|
4
5
|
return value;
|
|
@@ -41,10 +42,10 @@ function distributeAllocationSeconds(remainingSeconds, shares) {
|
|
|
41
42
|
}
|
|
42
43
|
function allocateWorkdayCapacity(input) {
|
|
43
44
|
if (!Number.isFinite(Date.parse(input.now))) throw new Error("allocation_time_invalid");
|
|
44
|
-
const shares = input.workdays.map(({ plan, committedSeconds, planningCommittedSeconds, maximumAdditionalSeconds }) => {
|
|
45
|
+
const shares = input.workdays.map(({ plan, committedSeconds, planningCommittedSeconds, maximumAdditionalSeconds, actingReady }) => {
|
|
45
46
|
nonnegative(planningCommittedSeconds);
|
|
46
47
|
if (planningCommittedSeconds > committedSeconds) throw new Error("allocation_planning_commitment_invalid");
|
|
47
|
-
const eligible = Date.parse(input.now) >= Date.parse(plan.startsAt) && (plan.state === "closing" || plan.state === "active" && workdayPhase(plan, input.now) !== "ended");
|
|
48
|
+
const eligible = Date.parse(input.now) >= Date.parse(plan.startsAt) && (plan.state === "closing" || plan.state === "active" && workdayPhase(plan, input.now, actingReady) !== "ended");
|
|
48
49
|
return {
|
|
49
50
|
id: plan.id,
|
|
50
51
|
weight: plan.policySnapshot.allocationWeight,
|
|
@@ -53,10 +54,10 @@ function allocateWorkdayCapacity(input) {
|
|
|
53
54
|
};
|
|
54
55
|
});
|
|
55
56
|
const opportunities = distributeAllocationSeconds(input.remainingSeconds, shares);
|
|
56
|
-
return Object.fromEntries(input.workdays.map(({ plan, committedSeconds, planningCommittedSeconds }) => {
|
|
57
|
+
return Object.fromEntries(input.workdays.map(({ plan, committedSeconds, planningCommittedSeconds, actingReady }) => {
|
|
57
58
|
const shareSeconds = opportunities[plan.id];
|
|
58
|
-
const phase = plan.state === "closing" ? "acting" : workdayPhase(plan, input.now);
|
|
59
|
-
const phaseRemainingSeconds =
|
|
59
|
+
const phase = plan.state === "closing" ? "acting" : workdayPhase(plan, input.now, actingReady);
|
|
60
|
+
const phaseRemainingSeconds = shareSeconds;
|
|
60
61
|
return [plan.id, {
|
|
61
62
|
shareSeconds,
|
|
62
63
|
phase,
|
|
@@ -72,19 +73,24 @@ function allocateWorkdayCapacity(input) {
|
|
|
72
73
|
}
|
|
73
74
|
function calibrateAssignmentSeconds(estimate, measurements) {
|
|
74
75
|
if (!Number.isFinite(estimate.expectedSeconds) || estimate.expectedSeconds <= 0 || !Number.isFinite(estimate.maximumSeconds) || estimate.maximumSeconds < estimate.expectedSeconds) throw new Error("allocation_estimate_invalid");
|
|
75
|
-
const
|
|
76
|
+
const eligibleHistory = measurements.filter((entry) => entry.outcome === "completed" || entry.outcome === "expired");
|
|
77
|
+
const ids = /* @__PURE__ */ new Set();
|
|
78
|
+
for (const entry of eligibleHistory) {
|
|
79
|
+
if (typeof entry.id !== "string" || !entry.id || entry.id !== entry.id.trim() || ids.has(entry.id) || !z.string().datetime({ offset: true }).safeParse(entry.completedAt).success || !Number.isFinite(entry.expectedSeconds) || entry.expectedSeconds <= 0 || !Number.isFinite(entry.allocatedSeconds) || entry.allocatedSeconds <= 0) throw new Error("allocation_measurement_invalid");
|
|
80
|
+
ids.add(entry.id);
|
|
81
|
+
nonnegative(entry.activeSeconds);
|
|
82
|
+
}
|
|
83
|
+
const eligible = eligibleHistory.sort((a, b) => Date.parse(a.completedAt) - Date.parse(b.completedAt) || a.id.localeCompare(b.id)).slice(-20);
|
|
76
84
|
let multiplier = estimate.maximumSeconds / estimate.expectedSeconds;
|
|
77
85
|
for (const entry of eligible) {
|
|
78
|
-
if (!Number.isFinite(Date.parse(entry.completedAt)) || !Number.isFinite(entry.expectedSeconds) || entry.expectedSeconds <= 0 || !Number.isFinite(entry.allocatedSeconds) || entry.allocatedSeconds <= 0) throw new Error("allocation_measurement_invalid");
|
|
79
|
-
nonnegative(entry.activeSeconds);
|
|
80
86
|
const ratio = entry.activeSeconds / entry.expectedSeconds;
|
|
81
|
-
|
|
87
|
+
const similarity = Math.min(estimate.expectedSeconds, entry.expectedSeconds) / Math.max(estimate.expectedSeconds, entry.expectedSeconds);
|
|
88
|
+
multiplier = entry.outcome === "expired" ? Math.max(multiplier * 1.25, entry.allocatedSeconds / entry.expectedSeconds * 1.25, ratio * 1.25) : Math.max(multiplier * (1 - 0.1 * similarity), ratio * 1.25);
|
|
82
89
|
}
|
|
83
90
|
return { seconds: Math.ceil(estimate.expectedSeconds * multiplier), multiplier, measurementIds: eligible.map((entry) => entry.id) };
|
|
84
91
|
}
|
|
85
92
|
function calculateAssignmentAllocation(input) {
|
|
86
93
|
const calibration = calibrateAssignmentSeconds(input.estimate, input.measurements);
|
|
87
|
-
const minimumSeconds = Math.max(1, nonnegative(input.estimate.minimumSeconds), nonnegative(input.providerMinimumSeconds ?? 1));
|
|
88
94
|
const constraints = [...input.constraints];
|
|
89
95
|
for (const [id, value] of [
|
|
90
96
|
["provider-maximum", input.providerMaximumSeconds],
|
|
@@ -95,15 +101,15 @@ function calculateAssignmentAllocation(input) {
|
|
|
95
101
|
for (const entry of constraints) nonnegative(entry.remainingSeconds);
|
|
96
102
|
constraints.sort((a, b) => a.remainingSeconds - b.remainingSeconds || a.id.localeCompare(b.id));
|
|
97
103
|
const availableSeconds = Math.floor(constraints[0].remainingSeconds);
|
|
98
|
-
const desiredSeconds =
|
|
99
|
-
const
|
|
104
|
+
const desiredSeconds = calibration.seconds;
|
|
105
|
+
const admitted = availableSeconds >= 1;
|
|
106
|
+
const allocatedSeconds = admitted ? Math.min(desiredSeconds, availableSeconds) : 0;
|
|
100
107
|
return {
|
|
101
|
-
admitted
|
|
102
|
-
allocatedSeconds
|
|
103
|
-
minimumSeconds,
|
|
108
|
+
admitted,
|
|
109
|
+
allocatedSeconds,
|
|
104
110
|
desiredSeconds,
|
|
105
111
|
calibration,
|
|
106
|
-
limitingConstraint: availableSeconds <
|
|
112
|
+
limitingConstraint: availableSeconds < desiredSeconds ? constraints[0].id : "task-duration",
|
|
107
113
|
constraints
|
|
108
114
|
};
|
|
109
115
|
}
|
|
@@ -3,97 +3,58 @@ import { z } from 'zod';
|
|
|
3
3
|
export declare const capabilityAccountingLimitsSchema: z.ZodObject<{
|
|
4
4
|
modelConfigurationId: z.ZodString;
|
|
5
5
|
dailyActiveSecondsLimit: z.ZodNumber;
|
|
6
|
-
capabilityLimits: z.ZodEffects<z.ZodRecord<z.ZodString, z.
|
|
6
|
+
capabilityLimits: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
7
7
|
dailyActiveSecondsLimit: z.ZodNumber;
|
|
8
|
-
minimumAssignmentSeconds: z.ZodOptional<z.ZodNumber>;
|
|
9
8
|
maximumAssignmentSeconds: z.ZodOptional<z.ZodNumber>;
|
|
10
9
|
}, "strict", z.ZodTypeAny, {
|
|
11
10
|
dailyActiveSecondsLimit: number;
|
|
12
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
13
11
|
maximumAssignmentSeconds?: number | undefined;
|
|
14
12
|
}, {
|
|
15
13
|
dailyActiveSecondsLimit: number;
|
|
16
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
17
|
-
maximumAssignmentSeconds?: number | undefined;
|
|
18
|
-
}>, {
|
|
19
|
-
dailyActiveSecondsLimit: number;
|
|
20
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
21
|
-
maximumAssignmentSeconds?: number | undefined;
|
|
22
|
-
}, {
|
|
23
|
-
dailyActiveSecondsLimit: number;
|
|
24
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
25
14
|
maximumAssignmentSeconds?: number | undefined;
|
|
26
15
|
}>>, Record<string, {
|
|
27
16
|
dailyActiveSecondsLimit: number;
|
|
28
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
29
17
|
maximumAssignmentSeconds?: number | undefined;
|
|
30
18
|
}>, Record<string, {
|
|
31
19
|
dailyActiveSecondsLimit: number;
|
|
32
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
33
20
|
maximumAssignmentSeconds?: number | undefined;
|
|
34
21
|
}>>;
|
|
35
22
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
36
23
|
modelConfigurationId: z.ZodString;
|
|
37
24
|
dailyActiveSecondsLimit: z.ZodNumber;
|
|
38
|
-
capabilityLimits: z.ZodEffects<z.ZodRecord<z.ZodString, z.
|
|
25
|
+
capabilityLimits: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
39
26
|
dailyActiveSecondsLimit: z.ZodNumber;
|
|
40
|
-
minimumAssignmentSeconds: z.ZodOptional<z.ZodNumber>;
|
|
41
27
|
maximumAssignmentSeconds: z.ZodOptional<z.ZodNumber>;
|
|
42
28
|
}, "strict", z.ZodTypeAny, {
|
|
43
29
|
dailyActiveSecondsLimit: number;
|
|
44
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
45
30
|
maximumAssignmentSeconds?: number | undefined;
|
|
46
31
|
}, {
|
|
47
32
|
dailyActiveSecondsLimit: number;
|
|
48
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
49
|
-
maximumAssignmentSeconds?: number | undefined;
|
|
50
|
-
}>, {
|
|
51
|
-
dailyActiveSecondsLimit: number;
|
|
52
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
53
|
-
maximumAssignmentSeconds?: number | undefined;
|
|
54
|
-
}, {
|
|
55
|
-
dailyActiveSecondsLimit: number;
|
|
56
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
57
33
|
maximumAssignmentSeconds?: number | undefined;
|
|
58
34
|
}>>, Record<string, {
|
|
59
35
|
dailyActiveSecondsLimit: number;
|
|
60
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
61
36
|
maximumAssignmentSeconds?: number | undefined;
|
|
62
37
|
}>, Record<string, {
|
|
63
38
|
dailyActiveSecondsLimit: number;
|
|
64
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
65
39
|
maximumAssignmentSeconds?: number | undefined;
|
|
66
40
|
}>>;
|
|
67
41
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
68
42
|
modelConfigurationId: z.ZodString;
|
|
69
43
|
dailyActiveSecondsLimit: z.ZodNumber;
|
|
70
|
-
capabilityLimits: z.ZodEffects<z.ZodRecord<z.ZodString, z.
|
|
44
|
+
capabilityLimits: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
71
45
|
dailyActiveSecondsLimit: z.ZodNumber;
|
|
72
|
-
minimumAssignmentSeconds: z.ZodOptional<z.ZodNumber>;
|
|
73
46
|
maximumAssignmentSeconds: z.ZodOptional<z.ZodNumber>;
|
|
74
47
|
}, "strict", z.ZodTypeAny, {
|
|
75
48
|
dailyActiveSecondsLimit: number;
|
|
76
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
77
|
-
maximumAssignmentSeconds?: number | undefined;
|
|
78
|
-
}, {
|
|
79
|
-
dailyActiveSecondsLimit: number;
|
|
80
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
81
|
-
maximumAssignmentSeconds?: number | undefined;
|
|
82
|
-
}>, {
|
|
83
|
-
dailyActiveSecondsLimit: number;
|
|
84
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
85
49
|
maximumAssignmentSeconds?: number | undefined;
|
|
86
50
|
}, {
|
|
87
51
|
dailyActiveSecondsLimit: number;
|
|
88
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
89
52
|
maximumAssignmentSeconds?: number | undefined;
|
|
90
53
|
}>>, Record<string, {
|
|
91
54
|
dailyActiveSecondsLimit: number;
|
|
92
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
93
55
|
maximumAssignmentSeconds?: number | undefined;
|
|
94
56
|
}>, Record<string, {
|
|
95
57
|
dailyActiveSecondsLimit: number;
|
|
96
|
-
minimumAssignmentSeconds?: number | undefined;
|
|
97
58
|
maximumAssignmentSeconds?: number | undefined;
|
|
98
59
|
}>>;
|
|
99
60
|
}, z.ZodTypeAny, "passthrough">>;
|
|
@@ -4,17 +4,17 @@ const capabilityAccountingLimitsSchema = z.object({
|
|
|
4
4
|
dailyActiveSecondsLimit: z.number().finite().nonnegative(),
|
|
5
5
|
capabilityLimits: z.record(z.object({
|
|
6
6
|
dailyActiveSecondsLimit: z.number().finite().nonnegative(),
|
|
7
|
-
minimumAssignmentSeconds: z.number().int().positive().optional(),
|
|
8
7
|
maximumAssignmentSeconds: z.number().int().positive().optional()
|
|
9
|
-
}).strict().
|
|
10
|
-
if (value.minimumAssignmentSeconds !== void 0 && value.maximumAssignmentSeconds !== void 0 && value.minimumAssignmentSeconds > value.maximumAssignmentSeconds) context.addIssue({
|
|
11
|
-
code: z.ZodIssueCode.custom,
|
|
12
|
-
path: ["maximumAssignmentSeconds"],
|
|
13
|
-
message: "Maximum must not be below minimum."
|
|
14
|
-
});
|
|
15
|
-
})).refine((value) => Object.keys(value).length > 0, "At least one execution capability limit is required.")
|
|
8
|
+
}).strict()).refine((value) => Object.keys(value).length > 0, "At least one execution capability limit is required.")
|
|
16
9
|
}).passthrough();
|
|
10
|
+
function validateObservation(observation) {
|
|
11
|
+
if (!observation || typeof observation.healthy !== "boolean" || typeof observation.observedAt !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/u.test(observation.observedAt) || !Number.isFinite(Date.parse(observation.observedAt)) || typeof observation.day !== "string" || observation.day !== new Date(Date.parse(observation.observedAt)).toISOString().slice(0, 10) || [observation.activeSeconds, observation.reservedSeconds].some((value) => !Number.isFinite(value) || value < 0)) {
|
|
12
|
+
throw new Error("capability_accounting_invalid");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
17
15
|
function remainingCapabilitySeconds(input) {
|
|
16
|
+
validateObservation(input.observation);
|
|
17
|
+
if (input.previousObservation !== void 0) validateObservation(input.previousObservation);
|
|
18
18
|
const now = Date.parse(input.now), observed = Date.parse(input.observation.observedAt);
|
|
19
19
|
const numbers = [
|
|
20
20
|
input.maximumObservationAgeSeconds,
|