@treeseed/sdk 0.13.0-rc.121 → 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.
- package/dist/.treeseed-build-complete.json +1 -1
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +1594 -922
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +22 -1
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +40 -40
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +1 -59
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +1 -1
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +1 -1
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +18 -20
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +1 -1
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +0 -67
- 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 +8 -8
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +0 -23
- 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 +176 -176
- package/dist/agent-capacity/contracts/support/execution-graph.js +1 -1
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +1 -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 +1042 -1042
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +11 -11
- 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 +4 -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 +2 -4
- package/dist/capacity/agents/agent-capacity.js +1 -3
- package/dist/capacity-provider/capability-ontology.d.ts +138 -138
- package/dist/capacity-provider/client.d.ts +1 -2
- package/dist/capacity-provider/client.js +0 -6
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +8 -8
- package/dist/capacity-provider/core-capability-catalog.d.ts +4 -4
- package/dist/capacity-provider/environment-catalog.d.ts +166 -166
- package/dist/capacity-provider/install-configuration.d.ts +2 -2
- package/dist/capacity-provider/sandbox-contracts.d.ts +52 -52
- package/dist/capacity-provider/source-workspace.d.ts +102 -4
- package/dist/capacity-provider/source-workspace.js +5 -1
- package/dist/content/validation/agent-operational-content-schemas.d.ts +108 -108
- package/dist/content/validation/auxiliary-content-schemas.d.ts +108 -108
- package/dist/content/validation/content-model-schemas.d.ts +9473 -6284
- package/dist/content/validation/content-model-schemas.js +116 -48
- package/dist/content/validation/portable-content-data.d.ts +351 -181
- package/dist/content/validation/portable-content-data.js +6 -1
- package/dist/deployment/ai/storage.d.ts +14 -14
- package/dist/deployment/ai-hosting.d.ts +10 -10
- package/dist/deployment/ai-instance.d.ts +14 -14
- package/dist/deployment/ai-mode.d.ts +82 -82
- package/dist/deployment/hosted-topology-template.d.ts +24 -24
- package/dist/deployment/hosted-topology.d.ts +219 -219
- package/dist/deployment/postgres/contracts.d.ts +52 -52
- package/dist/deployment/postgres/transfer.d.ts +4 -4
- package/dist/deployment/schemas.d.ts +780 -780
- package/dist/development/schemas.d.ts +439 -439
- 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 +3 -1
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +2 -2
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +17 -17
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +4 -4
- package/dist/operator-contracts/catalog/communication-operations.d.ts +100 -100
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +40 -40
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +54 -54
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +5 -5
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +10 -10
- package/dist/operator-contracts/catalog/services/secret-operations.d.ts +8 -8
- package/dist/operator-contracts/communication/contracts.d.ts +273 -273
- package/dist/operator-contracts/control-plane-operations.d.ts +236 -242
- package/dist/operator-contracts/control-plane-operations.js +0 -2
- package/dist/operator-contracts/inbox/contracts.d.ts +204 -204
- package/dist/operator-contracts/knowledge/contracts.d.ts +16 -16
- package/dist/platform/agent-schema-verification.d.ts +3 -0
- package/dist/platform/agent-schema-verification.js +94 -0
- package/dist/platform/verification.js +6 -0
- package/dist/sdk-types/support/planning-policy.d.ts +1 -1
- package/dist/secrets-capability/shared-access.d.ts +2 -2
- package/dist/secrets-capability/shared-resources.d.ts +46 -46
- package/dist/secrets-capability/vault-contracts.d.ts +2 -2
- package/dist/security/encrypted-envelope.d.ts +8 -8
- package/package.json +3 -2
- 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
|
@@ -13,15 +13,15 @@ export declare const agentActivityQuerySchema: z.ZodObject<{
|
|
|
13
13
|
after: number;
|
|
14
14
|
type?: string | string[] | undefined;
|
|
15
15
|
agent?: string | string[] | undefined;
|
|
16
|
-
severity?: string | string[] | undefined;
|
|
17
16
|
agentClass?: string | string[] | undefined;
|
|
17
|
+
severity?: string | string[] | undefined;
|
|
18
18
|
}, {
|
|
19
19
|
type?: string | string[] | undefined;
|
|
20
20
|
agent?: string | string[] | undefined;
|
|
21
|
+
agentClass?: string | string[] | undefined;
|
|
22
|
+
severity?: string | string[] | undefined;
|
|
21
23
|
limit?: number | undefined;
|
|
22
24
|
after?: number | undefined;
|
|
23
|
-
severity?: string | string[] | undefined;
|
|
24
|
-
agentClass?: string | string[] | undefined;
|
|
25
25
|
}>;
|
|
26
26
|
export declare const agentActivityPageSchema: z.ZodObject<{
|
|
27
27
|
items: z.ZodArray<z.ZodType<AgentActivityEvent, z.ZodTypeDef, AgentActivityEvent>, "many">;
|
|
@@ -43,24 +43,24 @@ export declare const agentReplayRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
43
43
|
includeDiagnostics: boolean;
|
|
44
44
|
includePayloads: boolean;
|
|
45
45
|
at?: string | undefined;
|
|
46
|
-
cursor?: string | null | undefined;
|
|
47
46
|
workdayId?: string | undefined;
|
|
47
|
+
cursor?: string | null | undefined;
|
|
48
48
|
}, {
|
|
49
49
|
at?: string | undefined;
|
|
50
|
-
cursor?: string | null | undefined;
|
|
51
50
|
workdayId?: string | undefined;
|
|
51
|
+
cursor?: string | null | undefined;
|
|
52
52
|
includeDiagnostics?: boolean | undefined;
|
|
53
53
|
includePayloads?: boolean | undefined;
|
|
54
54
|
}>, {
|
|
55
55
|
includeDiagnostics: boolean;
|
|
56
56
|
includePayloads: boolean;
|
|
57
57
|
at?: string | undefined;
|
|
58
|
-
cursor?: string | null | undefined;
|
|
59
58
|
workdayId?: string | undefined;
|
|
59
|
+
cursor?: string | null | undefined;
|
|
60
60
|
}, {
|
|
61
61
|
at?: string | undefined;
|
|
62
|
-
cursor?: string | null | undefined;
|
|
63
62
|
workdayId?: string | undefined;
|
|
63
|
+
cursor?: string | null | undefined;
|
|
64
64
|
includeDiagnostics?: boolean | undefined;
|
|
65
65
|
includePayloads?: boolean | undefined;
|
|
66
66
|
}>;
|
|
@@ -157,13 +157,13 @@ export declare const agentForensicPayloadSchema: z.ZodObject<{
|
|
|
157
157
|
severity: "error" | "warning" | "info";
|
|
158
158
|
}>, "many">>;
|
|
159
159
|
}, "strict", z.ZodTypeAny, {
|
|
160
|
-
activity: AgentActivityEvent;
|
|
161
160
|
diagnostics: {
|
|
162
161
|
code: string;
|
|
163
162
|
path: string;
|
|
164
163
|
message: string;
|
|
165
164
|
severity: "error" | "warning" | "info";
|
|
166
165
|
}[];
|
|
166
|
+
activity: AgentActivityEvent;
|
|
167
167
|
contract: "treeseed.agent-forensic-payload/v1";
|
|
168
168
|
payload?: Record<string, unknown> | undefined;
|
|
169
169
|
transcript?: {
|
|
@@ -179,13 +179,13 @@ export declare const agentForensicPayloadSchema: z.ZodObject<{
|
|
|
179
179
|
}, {
|
|
180
180
|
activity: AgentActivityEvent;
|
|
181
181
|
contract: "treeseed.agent-forensic-payload/v1";
|
|
182
|
-
payload?: Record<string, unknown> | undefined;
|
|
183
182
|
diagnostics?: {
|
|
184
183
|
code: string;
|
|
185
184
|
path: string;
|
|
186
185
|
message: string;
|
|
187
186
|
severity: "error" | "warning" | "info";
|
|
188
187
|
}[] | undefined;
|
|
188
|
+
payload?: Record<string, unknown> | undefined;
|
|
189
189
|
transcript?: {
|
|
190
190
|
entries: Record<string, unknown>[];
|
|
191
191
|
page: {
|
|
@@ -208,8 +208,8 @@ export declare function parseAgentActivityQuery(value: unknown): {
|
|
|
208
208
|
after: number;
|
|
209
209
|
type?: string | string[] | undefined;
|
|
210
210
|
agent?: string | string[] | undefined;
|
|
211
|
-
severity?: string | string[] | undefined;
|
|
212
211
|
agentClass?: string | string[] | undefined;
|
|
212
|
+
severity?: string | string[] | undefined;
|
|
213
213
|
};
|
|
214
214
|
export declare function parseAgentActivityPage(value: unknown): {
|
|
215
215
|
items: AgentActivityEvent[];
|
|
@@ -219,8 +219,8 @@ export declare function parseAgentReplayRequest(value: unknown): {
|
|
|
219
219
|
includeDiagnostics: boolean;
|
|
220
220
|
includePayloads: boolean;
|
|
221
221
|
at?: string | undefined;
|
|
222
|
-
cursor?: string | null | undefined;
|
|
223
222
|
workdayId?: string | undefined;
|
|
223
|
+
cursor?: string | null | undefined;
|
|
224
224
|
};
|
|
225
225
|
export declare function parseAgentTranscriptPayload(value: unknown): {
|
|
226
226
|
entries: Record<string, unknown>[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ProviderAssignment } from '../contracts/capacity/assignments/assignment-records.js';
|
|
2
2
|
export interface AssignmentRecordDiagnostic {
|
|
3
3
|
code: string;
|
|
4
4
|
path: string;
|
|
@@ -9,8 +9,3 @@ export declare function validateProviderAssignment(value: unknown): {
|
|
|
9
9
|
diagnostics: AssignmentRecordDiagnostic[];
|
|
10
10
|
};
|
|
11
11
|
export declare function assertProviderAssignment(value: unknown): ProviderAssignment;
|
|
12
|
-
export declare function validateAgentModeRun(value: unknown): {
|
|
13
|
-
ok: boolean;
|
|
14
|
-
diagnostics: AssignmentRecordDiagnostic[];
|
|
15
|
-
};
|
|
16
|
-
export declare function assertAgentModeRun(value: unknown): AgentModeRun;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const ASSIGNMENT_STATUSES = /* @__PURE__ */ new Set(["pending", "leased", "running", "completed", "failed", "returned", "expired", "cancelled"]);
|
|
2
2
|
const LEASE_STATES = /* @__PURE__ */ new Set(["unleased", "leased", "released", "expired"]);
|
|
3
|
-
const
|
|
4
|
-
const SYNTHESIS_SOURCES = /* @__PURE__ */ new Set(["approved_decision", "planning_input_request", "capacity_plan", "living_execution_graph", "workday_demand", "verification_failure", "fallback_queue"]);
|
|
3
|
+
const SYNTHESIS_SOURCES = /* @__PURE__ */ new Set(["living_execution_graph"]);
|
|
5
4
|
function record(value) {
|
|
6
5
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
7
6
|
}
|
|
@@ -38,19 +37,15 @@ function validateProviderAssignment(value) {
|
|
|
38
37
|
if (!LEASE_STATES.has(String(assignment.leaseState ?? ""))) push(diagnostics, "provider_assignment_lease_state_invalid", "leaseState", "leaseState is invalid.");
|
|
39
38
|
if (!Number.isInteger(assignment.attemptCount) || Number(assignment.attemptCount) < 0) push(diagnostics, "provider_assignment_attempt_count_invalid", "attemptCount", "attemptCount must be a nonnegative integer.");
|
|
40
39
|
if (assignment.synthesizedFrom != null && !SYNTHESIS_SOURCES.has(String(assignment.synthesizedFrom))) push(diagnostics, "provider_assignment_synthesis_source_invalid", "synthesizedFrom", "synthesizedFrom is invalid.");
|
|
40
|
+
if (Object.hasOwn(assignment, "decisionInput")) push(diagnostics, "provider_assignment_retired_input", "decisionInput", "Use the immutable assignmentAttempt instead.");
|
|
41
|
+
if (Object.hasOwn(assignment, "allocationSetId")) push(diagnostics, "provider_assignment_retired_allocation", "allocationSetId", "Use the living-graph reservation instead.");
|
|
41
42
|
for (const field of ["leaseExpiresAt", "leaseRenewedAt", "assignedAt", "claimedAt", "completedAt", "returnedAt", "failedAt"]) {
|
|
42
43
|
if (!optionalTimestamp(assignment[field])) push(diagnostics, "provider_assignment_timestamp_invalid", field, `${field} must be an ISO timestamp when provided.`);
|
|
43
44
|
}
|
|
44
|
-
for (const field of ["capacityEnvelope", "
|
|
45
|
+
for (const field of ["capacityEnvelope", "workspaceContext", "allowedOutputs", "explanation", "lifecycleOutput", "metadata"]) {
|
|
45
46
|
if (!jsonRecord(assignment[field])) push(diagnostics, "provider_assignment_json_invalid", field, `${field} must be an object.`);
|
|
46
47
|
}
|
|
47
48
|
validateCapacityEnvelope(assignment.capacityEnvelope, "capacityEnvelope", diagnostics);
|
|
48
|
-
const decisionInput = record(assignment.decisionInput);
|
|
49
|
-
for (const field of ["teamId", "projectId", "projectAgentClassId"]) {
|
|
50
|
-
if (!present(decisionInput[field])) push(diagnostics, "decision_execution_input_field_invalid", `decisionInput.${field}`, `${field} is required.`);
|
|
51
|
-
}
|
|
52
|
-
if (decisionInput.mode !== "planning" && decisionInput.mode !== "acting") push(diagnostics, "decision_execution_input_mode_invalid", "decisionInput.mode", "mode must be planning or acting.");
|
|
53
|
-
if (!jsonRecord(decisionInput.input)) push(diagnostics, "decision_execution_input_json_invalid", "decisionInput.input", "input must be an object.");
|
|
54
49
|
if (!timestamp(assignment.createdAt)) push(diagnostics, "provider_assignment_timestamp_invalid", "createdAt", "createdAt must be an ISO timestamp.");
|
|
55
50
|
if (!timestamp(assignment.updatedAt)) push(diagnostics, "provider_assignment_timestamp_invalid", "updatedAt", "updatedAt must be an ISO timestamp.");
|
|
56
51
|
return { ok: diagnostics.length === 0, diagnostics };
|
|
@@ -60,33 +55,7 @@ function assertProviderAssignment(value) {
|
|
|
60
55
|
if (!result.ok) throw new Error(`Invalid provider assignment: ${result.diagnostics.map((entry) => `${entry.code} at ${entry.path}`).join(", ")}`);
|
|
61
56
|
return value;
|
|
62
57
|
}
|
|
63
|
-
function validateAgentModeRun(value) {
|
|
64
|
-
const modeRun = record(value);
|
|
65
|
-
const diagnostics = [];
|
|
66
|
-
for (const field of ["id", "teamId", "projectId", "providerAssignmentId", "capacityProviderId", "projectAgentClassId", "createdAt", "updatedAt"]) {
|
|
67
|
-
if (!present(modeRun[field])) push(diagnostics, "agent_mode_run_field_invalid", field, `${field} is required.`);
|
|
68
|
-
}
|
|
69
|
-
if (modeRun.mode !== "planning" && modeRun.mode !== "acting") push(diagnostics, "agent_mode_run_mode_invalid", "mode", "mode must be planning or acting.");
|
|
70
|
-
if (!MODE_RUN_STATUSES.has(String(modeRun.status ?? ""))) push(diagnostics, "agent_mode_run_status_invalid", "status", "status is invalid.");
|
|
71
|
-
for (const field of ["selectedInput", "capacityEnvelope", "outputs", "traceRefs", "usageActual", "validation", "metadata"]) {
|
|
72
|
-
if (!jsonRecord(modeRun[field])) push(diagnostics, "agent_mode_run_json_invalid", field, `${field} must be an object.`);
|
|
73
|
-
}
|
|
74
|
-
validateCapacityEnvelope(modeRun.capacityEnvelope, "capacityEnvelope", diagnostics);
|
|
75
|
-
for (const field of ["startedAt", "completedAt", "failedAt"]) {
|
|
76
|
-
if (!optionalTimestamp(modeRun[field])) push(diagnostics, "agent_mode_run_timestamp_invalid", field, `${field} must be an ISO timestamp when provided.`);
|
|
77
|
-
}
|
|
78
|
-
if (!timestamp(modeRun.createdAt)) push(diagnostics, "agent_mode_run_timestamp_invalid", "createdAt", "createdAt must be an ISO timestamp.");
|
|
79
|
-
if (!timestamp(modeRun.updatedAt)) push(diagnostics, "agent_mode_run_timestamp_invalid", "updatedAt", "updatedAt must be an ISO timestamp.");
|
|
80
|
-
return { ok: diagnostics.length === 0, diagnostics };
|
|
81
|
-
}
|
|
82
|
-
function assertAgentModeRun(value) {
|
|
83
|
-
const result = validateAgentModeRun(value);
|
|
84
|
-
if (!result.ok) throw new Error(`Invalid agent mode run: ${result.diagnostics.map((entry) => `${entry.code} at ${entry.path}`).join(", ")}`);
|
|
85
|
-
return value;
|
|
86
|
-
}
|
|
87
58
|
export {
|
|
88
|
-
assertAgentModeRun,
|
|
89
59
|
assertProviderAssignment,
|
|
90
|
-
validateAgentModeRun,
|
|
91
60
|
validateProviderAssignment
|
|
92
61
|
};
|
|
@@ -10,5 +10,5 @@ export interface CapacityConfigurationValidation {
|
|
|
10
10
|
diagnostics: CapacityConfigurationDiagnostic[];
|
|
11
11
|
}
|
|
12
12
|
export declare function validateProjectAgentClassConfiguration(value: unknown): CapacityConfigurationValidation;
|
|
13
|
-
export type ProjectAgentClassConfiguration = Pick<ProjectAgentClass, 'id' | 'slug' | 'name' | 'status' | '
|
|
13
|
+
export type ProjectAgentClassConfiguration = Pick<ProjectAgentClass, 'id' | 'slug' | 'name' | 'status' | 'handlerRefs' | 'metadata'>;
|
|
14
14
|
export type PortableActivityProfilesConfiguration = AgentActivityProfilesConfiguration;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
function record(value) {
|
|
2
2
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3
3
|
}
|
|
4
|
-
function strings(value) {
|
|
5
|
-
return Array.isArray(value) && value.every((entry) => typeof entry === "string" && entry.trim().length > 0) && new Set(value).size === value.length;
|
|
6
|
-
}
|
|
7
4
|
function validateProjectAgentClassConfiguration(value) {
|
|
8
5
|
const diagnostics = [];
|
|
9
6
|
const add = (code, path, message) => diagnostics.push({ code, path, message });
|
|
10
7
|
if (!record(value)) return { ok: false, diagnostics: [{ code: "project_agent_class_configuration_invalid", path: "", message: "Project agent class configuration must be an object." }] };
|
|
11
|
-
const allowed = /* @__PURE__ */ new Set(["id", "slug", "name", "status", "
|
|
8
|
+
const allowed = /* @__PURE__ */ new Set(["id", "slug", "name", "status", "handlerRefs", "metadata"]);
|
|
12
9
|
for (const key of Object.keys(value)) if (!allowed.has(key)) add("project_agent_class_configuration_unknown_field", key, `Unknown project agent class field ${key}.`);
|
|
13
10
|
for (const key of ["id", "slug"]) if (typeof value[key] !== "string" || !String(value[key]).trim()) add("project_agent_class_configuration_field_required", key, `${key} is required.`);
|
|
14
11
|
if (value.name !== void 0 && (typeof value.name !== "string" || !value.name.trim())) add("project_agent_class_configuration_name_invalid", "name", "name must be a non-empty string.");
|
|
15
12
|
if (value.status !== void 0 && !["active", "paused", "archived"].includes(String(value.status))) add("project_agent_class_configuration_status_invalid", "status", "status is invalid.");
|
|
16
|
-
|
|
17
|
-
for (const key of ["kernelProfile", "kernelPolicy", "handlerRefs", "outputContracts", "metadata"]) if (value[key] !== void 0 && !record(value[key])) add("project_agent_class_configuration_object_invalid", key, `${key} must be an object.`);
|
|
13
|
+
for (const key of ["handlerRefs", "metadata"]) if (value[key] !== void 0 && !record(value[key])) add("project_agent_class_configuration_object_invalid", key, `${key} must be an object.`);
|
|
18
14
|
return { ok: diagnostics.length === 0, diagnostics };
|
|
19
15
|
}
|
|
20
16
|
export {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CapacityGrantV2 } from '../grant.js';
|
|
2
|
+
export interface CapacityGrantDiagnostic {
|
|
3
|
+
code: string;
|
|
4
|
+
path: string;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CapacityGrantValidation {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
diagnostics: CapacityGrantDiagnostic[];
|
|
10
|
+
}
|
|
11
|
+
export declare function validateCapacityGrantV2(grant: CapacityGrantV2): CapacityGrantValidation;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function validateCapacityGrantV2(grant) {
|
|
2
|
+
const diagnostics = [];
|
|
3
|
+
const add = (code, path, message) => diagnostics.push({ code, path, message });
|
|
4
|
+
for (const [path, value] of [["id", grant.id], ["membershipId", grant.membershipId], ["teamId", grant.teamId], ["providerId", grant.providerId], ["projectId", grant.projectId], ["environment", grant.environment]]) {
|
|
5
|
+
if (!value?.trim()) add("capacity_grant_field_required", path, `${path} is required.`);
|
|
6
|
+
}
|
|
7
|
+
if (grant.schemaVersion !== 2) add("capacity_grant_schema_invalid", "schemaVersion", "Grant schemaVersion must be 2.");
|
|
8
|
+
if (!Array.isArray(grant.allowedModes) || grant.allowedModes.length === 0 || grant.allowedModes.some((mode) => !["planning", "acting"].includes(mode))) add("capacity_grant_modes_invalid", "allowedModes", "Grant allowedModes must contain planning and/or acting.");
|
|
9
|
+
for (const [path, values] of [["executionProviderIds", grant.executionProviderIds], ["laneIds", grant.laneIds], ["capabilities", grant.capabilities]]) {
|
|
10
|
+
if (!Array.isArray(values) || values.some((value) => !value?.trim()) || new Set(values).size !== values.length) add("capacity_grant_list_invalid", path, `${path} must contain unique non-empty strings.`);
|
|
11
|
+
}
|
|
12
|
+
for (const [path, value] of [["dailyAgentSecondsLimit", grant.dailyAgentSecondsLimit], ["monthlyAgentSecondsLimit", grant.monthlyAgentSecondsLimit]]) {
|
|
13
|
+
if (value != null && (!Number.isFinite(value) || value < 0)) add("capacity_grant_limit_invalid", path, `${path} must be zero or greater when configured.`);
|
|
14
|
+
}
|
|
15
|
+
if (grant.maxConcurrentAssignments != null && (!Number.isInteger(grant.maxConcurrentAssignments) || grant.maxConcurrentAssignments < 0)) add("capacity_grant_concurrency_invalid", "maxConcurrentAssignments", "maxConcurrentAssignments must be a non-negative integer when configured.");
|
|
16
|
+
if (grant.budgetLimits?.tokens != null && (!Number.isFinite(grant.budgetLimits.tokens) || grant.budgetLimits.tokens < 0)) add("capacity_grant_token_limit_invalid", "budgetLimits.tokens", "Token limit must be finite and non-negative.");
|
|
17
|
+
if (grant.budgetLimits?.cost && (!Number.isFinite(grant.budgetLimits.cost.amount) || grant.budgetLimits.cost.amount < 0 || !grant.budgetLimits.cost.currency.trim())) add("capacity_grant_cost_limit_invalid", "budgetLimits.cost", "Cost limit requires a non-negative amount and currency.");
|
|
18
|
+
if (grant.budgetLimits?.native?.some((entry) => !entry.unit.trim() || !Number.isFinite(entry.amount) || entry.amount < 0)) add("capacity_grant_native_limit_invalid", "budgetLimits.native", "Native limits require a unit and non-negative amount.");
|
|
19
|
+
if (!Array.isArray(grant.executionProviderIds) || grant.executionProviderIds.length === 0) add("capacity_grant_execution_provider_required", "executionProviderIds", "At least one execution provider is required.");
|
|
20
|
+
if (!grant.unmetered && grant.dailyAgentSecondsLimit == null && grant.monthlyAgentSecondsLimit == null) add("capacity_grant_budget_required", "unmetered", "A metered grant requires a daily or monthly agent-time limit.");
|
|
21
|
+
if (grant.unmetered && (grant.dailyAgentSecondsLimit != null || grant.monthlyAgentSecondsLimit != null)) add("capacity_grant_budget_ambiguous", "unmetered", "An unmetered grant must not also declare agent-time limits.");
|
|
22
|
+
if (grant.expiresAt && timestamp(grant.expiresAt) === null) add("capacity_grant_expiry_invalid", "expiresAt", "expiresAt must be an ISO timestamp.");
|
|
23
|
+
return { ok: diagnostics.length === 0, diagnostics };
|
|
24
|
+
}
|
|
25
|
+
function timestamp(value) {
|
|
26
|
+
const parsed = value ? Date.parse(value) : Number.NaN;
|
|
27
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
validateCapacityGrantV2
|
|
31
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ProjectAgentClass, ProjectAgentClassStatus } from '../../agent-capacity/contracts/projects/agents/project-agent-class.js';
|
|
2
2
|
export type { AgentDefinition, AgentActivityProfile } from '../../types/agents.js';
|
|
3
|
-
export * from '../../agent-capacity/
|
|
4
|
-
export * from '../../agent-capacity/artifacts.js';
|
|
3
|
+
export * from '../../agent-capacity/grant.js';
|
|
5
4
|
export * from '../../agent-capacity/validation/index.js';
|
|
6
5
|
export * from '../../agent-capacity/contracts/capacity/assignments/assignment-records.js';
|
|
7
6
|
export * from '../../agent-capacity/contracts/capacity/assignments/assignment-context-pack.js';
|
|
@@ -17,7 +16,6 @@ export * from '../../agent-capacity/contracts/operations/research-workflow.js';
|
|
|
17
16
|
export * from '../../agent-capacity/contracts/operations/agent-team-clone.js';
|
|
18
17
|
export * from '../../agent-capacity/contracts/projects/agents/project-agent-class.js';
|
|
19
18
|
export * from '../../agent-capacity/contracts/runtime/runtime-observability.js';
|
|
20
|
-
export * from '../../agent-capacity/contracts/support/decision-work.js';
|
|
21
19
|
export * from '../../agent-capacity/contracts/support/execution-graph.js';
|
|
22
20
|
export * from '../../agent-capacity/contracts/support/agent-lab-monitoring.js';
|
|
23
21
|
export * from '../../agent-capacity/contracts/support/agent-atlas.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export * from "../../agent-capacity/
|
|
2
|
-
export * from "../../agent-capacity/artifacts.js";
|
|
1
|
+
export * from "../../agent-capacity/grant.js";
|
|
3
2
|
export * from "../../agent-capacity/validation/index.js";
|
|
4
3
|
export * from "../../agent-capacity/contracts/capacity/assignments/assignment-records.js";
|
|
5
4
|
export * from "../../agent-capacity/contracts/capacity/assignments/assignment-context-pack.js";
|
|
@@ -15,7 +14,6 @@ export * from "../../agent-capacity/contracts/operations/research-workflow.js";
|
|
|
15
14
|
export * from "../../agent-capacity/contracts/operations/agent-team-clone.js";
|
|
16
15
|
export * from "../../agent-capacity/contracts/projects/agents/project-agent-class.js";
|
|
17
16
|
export * from "../../agent-capacity/contracts/runtime/runtime-observability.js";
|
|
18
|
-
export * from "../../agent-capacity/contracts/support/decision-work.js";
|
|
19
17
|
export * from "../../agent-capacity/contracts/support/execution-graph.js";
|
|
20
18
|
export * from "../../agent-capacity/contracts/support/agent-lab-monitoring.js";
|
|
21
19
|
export * from "../../agent-capacity/contracts/support/agent-atlas.js";
|