@treeseed/sdk 0.13.0-rc.2 → 0.13.0-rc.5
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/capacity/agents/agent-capacity.d.ts +2 -0
- package/dist/capacity/agents/agent-capacity.js +6 -1
- package/dist/market-client/interface.d.ts +0 -5
- package/dist/market-client/internal-capacity-allocation.d.ts +4 -0
- package/dist/market-client/internal-capacity-allocation.js +17 -0
- package/dist/market-client/methods.js +0 -10
- package/dist/operator-contracts/workday-profile.d.ts +6 -0
- package/dist/operator-contracts/workday-profile.js +17 -0
- package/dist/reconcile/capacity/capacity-core/live-acceptance-capacity-competition.js +3 -2
- package/dist/reconcile/capacity/capacity-core/live-acceptance-capacity-proof.js +4 -2
- package/dist/reconcile/runtime/live-acceptance-starter-runtime.js +5 -4
- package/dist/scenes/agent-lab/production-lifecycle.js +3 -2
- package/dist/scripts/standards/verify-api-consumer.js +6 -2
- package/dist/seeds/runtime/local-capacity.js +4 -2
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type { AgentKernelPolicy, AgentKernelProfile, ProjectAgentClass, ProjectAgentClassStatus } from '../../agent-capacity/contracts/projects/agents/project-agent-class.js';
|
|
2
2
|
export * from '../../agent-capacity/allocation.js';
|
|
3
3
|
export * from '../../agent-capacity/artifacts.js';
|
|
4
|
+
export { deriveAgentRuntimeStatus } from '../../agent-capacity/authoring/agent-definition-authoring.js';
|
|
4
5
|
export { compileDefaultChatActivityProfile } from '../../agent-capacity/authoring/chat-activity-profile.js';
|
|
6
|
+
export { validateGroupDefinition, validateGroupEdgeDefinition } from '../../agent-capacity/authoring/group-definition-authoring.js';
|
|
5
7
|
export * from '../../agent-capacity/authority/agent-authority-presets.js';
|
|
6
8
|
export * from '../../agent-capacity/authority/assignment-authority-probe.js';
|
|
7
9
|
export * from '../../agent-capacity/artifact-mutation-receipt.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "../../agent-capacity/allocation.js";
|
|
2
2
|
export * from "../../agent-capacity/artifacts.js";
|
|
3
|
+
import { deriveAgentRuntimeStatus } from "../../agent-capacity/authoring/agent-definition-authoring.js";
|
|
3
4
|
import { compileDefaultChatActivityProfile } from "../../agent-capacity/authoring/chat-activity-profile.js";
|
|
5
|
+
import { validateGroupDefinition, validateGroupEdgeDefinition } from "../../agent-capacity/authoring/group-definition-authoring.js";
|
|
4
6
|
export * from "../../agent-capacity/authority/agent-authority-presets.js";
|
|
5
7
|
export * from "../../agent-capacity/authority/assignment-authority-probe.js";
|
|
6
8
|
export * from "../../agent-capacity/artifact-mutation-receipt.js";
|
|
@@ -32,5 +34,8 @@ export * from "../../governance/groups/contracts.js";
|
|
|
32
34
|
export * from "../../governance/groups/membership.js";
|
|
33
35
|
export * from "../../governance/groups/signal-scope.js";
|
|
34
36
|
export {
|
|
35
|
-
compileDefaultChatActivityProfile
|
|
37
|
+
compileDefaultChatActivityProfile,
|
|
38
|
+
deriveAgentRuntimeStatus,
|
|
39
|
+
validateGroupDefinition,
|
|
40
|
+
validateGroupEdgeDefinition
|
|
36
41
|
};
|
|
@@ -119,12 +119,7 @@ declare module "../support/market-client.js" {
|
|
|
119
119
|
createCapacityGrant: OmitThisParameter<typeof import("./capacity/allocations/creation/create-capacity-grant.js").createCapacityGrantMethod>;
|
|
120
120
|
transitionCapacityGrant: OmitThisParameter<typeof import("./capacity/allocations/updates/transition-capacity-grant.js").transitionCapacityGrantMethod>;
|
|
121
121
|
capacityAllocationSets: OmitThisParameter<typeof import("./capacity/allocations/contracts/capacity-allocation-sets.js").capacityAllocationSetsMethod>;
|
|
122
|
-
createCapacityAllocationSet: OmitThisParameter<typeof import("./capacity/allocations/creation/create-capacity-allocation-set.js").createCapacityAllocationSetMethod>;
|
|
123
|
-
planCapacityAllocationSet: OmitThisParameter<typeof import("./capacity/allocations/creation/plan-capacity-allocation-set.js").planCapacityAllocationSetMethod>;
|
|
124
122
|
capacityAllocationSet: OmitThisParameter<typeof import("./capacity/allocations/contracts/capacity-allocation-set.js").capacityAllocationSetMethod>;
|
|
125
|
-
activateCapacityAllocationSet: OmitThisParameter<typeof import("./capacity/allocations/lifecycle/activate-capacity-allocation-set.js").activateCapacityAllocationSetMethod>;
|
|
126
|
-
supersedeCapacityAllocationSet: OmitThisParameter<typeof import("./capacity/allocations/updates/supersede-capacity-allocation-set.js").supersedeCapacityAllocationSetMethod>;
|
|
127
|
-
archiveCapacityAllocationSet: OmitThisParameter<typeof import("./capacity/allocations/retirement/archive-capacity-allocation-set.js").archiveCapacityAllocationSetMethod>;
|
|
128
123
|
explainCapacityAllocationSet: OmitThisParameter<typeof import("./capacity/allocations/queries/explain-capacity-allocation-set.js").explainCapacityAllocationSetMethod>;
|
|
129
124
|
providerAvailabilitySessions: OmitThisParameter<typeof import("./capacity/providers/contracts/provider-availability-sessions.js").providerAvailabilitySessionsMethod>;
|
|
130
125
|
capacityProviderAssignments: OmitThisParameter<typeof import("./capacity/assignments/contracts/capacity-provider-assignments.js").capacityProviderAssignmentsMethod>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MarketClient } from '../entrypoints/clients/market-client.js';
|
|
2
|
+
export declare function createInternalCapacityAllocationSet(client: MarketClient, teamId: string, body: Record<string, unknown>, idempotencyKey: string): any;
|
|
3
|
+
export declare function activateInternalCapacityAllocationSet(client: MarketClient, teamId: string, allocationSetId: string, idempotencyKey: string): any;
|
|
4
|
+
export declare function supersedeInternalCapacityAllocationSet(client: MarketClient, teamId: string, allocationSetId: string, body: Record<string, unknown>, idempotencyKey: string): any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createCapacityAllocationSetMethod } from "./capacity/allocations/creation/create-capacity-allocation-set.js";
|
|
2
|
+
import { activateCapacityAllocationSetMethod } from "./capacity/allocations/lifecycle/activate-capacity-allocation-set.js";
|
|
3
|
+
import { supersedeCapacityAllocationSetMethod } from "./capacity/allocations/updates/supersede-capacity-allocation-set.js";
|
|
4
|
+
function createInternalCapacityAllocationSet(client, teamId, body, idempotencyKey) {
|
|
5
|
+
return createCapacityAllocationSetMethod.call(client, teamId, body, idempotencyKey);
|
|
6
|
+
}
|
|
7
|
+
function activateInternalCapacityAllocationSet(client, teamId, allocationSetId, idempotencyKey) {
|
|
8
|
+
return activateCapacityAllocationSetMethod.call(client, teamId, allocationSetId, idempotencyKey);
|
|
9
|
+
}
|
|
10
|
+
function supersedeInternalCapacityAllocationSet(client, teamId, allocationSetId, body, idempotencyKey) {
|
|
11
|
+
return supersedeCapacityAllocationSetMethod.call(client, teamId, allocationSetId, body, idempotencyKey);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
activateInternalCapacityAllocationSet,
|
|
15
|
+
createInternalCapacityAllocationSet,
|
|
16
|
+
supersedeInternalCapacityAllocationSet
|
|
17
|
+
};
|
|
@@ -47,14 +47,9 @@ import { capacityAllocationSetMethod } from "./capacity/allocations/contracts/ca
|
|
|
47
47
|
import { capacityAllocationSetsMethod } from "./capacity/allocations/contracts/capacity-allocation-sets.js";
|
|
48
48
|
import { capacityGrantMethod } from "./capacity/allocations/contracts/capacity-grant.js";
|
|
49
49
|
import { capacityGrantsMethod } from "./capacity/allocations/contracts/capacity-grants.js";
|
|
50
|
-
import { createCapacityAllocationSetMethod } from "./capacity/allocations/creation/create-capacity-allocation-set.js";
|
|
51
50
|
import { createCapacityGrantMethod } from "./capacity/allocations/creation/create-capacity-grant.js";
|
|
52
|
-
import { planCapacityAllocationSetMethod } from "./capacity/allocations/creation/plan-capacity-allocation-set.js";
|
|
53
51
|
import { planCapacityGrantMethod } from "./capacity/allocations/creation/plan-capacity-grant.js";
|
|
54
|
-
import { activateCapacityAllocationSetMethod } from "./capacity/allocations/lifecycle/activate-capacity-allocation-set.js";
|
|
55
52
|
import { explainCapacityAllocationSetMethod } from "./capacity/allocations/queries/explain-capacity-allocation-set.js";
|
|
56
|
-
import { archiveCapacityAllocationSetMethod } from "./capacity/allocations/retirement/archive-capacity-allocation-set.js";
|
|
57
|
-
import { supersedeCapacityAllocationSetMethod } from "./capacity/allocations/updates/supersede-capacity-allocation-set.js";
|
|
58
53
|
import { transitionCapacityGrantMethod } from "./capacity/allocations/updates/transition-capacity-grant.js";
|
|
59
54
|
import { capacityProviderAssignmentMethod } from "./capacity/assignments/contracts/capacity-provider-assignment.js";
|
|
60
55
|
import { assignmentAuthorityProbeMethod } from "./capacity/assignments/contracts/assignment-authority-probe.js";
|
|
@@ -303,12 +298,7 @@ function installMarketClientMethods(prototype) {
|
|
|
303
298
|
prototype.createCapacityGrant = createCapacityGrantMethod;
|
|
304
299
|
prototype.transitionCapacityGrant = transitionCapacityGrantMethod;
|
|
305
300
|
prototype.capacityAllocationSets = capacityAllocationSetsMethod;
|
|
306
|
-
prototype.createCapacityAllocationSet = createCapacityAllocationSetMethod;
|
|
307
|
-
prototype.planCapacityAllocationSet = planCapacityAllocationSetMethod;
|
|
308
301
|
prototype.capacityAllocationSet = capacityAllocationSetMethod;
|
|
309
|
-
prototype.activateCapacityAllocationSet = activateCapacityAllocationSetMethod;
|
|
310
|
-
prototype.supersedeCapacityAllocationSet = supersedeCapacityAllocationSetMethod;
|
|
311
|
-
prototype.archiveCapacityAllocationSet = archiveCapacityAllocationSetMethod;
|
|
312
302
|
prototype.explainCapacityAllocationSet = explainCapacityAllocationSetMethod;
|
|
313
303
|
prototype.providerAvailabilitySessions = providerAvailabilitySessionsMethod;
|
|
314
304
|
prototype.capacityProviderAssignments = capacityProviderAssignmentsMethod;
|
|
@@ -24,6 +24,10 @@ export interface WorkdayAllocationProfile {
|
|
|
24
24
|
starvationLimitSeconds: number;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
export interface RepositoryWorkdayProfileBundle {
|
|
28
|
+
schemaVersion: 'treeseed.workday-allocation-profile-bundle/v1';
|
|
29
|
+
profiles: WorkdayAllocationProfile[];
|
|
30
|
+
}
|
|
27
31
|
export interface ProjectAgentClassMembership {
|
|
28
32
|
projectId: string;
|
|
29
33
|
agentId: string;
|
|
@@ -63,4 +67,6 @@ export interface WorkdayBorrowingEvidence {
|
|
|
63
67
|
export declare function validateOneClassPerProjectAgent(memberships: ProjectAgentClassMembership[], expectedAgents?: ProjectAgentIdentity[]): WorkdayProfileDiagnostic[];
|
|
64
68
|
export declare function validateWorkdayAllocationProfile(profile: WorkdayAllocationProfile, classCatalogs?: ProjectClassCatalog[]): WorkdayProfileDiagnostic[];
|
|
65
69
|
export declare function normalizeWorkdayAllocationProfile(profile: WorkdayAllocationProfile): WorkdayAllocationProfile;
|
|
70
|
+
export declare function validateRepositoryWorkdayProfileBundle(bundle: RepositoryWorkdayProfileBundle, classCatalogs?: ProjectClassCatalog[]): WorkdayProfileDiagnostic[];
|
|
71
|
+
export declare function normalizeRepositoryWorkdayProfileBundle(bundle: RepositoryWorkdayProfileBundle): RepositoryWorkdayProfileBundle;
|
|
66
72
|
export declare function validateWorkdayBorrowingEvidence(evidence: WorkdayBorrowingEvidence): WorkdayProfileDiagnostic[];
|
|
@@ -71,6 +71,21 @@ function normalizeWorkdayAllocationProfile(profile) {
|
|
|
71
71
|
demandSources: [...new Set(profile.demandSources)].sort()
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
+
function validateRepositoryWorkdayProfileBundle(bundle, classCatalogs) {
|
|
75
|
+
const diagnostics = [];
|
|
76
|
+
if (bundle.schemaVersion !== "treeseed.workday-allocation-profile-bundle/v1") diagnostics.push({ code: "bundle_schema_version_invalid", path: "schemaVersion", message: "Unsupported repository workday profile bundle schema." });
|
|
77
|
+
if (!Array.isArray(bundle.profiles) || bundle.profiles.length === 0) diagnostics.push({ code: "bundle_profiles_empty", path: "profiles", message: "A repository workday profile bundle must contain at least one profile." });
|
|
78
|
+
const profileIds = /* @__PURE__ */ new Set();
|
|
79
|
+
for (const [index, profile] of (Array.isArray(bundle.profiles) ? bundle.profiles : []).entries()) {
|
|
80
|
+
if (profileIds.has(profile.id)) diagnostics.push({ code: "bundle_profile_id_duplicate", path: `profiles.${index}.id`, message: `Stable profile id ${profile.id} is declared more than once; a repository bundle contains exactly one current generation per profile.` });
|
|
81
|
+
profileIds.add(profile.id);
|
|
82
|
+
diagnostics.push(...validateWorkdayAllocationProfile(profile, classCatalogs).map((diagnostic) => ({ ...diagnostic, path: `profiles.${index}.${diagnostic.path}` })));
|
|
83
|
+
}
|
|
84
|
+
return diagnostics;
|
|
85
|
+
}
|
|
86
|
+
function normalizeRepositoryWorkdayProfileBundle(bundle) {
|
|
87
|
+
return { schemaVersion: "treeseed.workday-allocation-profile-bundle/v1", profiles: [...bundle.profiles].map(normalizeWorkdayAllocationProfile).sort((left, right) => left.id.localeCompare(right.id) || left.version.localeCompare(right.version)) };
|
|
88
|
+
}
|
|
74
89
|
function validateWorkdayBorrowingEvidence(evidence) {
|
|
75
90
|
const diagnostics = [];
|
|
76
91
|
if (!evidence.lendingPermitted) diagnostics.push({ code: "lending_not_permitted", path: "lendingPermitted", message: "The profile does not permit the lender to lend capacity." });
|
|
@@ -82,8 +97,10 @@ function validateWorkdayBorrowingEvidence(evidence) {
|
|
|
82
97
|
return diagnostics;
|
|
83
98
|
}
|
|
84
99
|
export {
|
|
100
|
+
normalizeRepositoryWorkdayProfileBundle,
|
|
85
101
|
normalizeWorkdayAllocationProfile,
|
|
86
102
|
validateOneClassPerProjectAgent,
|
|
103
|
+
validateRepositoryWorkdayProfileBundle,
|
|
87
104
|
validateWorkdayAllocationProfile,
|
|
88
105
|
validateWorkdayBorrowingEvidence
|
|
89
106
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProviderProtocolClient } from "../../../capacity/providers/capacity-provider.js";
|
|
2
|
+
import { activateInternalCapacityAllocationSet, createInternalCapacityAllocationSet } from "../../../market-client/internal-capacity-allocation.js";
|
|
2
3
|
function projectRecord(payload) {
|
|
3
4
|
const project = payload.project ?? payload;
|
|
4
5
|
if (!project.id) throw new Error("Capacity competition project creation omitted its project id.");
|
|
@@ -96,7 +97,7 @@ async function provisionLocalCapacityCompetition(input) {
|
|
|
96
97
|
}, `${prefix}:grant-create`);
|
|
97
98
|
grantCreated = true;
|
|
98
99
|
await input.adminClient.transitionCapacityGrant(input.runtime.teamId, grantId, "activate", `${prefix}:grant-activate`);
|
|
99
|
-
const allocation = await input.adminClient
|
|
100
|
+
const allocation = await createInternalCapacityAllocationSet(input.adminClient, input.runtime.teamId, {
|
|
100
101
|
id: allocationId,
|
|
101
102
|
effectiveFrom: new Date(Date.now() - 1e3).toISOString(),
|
|
102
103
|
effectiveUntil: new Date(Date.now() + 10 * 6e4).toISOString(),
|
|
@@ -105,7 +106,7 @@ async function provisionLocalCapacityCompetition(input) {
|
|
|
105
106
|
borrowingRules: [],
|
|
106
107
|
metadata: { liveAcceptance: true, runId: input.runId }
|
|
107
108
|
}, `${prefix}:allocation-create`);
|
|
108
|
-
const activeAllocation = await input.adminClient
|
|
109
|
+
const activeAllocation = await activateInternalCapacityAllocationSet(input.adminClient, input.runtime.teamId, String(allocation.payload.id), `${prefix}:allocation-activate`);
|
|
109
110
|
availability = await providerClient.refreshAvailabilitySession(sessionId, {
|
|
110
111
|
expectedSequence: availability.payload.sequence,
|
|
111
112
|
environment: "local",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ProviderProtocolClient } from "../../../capacity/providers/capacity-provider.js";
|
|
2
2
|
import { MarketClient } from "../../../entrypoints/clients/market-client.js";
|
|
3
|
+
import { activateInternalCapacityAllocationSet, createInternalCapacityAllocationSet } from "../../../market-client/internal-capacity-allocation.js";
|
|
3
4
|
import { runLocalAutonomousStarterAcceptances } from "../../support/acceptance/live-acceptance-starters.js";
|
|
4
5
|
import { configuredLiveAcceptanceValue } from "../../support/acceptance/live-acceptance-values.js";
|
|
5
6
|
import { cleanupCapacityAssignmentProof } from "./live-acceptance-capacity-cleanup.js";
|
|
@@ -179,7 +180,7 @@ async function runCapacityProviderAssignmentProof(input) {
|
|
|
179
180
|
let activeAllocation = effectiveActiveAllocation(Array.isArray(allocations.payload.items) ? allocations.payload.items : []);
|
|
180
181
|
if (!activeAllocation?.id && input.environment === "local" && cleanupProvisionedProvider) {
|
|
181
182
|
const allocationId = `${input.prefix}-allocation`;
|
|
182
|
-
const created = await adminClient
|
|
183
|
+
const created = await createInternalCapacityAllocationSet(adminClient, config.teamId, {
|
|
183
184
|
id: allocationId,
|
|
184
185
|
effectiveFrom: new Date(Date.now() - 1e3).toISOString(),
|
|
185
186
|
effectiveUntil: new Date(Date.now() + 10 * 6e4).toISOString(),
|
|
@@ -193,7 +194,8 @@ async function runCapacityProviderAssignmentProof(input) {
|
|
|
193
194
|
borrowingRules: [],
|
|
194
195
|
metadata
|
|
195
196
|
}, `capacity-acceptance:${input.runId}:allocation-create`);
|
|
196
|
-
activeAllocation = (await
|
|
197
|
+
activeAllocation = (await activateInternalCapacityAllocationSet(
|
|
198
|
+
adminClient,
|
|
197
199
|
config.teamId,
|
|
198
200
|
String(created.payload.id),
|
|
199
201
|
`capacity-acceptance:${input.runId}:allocation-activate`
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ProviderProtocolClient,
|
|
4
4
|
signCapacityProviderProof
|
|
5
5
|
} from "../../capacity/providers/capacity-provider.js";
|
|
6
|
+
import { createInternalCapacityAllocationSet, supersedeInternalCapacityAllocationSet } from "../../market-client/internal-capacity-allocation.js";
|
|
6
7
|
import { bindLocalCapacityTreeDxRepository, syncLocalAcceptanceAgentClasses } from "../capacity/capacity-core/live-acceptance-capacity-context.js";
|
|
7
8
|
const LIVE_PROVIDER_ASSIGNMENT_BUDGET_SECONDS = 600;
|
|
8
9
|
const TERMINAL_WORKDAY_RUN_STATUSES = /* @__PURE__ */ new Set(["completed", "cancelled", "failed", "degraded"]);
|
|
@@ -192,7 +193,7 @@ async function provisionLocalStarterCapacity(input) {
|
|
|
192
193
|
}, `${key}:grant-create`);
|
|
193
194
|
grantCreated = true;
|
|
194
195
|
await input.adminClient.transitionCapacityGrant(input.runtime.teamId, grantId, "activate", `${key}:grant-activate`);
|
|
195
|
-
const allocation = await input.adminClient
|
|
196
|
+
const allocation = await createInternalCapacityAllocationSet(input.adminClient, input.runtime.teamId, {
|
|
196
197
|
id: allocationId,
|
|
197
198
|
effectiveFrom: new Date(Date.now() - 1e3).toISOString(),
|
|
198
199
|
effectiveUntil: new Date(Date.now() + (durationSeconds + 300) * 1e3).toISOString(),
|
|
@@ -202,7 +203,7 @@ async function provisionLocalStarterCapacity(input) {
|
|
|
202
203
|
metadata: { liveAcceptance: true, runId: input.runId, starter: input.config.starter }
|
|
203
204
|
}, `${key}:allocation-create`);
|
|
204
205
|
const active = (await input.adminClient.capacityAllocationSets(input.runtime.teamId, { limit: 200 })).payload.items.find((entry) => entry && typeof entry === "object" && entry.status === "active");
|
|
205
|
-
await input.adminClient
|
|
206
|
+
await supersedeInternalCapacityAllocationSet(input.adminClient, input.runtime.teamId, String(allocation.payload.id), { expectedActiveAllocationSetId: active?.id ?? null }, `${key}:allocation-supersede`);
|
|
206
207
|
availability = await protocol.refreshAvailabilitySession(sessionId, {
|
|
207
208
|
expectedSequence: availability.payload.sequence,
|
|
208
209
|
environment: "local",
|
|
@@ -372,7 +373,7 @@ async function provisionLocalStarterPortfolioCapacity(input) {
|
|
|
372
373
|
}
|
|
373
374
|
const durationSeconds = Math.max(...input.configs.map(localStarterDurationSeconds));
|
|
374
375
|
const allocationId = `${key}:allocation`;
|
|
375
|
-
const allocation = await input.adminClient
|
|
376
|
+
const allocation = await createInternalCapacityAllocationSet(input.adminClient, input.runtime.teamId, {
|
|
376
377
|
id: allocationId,
|
|
377
378
|
effectiveFrom: new Date(Date.now() - 1e3).toISOString(),
|
|
378
379
|
effectiveUntil: new Date(Date.now() + (durationSeconds + 300) * 1e3).toISOString(),
|
|
@@ -382,7 +383,7 @@ async function provisionLocalStarterPortfolioCapacity(input) {
|
|
|
382
383
|
metadata: { liveAcceptance: true, runId: input.runId, concurrentStarters: true }
|
|
383
384
|
}, `${key}:allocation-create`);
|
|
384
385
|
const active = (await input.adminClient.capacityAllocationSets(input.runtime.teamId, { limit: 200 })).payload.items.find((entry) => entry && typeof entry === "object" && entry.status === "active");
|
|
385
|
-
await input.adminClient
|
|
386
|
+
await supersedeInternalCapacityAllocationSet(input.adminClient, input.runtime.teamId, String(allocation.payload.id), { expectedActiveAllocationSetId: active?.id ?? null }, `${key}:allocation-supersede`);
|
|
386
387
|
availability = await protocol.refreshAvailabilitySession(sessionId, {
|
|
387
388
|
expectedSequence: availability.payload.sequence,
|
|
388
389
|
environment: "local",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ProviderProtocolClient } from "../../capacity/providers/capacity-provider.js";
|
|
2
2
|
import { MarketClient } from "../../entrypoints/clients/market-client.js";
|
|
3
|
+
import { createInternalCapacityAllocationSet, supersedeInternalCapacityAllocationSet } from "../../market-client/internal-capacity-allocation.js";
|
|
3
4
|
import {
|
|
4
5
|
provisionLocalCapacityAcceptanceProvider,
|
|
5
6
|
syncLocalAcceptanceAgentClasses
|
|
@@ -288,7 +289,7 @@ function createProductionAgentLabExecutor(options) {
|
|
|
288
289
|
}, `agent-lab:${input.runId}:grant-create`);
|
|
289
290
|
await client.transitionCapacityGrant(scope.teamId, grantId, "activate", `agent-lab:${input.runId}:grant-activate`);
|
|
290
291
|
const allocationId = `agent-lab:${input.runId}:allocation`;
|
|
291
|
-
allocation = (await client
|
|
292
|
+
allocation = (await createInternalCapacityAllocationSet(client, scope.teamId, {
|
|
292
293
|
id: allocationId,
|
|
293
294
|
effectiveFrom: new Date(Date.now() - 1e3).toISOString(),
|
|
294
295
|
effectiveUntil: new Date(Date.now() + input.config.workdays.reduce((sum, day) => sum + day.durationSeconds, 0) * 1e3 + 6e5).toISOString(),
|
|
@@ -297,7 +298,7 @@ function createProductionAgentLabExecutor(options) {
|
|
|
297
298
|
slices: [{ id: `${allocationId}:market`, scope: "project", targetId: scope.projectId, policy: { minPercent: 0, targetPercent: 100, maxPercent: 100, hardCapPercent: 100 } }],
|
|
298
299
|
metadata: { agentLab: true, runId: input.runId }
|
|
299
300
|
}, `agent-lab:${input.runId}:allocation-create`)).payload;
|
|
300
|
-
await client
|
|
301
|
+
await supersedeInternalCapacityAllocationSet(client, scope.teamId, text(allocation.id), { expectedActiveAllocationSetId: null }, `agent-lab:${input.runId}:allocation-activate`);
|
|
301
302
|
availability = await protocol.refreshAvailabilitySession(sessionId, {
|
|
302
303
|
expectedSequence: availability.payload.sequence,
|
|
303
304
|
environment: "local",
|
|
@@ -28,8 +28,12 @@ try {
|
|
|
28
28
|
const observed = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: worktree, encoding: 'utf8' }).trim();
|
|
29
29
|
if (observed !== sourceCommit)
|
|
30
30
|
throw new Error(`API consumer checkout resolved ${observed}, expected ${sourceCommit}.`);
|
|
31
|
-
execFileSync('npm', ['install', '--ignore-scripts', '--no-audit', '--no-fund', '--save
|
|
31
|
+
execFileSync('npm', ['install', '--ignore-scripts', '--no-audit', '--no-fund', '--no-save', tarball], { cwd: worktree, stdio: 'inherit' });
|
|
32
32
|
execFileSync('npm', ['run', 'build'], { cwd: worktree, stdio: 'inherit' });
|
|
33
|
+
// The complete API release gate imports every runtime module and executes the
|
|
34
|
+
// local HTTP acceptance campaign. Focused contract tests alone cannot prove
|
|
35
|
+
// that the packed SDK satisfies the consumer's full runtime boundary.
|
|
36
|
+
execFileSync('npm', ['run', 'verify:direct'], { cwd: worktree, stdio: 'inherit' });
|
|
33
37
|
const testResultPath = resolve(worktree, '.treeseed-sdk-consumer-results.json');
|
|
34
38
|
execFileSync('npx', [
|
|
35
39
|
'vitest', 'run', '--config', './vitest.config.js',
|
|
@@ -49,7 +53,7 @@ try {
|
|
|
49
53
|
.trim().split('\n').filter(Boolean).sort();
|
|
50
54
|
if (finalHead !== sourceCommit || consumerCommits !== 0)
|
|
51
55
|
throw new Error('API consumer verification created or adopted a source commit.');
|
|
52
|
-
if (
|
|
56
|
+
if (changedPaths.length !== 0) {
|
|
53
57
|
throw new Error(`API consumer verification changed unexpected tracked paths: ${changedPaths.join(', ')}.`);
|
|
54
58
|
}
|
|
55
59
|
execFileSync('git', ['diff', '--cached', '--quiet'], { cwd: worktree, stdio: 'ignore' });
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "../../capacity/providers/capacity-provider.js";
|
|
13
13
|
import { MarketClient } from "../../entrypoints/clients/market-client.js";
|
|
14
14
|
import { MarketClientError } from "../../entrypoints/clients/market-client.js";
|
|
15
|
+
import { createInternalCapacityAllocationSet, supersedeInternalCapacityAllocationSet } from "../../market-client/internal-capacity-allocation.js";
|
|
15
16
|
function object(value) {
|
|
16
17
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
17
18
|
}
|
|
@@ -346,7 +347,7 @@ async function reconcilePolicy(input) {
|
|
|
346
347
|
}
|
|
347
348
|
if (!allocation) {
|
|
348
349
|
const target = 100 / allocationProjectIds.length;
|
|
349
|
-
const created = await input.client
|
|
350
|
+
const created = await createInternalCapacityAllocationSet(input.client, input.teamId, {
|
|
350
351
|
id: allocationId,
|
|
351
352
|
effectiveFrom: new Date(Date.now() - 1e3).toISOString(),
|
|
352
353
|
effectiveUntil: "2100-01-01T00:00:00.000Z",
|
|
@@ -359,7 +360,8 @@ async function reconcilePolicy(input) {
|
|
|
359
360
|
}
|
|
360
361
|
if (string(allocation.status) !== "active") {
|
|
361
362
|
const expectedActiveAllocationSetId = string(activeAllocation?.id);
|
|
362
|
-
await
|
|
363
|
+
await supersedeInternalCapacityAllocationSet(
|
|
364
|
+
input.client,
|
|
363
365
|
input.teamId,
|
|
364
366
|
allocationId,
|
|
365
367
|
{ expectedActiveAllocationSetId },
|