@treeseed/core 0.6.38 → 0.6.39
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/README.md +3 -3
- package/dist/agent.d.ts +1 -0
- package/dist/agent.js +2 -0
- package/dist/agents/spec-normalizer.js +71 -1
- package/dist/api/agent-routes.js +1 -11
- package/dist/scripts/build-dist.js +15 -0
- package/dist/services/common.d.ts +13 -0
- package/dist/services/common.js +33 -5
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +2 -0
- package/dist/services/manager.d.ts +24 -4
- package/dist/services/manager.js +184 -18
- package/dist/services/workday-manager.d.ts +279 -0
- package/dist/services/workday-manager.js +163 -0
- package/dist/services/workday-report.d.ts +23 -3
- package/dist/services/workday-start.d.ts +23 -3
- package/dist/services/worker-pool-scaler.d.ts +3 -3
- package/dist/services/worker-pool-scaler.js +69 -51
- package/dist/services/worker.d.ts +6 -0
- package/dist/services/worker.js +247 -13
- package/package.json +12 -6
package/dist/services/manager.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import {
|
|
4
|
-
createControlPlaneReporter
|
|
4
|
+
createControlPlaneReporter,
|
|
5
|
+
reserveCreditsForEstimate,
|
|
6
|
+
selectBestCapacityLane,
|
|
7
|
+
summarizeCapacityPlan
|
|
5
8
|
} from "@treeseed/sdk";
|
|
6
9
|
import { loadActiveAgentSpecs } from "../agents/spec-loader.js";
|
|
7
10
|
import { followCursorKey, resolveTriggerDecision } from "../agents/kernel/trigger-resolver.js";
|
|
8
|
-
import { createQueuePushClient, createServiceSdk, queueEnvelopeForTask, resolveManagerConfig } from "./common.js";
|
|
11
|
+
import { createQueuePushClient, createServiceSdk, queueEnvelopeForTask, resolveManagerConfig, seedGraphRefreshTask } from "./common.js";
|
|
9
12
|
import {
|
|
10
13
|
applyInteractiveWakeUpOverride,
|
|
11
14
|
applyScaleCooldown,
|
|
@@ -345,6 +348,13 @@ function normalizePolicyRecord(projectId, environment, config) {
|
|
|
345
348
|
projectId,
|
|
346
349
|
environment,
|
|
347
350
|
schedule: config.defaultSchedule,
|
|
351
|
+
enabled: true,
|
|
352
|
+
startCron: envValue("TREESEED_WORKDAY_START_CRON") || "0 9 * * 1-5",
|
|
353
|
+
durationMinutes: integerFromEnv("TREESEED_WORKDAY_DURATION_MINUTES", 480),
|
|
354
|
+
maxRunners: config.autoscale.maxWorkers,
|
|
355
|
+
maxWorkersPerRunner: integerFromEnv("TREESEED_RUNNER_MAX_LOCAL_WORKERS", 4),
|
|
356
|
+
dailyCreditBudget: config.dailyTaskCreditBudget,
|
|
357
|
+
closeoutGraceMinutes: integerFromEnv("TREESEED_WORKDAY_CLOSEOUT_GRACE_MINUTES", 15),
|
|
348
358
|
dailyTaskCreditBudget: config.dailyTaskCreditBudget,
|
|
349
359
|
maxQueuedTasks: config.maxQueuedTasks,
|
|
350
360
|
maxQueuedCredits: config.maxQueuedCredits,
|
|
@@ -487,21 +497,112 @@ async function buildPrioritySnapshot(sdk, config, policy, now, workDayId) {
|
|
|
487
497
|
});
|
|
488
498
|
return snapshot.payload;
|
|
489
499
|
}
|
|
490
|
-
async function openWorkday(sdk, config, policy, now) {
|
|
491
|
-
const
|
|
500
|
+
async function openWorkday(sdk, config, policy, now, reporter) {
|
|
501
|
+
const capacityPlan = await reporter?.getProjectCapacityPlan(config.environment).catch(() => null) ?? null;
|
|
502
|
+
const capacityEnvelope = await reserveWorkdayCapacity({
|
|
503
|
+
config,
|
|
504
|
+
policy,
|
|
505
|
+
capacityPlan,
|
|
506
|
+
reporter,
|
|
507
|
+
now
|
|
508
|
+
});
|
|
509
|
+
if (capacityPlan && capacityPlan.grants.length > 0 && !capacityEnvelope) {
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
492
512
|
const created = await sdk.startWorkDay({
|
|
493
513
|
projectId: config.projectId,
|
|
494
514
|
capacityBudget: policy.dailyTaskCreditBudget,
|
|
495
|
-
graphVersion:
|
|
515
|
+
graphVersion: null,
|
|
496
516
|
summary: {
|
|
497
517
|
openedAt: now.toISOString(),
|
|
498
518
|
environment: config.environment,
|
|
499
|
-
|
|
519
|
+
graphRefresh: { state: "queued" },
|
|
520
|
+
capacityPlan: capacityPlan ? summarizeCapacityPlan(capacityPlan) : null,
|
|
521
|
+
capacityEnvelope
|
|
500
522
|
},
|
|
501
523
|
actor: "manager"
|
|
502
524
|
});
|
|
525
|
+
if (created.payload) {
|
|
526
|
+
await seedGraphRefreshTask(sdk, {
|
|
527
|
+
workDayId: String(created.payload.id),
|
|
528
|
+
projectId: config.projectId,
|
|
529
|
+
actor: "manager"
|
|
530
|
+
});
|
|
531
|
+
}
|
|
503
532
|
return created.payload;
|
|
504
533
|
}
|
|
534
|
+
async function reserveWorkdayCapacity(options) {
|
|
535
|
+
if (!options.capacityPlan || options.capacityPlan.grants.length === 0 || options.capacityPlan.lanes.length === 0) {
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
const activeGrants = options.capacityPlan.grants.filter((grant2) => grant2.state === "active");
|
|
539
|
+
const candidates = activeGrants.flatMap((grant2) => {
|
|
540
|
+
const lane = grant2.laneId ? options.capacityPlan?.lanes.find((entry) => entry.id === grant2.laneId) : options.capacityPlan?.lanes.find((entry) => entry.capacityProviderId === grant2.capacityProviderId);
|
|
541
|
+
if (!lane) return [];
|
|
542
|
+
return [{
|
|
543
|
+
lane,
|
|
544
|
+
grant: grant2,
|
|
545
|
+
remainingCredits: grant2.dailyCreditLimit ?? options.capacityPlan?.remaining.dailyCredits ?? null,
|
|
546
|
+
taskKind: "workday"
|
|
547
|
+
}];
|
|
548
|
+
});
|
|
549
|
+
const selected = selectBestCapacityLane(candidates).selected;
|
|
550
|
+
if (!selected || !options.reporter?.enabled) {
|
|
551
|
+
return null;
|
|
552
|
+
}
|
|
553
|
+
const grant = activeGrants.find((entry) => entry.laneId === selected.laneId || entry.capacityProviderId === selected.capacityProviderId);
|
|
554
|
+
const estimate = reserveCreditsForEstimate({
|
|
555
|
+
taskKind: "workday",
|
|
556
|
+
confidence: "medium",
|
|
557
|
+
estimatedCreditsP50: options.policy.dailyTaskCreditBudget,
|
|
558
|
+
estimatedCreditsP90: options.policy.dailyTaskCreditBudget
|
|
559
|
+
});
|
|
560
|
+
const reservation = await options.reporter.createCapacityReservation({
|
|
561
|
+
capacityProviderId: selected.capacityProviderId,
|
|
562
|
+
laneId: selected.laneId,
|
|
563
|
+
teamId: options.capacityPlan.teamId,
|
|
564
|
+
projectId: options.config.projectId,
|
|
565
|
+
workDayId: null,
|
|
566
|
+
taskId: null,
|
|
567
|
+
reservedCredits: estimate.reservedCredits,
|
|
568
|
+
metadata: {
|
|
569
|
+
environment: options.config.environment,
|
|
570
|
+
grantId: grant?.id ?? null,
|
|
571
|
+
createdBy: "manager.openWorkday",
|
|
572
|
+
createdAt: options.now.toISOString()
|
|
573
|
+
}
|
|
574
|
+
}).catch(() => null);
|
|
575
|
+
if (!reservation) {
|
|
576
|
+
return null;
|
|
577
|
+
}
|
|
578
|
+
await options.reporter.reportCapacityRoutingDecision({
|
|
579
|
+
projectId: options.config.projectId,
|
|
580
|
+
selectedProviderId: selected.capacityProviderId,
|
|
581
|
+
selectedLaneId: selected.laneId,
|
|
582
|
+
decision: "workday_capacity_reserved",
|
|
583
|
+
reason: "Selected eligible capacity lane for workday reservation.",
|
|
584
|
+
scores: { selected },
|
|
585
|
+
candidates: candidates.map((candidate) => ({
|
|
586
|
+
laneId: candidate.lane.id,
|
|
587
|
+
capacityProviderId: candidate.lane.capacityProviderId,
|
|
588
|
+
grantId: candidate.grant?.id ?? null
|
|
589
|
+
}))
|
|
590
|
+
}).catch(() => null);
|
|
591
|
+
return {
|
|
592
|
+
providerId: selected.capacityProviderId,
|
|
593
|
+
laneId: selected.laneId,
|
|
594
|
+
reservationIds: [reservation.id],
|
|
595
|
+
maxCredits: estimate.reservedCredits,
|
|
596
|
+
approvalBehavior: "pause_task",
|
|
597
|
+
pausePolicy: {
|
|
598
|
+
onOverrun: "pause_for_approval"
|
|
599
|
+
},
|
|
600
|
+
metadata: {
|
|
601
|
+
grantId: grant?.id ?? null,
|
|
602
|
+
scarcityLevel: options.capacityPlan.lanes.find((lane) => lane.id === selected.laneId)?.scarcityLevel ?? null
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
}
|
|
505
606
|
function remainingCredits(workDay, policy) {
|
|
506
607
|
if (!workDay) {
|
|
507
608
|
return policy.dailyTaskCreditBudget;
|
|
@@ -510,6 +611,25 @@ function remainingCredits(workDay, policy) {
|
|
|
510
611
|
const used = Number(workDay.capacityUsed ?? 0);
|
|
511
612
|
return Math.max(0, budget - used);
|
|
512
613
|
}
|
|
614
|
+
function capacityEnvelopeFromWorkDay(workDay, maxCredits) {
|
|
615
|
+
const summary = parseJsonString(workDay.summaryJson ?? workDay.summary_json, {});
|
|
616
|
+
const envelope = asRecord(summary.capacityEnvelope);
|
|
617
|
+
if (!Object.keys(envelope).length) {
|
|
618
|
+
return maxCredits ? {
|
|
619
|
+
maxCredits,
|
|
620
|
+
approvalBehavior: "pause_task",
|
|
621
|
+
pausePolicy: { onOverrun: "pause_for_approval" }
|
|
622
|
+
} : null;
|
|
623
|
+
}
|
|
624
|
+
return {
|
|
625
|
+
...envelope,
|
|
626
|
+
maxCredits: maxCredits ?? readNumber(envelope, "maxCredits") ?? null,
|
|
627
|
+
metadata: {
|
|
628
|
+
...asRecord(envelope.metadata),
|
|
629
|
+
inheritedFromWorkDay: true
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
}
|
|
513
633
|
function chooseAgentId(agentSpecs) {
|
|
514
634
|
const preferred = agentSpecs.find((spec) => {
|
|
515
635
|
const triggers = Array.isArray(spec.triggers) ? spec.triggers : [];
|
|
@@ -590,6 +710,7 @@ async function topUpQueuedTasks(sdk, config, policy, workDay, snapshot, now) {
|
|
|
590
710
|
estimatedCredits,
|
|
591
711
|
priority: item.priority,
|
|
592
712
|
reasons: item.reasons,
|
|
713
|
+
capacityEnvelope: capacityEnvelopeFromWorkDay(workDay, estimatedCredits),
|
|
593
714
|
createdAt: now.toISOString()
|
|
594
715
|
},
|
|
595
716
|
graphVersion: typeof workDay.graphVersion === "string" ? workDay.graphVersion : null,
|
|
@@ -710,6 +831,7 @@ async function materializeAgentTriggerTasks(sdk, workDay, now) {
|
|
|
710
831
|
executionKind: "agent_trigger",
|
|
711
832
|
agentSlug: agent.slug,
|
|
712
833
|
invocation,
|
|
834
|
+
capacityEnvelope: capacityEnvelopeFromWorkDay(workDay),
|
|
713
835
|
createdAt: now.toISOString()
|
|
714
836
|
},
|
|
715
837
|
graphVersion: typeof workDay.graphVersion === "string" ? workDay.graphVersion : null,
|
|
@@ -840,26 +962,44 @@ async function buildWorkdaySummary(sdk, config, workDay, policy, currentSnapshot
|
|
|
840
962
|
}
|
|
841
963
|
async function reportWorkdaySummary(sdk, reporter, config, workDay, policy, currentSnapshot, scaleDecision, scaleResult) {
|
|
842
964
|
const summary = await buildWorkdaySummary(sdk, config, workDay, policy, currentSnapshot, scaleDecision, scaleResult);
|
|
965
|
+
const capacityPlan = await reporter.getProjectCapacityPlan(config.environment).catch(() => null);
|
|
966
|
+
const enrichedSummary = {
|
|
967
|
+
...summary,
|
|
968
|
+
capacity: capacityPlan ? {
|
|
969
|
+
...summarizeCapacityPlan(capacityPlan),
|
|
970
|
+
providerSplit: capacityPlan.activeReservations.filter((reservation) => reservation.workDayId === String(workDay.id ?? "") || reservation.workDayId === null).map((reservation) => ({
|
|
971
|
+
providerId: reservation.capacityProviderId,
|
|
972
|
+
laneId: reservation.laneId,
|
|
973
|
+
state: reservation.state,
|
|
974
|
+
reservedCredits: reservation.reservedCredits,
|
|
975
|
+
consumedCredits: reservation.consumedCredits,
|
|
976
|
+
reservedProviderUnits: reservation.reservedProviderUnits,
|
|
977
|
+
consumedProviderUnits: reservation.consumedProviderUnits,
|
|
978
|
+
reservedUsd: reservation.reservedUsd,
|
|
979
|
+
consumedUsd: reservation.consumedUsd
|
|
980
|
+
}))
|
|
981
|
+
} : null
|
|
982
|
+
};
|
|
843
983
|
const snapshot = writeWorkdayContentSnapshot({
|
|
844
984
|
repoRoot: process.env.TREESEED_AGENT_REPO_ROOT?.trim() || process.cwd(),
|
|
845
985
|
projectId: config.projectId,
|
|
846
986
|
teamId: config.teamId,
|
|
847
987
|
environment: config.environment,
|
|
848
988
|
workDay,
|
|
849
|
-
summary,
|
|
989
|
+
summary: enrichedSummary,
|
|
850
990
|
prioritySnapshot: currentSnapshot,
|
|
851
991
|
scaleDecision,
|
|
852
992
|
scaleResult,
|
|
853
|
-
tasks: Array.isArray(
|
|
854
|
-
changedFiles: Array.isArray(
|
|
855
|
-
releases: Array.isArray(
|
|
856
|
-
generatedAt: String(
|
|
993
|
+
tasks: Array.isArray(enrichedSummary.taskItems) ? enrichedSummary.taskItems : [],
|
|
994
|
+
changedFiles: Array.isArray(enrichedSummary.changedFiles) ? enrichedSummary.changedFiles.filter((entry) => typeof entry === "string") : [],
|
|
995
|
+
releases: Array.isArray(enrichedSummary.releases) ? enrichedSummary.releases : [],
|
|
996
|
+
generatedAt: String(enrichedSummary.generatedAt ?? (/* @__PURE__ */ new Date()).toISOString())
|
|
857
997
|
});
|
|
858
998
|
const report = await sdk.createReport({
|
|
859
999
|
workDayId: String(workDay.id ?? ""),
|
|
860
1000
|
kind: "workday_summary",
|
|
861
1001
|
body: {
|
|
862
|
-
...
|
|
1002
|
+
...enrichedSummary,
|
|
863
1003
|
contentSnapshot: {
|
|
864
1004
|
relativePath: snapshot.relativePath,
|
|
865
1005
|
slug: snapshot.slug,
|
|
@@ -868,7 +1008,7 @@ async function reportWorkdaySummary(sdk, reporter, config, workDay, policy, curr
|
|
|
868
1008
|
}
|
|
869
1009
|
},
|
|
870
1010
|
renderedRef: snapshot.relativePath,
|
|
871
|
-
sentAt: String(
|
|
1011
|
+
sentAt: String(enrichedSummary.generatedAt ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
872
1012
|
actor: "manager"
|
|
873
1013
|
});
|
|
874
1014
|
await reporter.reportWorkdaySummary({
|
|
@@ -878,7 +1018,7 @@ async function reportWorkdaySummary(sdk, reporter, config, workDay, policy, curr
|
|
|
878
1018
|
state: String(workDay.state ?? "active"),
|
|
879
1019
|
startedAt: readString(workDay, "startedAt", "started_at") || null,
|
|
880
1020
|
endedAt: readString(workDay, "endedAt", "ended_at") || null,
|
|
881
|
-
summary,
|
|
1021
|
+
summary: enrichedSummary,
|
|
882
1022
|
metadata: {
|
|
883
1023
|
projectId: config.projectId,
|
|
884
1024
|
contentSnapshot: {
|
|
@@ -890,7 +1030,7 @@ async function reportWorkdaySummary(sdk, reporter, config, workDay, policy, curr
|
|
|
890
1030
|
}
|
|
891
1031
|
});
|
|
892
1032
|
return {
|
|
893
|
-
...
|
|
1033
|
+
...enrichedSummary,
|
|
894
1034
|
contentSnapshot: {
|
|
895
1035
|
relativePath: snapshot.relativePath,
|
|
896
1036
|
slug: snapshot.slug,
|
|
@@ -916,13 +1056,35 @@ async function reconcileManager(options) {
|
|
|
916
1056
|
const scaler = resolveScaler(config, options.scaler);
|
|
917
1057
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
918
1058
|
const policy = await ensureWorkPolicy(sdk, config);
|
|
919
|
-
|
|
1059
|
+
if (policy.enabled === false) {
|
|
1060
|
+
return {
|
|
1061
|
+
ok: true,
|
|
1062
|
+
mode: "reconcile",
|
|
1063
|
+
managerId: config.managerId,
|
|
1064
|
+
projectId: config.projectId,
|
|
1065
|
+
environment: config.environment,
|
|
1066
|
+
insideWorkWindow: false,
|
|
1067
|
+
workPolicy: policy,
|
|
1068
|
+
workDay: null,
|
|
1069
|
+
prioritySnapshot: null,
|
|
1070
|
+
seededTasks: [],
|
|
1071
|
+
queuedCount: 0,
|
|
1072
|
+
activeLeases: 0,
|
|
1073
|
+
desiredWorkers: 0,
|
|
1074
|
+
scaleResult: { applied: false, provider: "noop", desiredWorkers: 0, metadata: { reason: "workday_policy_disabled" } },
|
|
1075
|
+
workdaySummary: null
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
const pendingWorkdayRequests = typeof sdk.listWorkdayRequests === "function" ? (await sdk.listWorkdayRequests(config.projectId, config.environment, "pending").catch(() => ({ payload: [] }))).payload ?? [] : [];
|
|
1079
|
+
const manualRunRequested = pendingWorkdayRequests.some((entry) => entry.type === "one_off_run" || entry.type === "retry_open");
|
|
1080
|
+
const earlyCloseRequested = pendingWorkdayRequests.some((entry) => entry.type === "early_close");
|
|
1081
|
+
const insideWorkWindow = !earlyCloseRequested && (manualRunRequested || isWithinWorkWindow(now, policy.schedule));
|
|
920
1082
|
let activeWorkDay = await getActiveWorkDay(sdk, config.projectId);
|
|
921
1083
|
let currentSnapshot = null;
|
|
922
1084
|
if (!activeWorkDay && insideWorkWindow && policy.dailyTaskCreditBudget > 0) {
|
|
923
1085
|
const previewSnapshot = await buildPrioritySnapshot(sdk, config, policy, now, null);
|
|
924
1086
|
if ((previewSnapshot?.items.length ?? 0) > 0) {
|
|
925
|
-
activeWorkDay = await openWorkday(sdk, config, policy, now);
|
|
1087
|
+
activeWorkDay = await openWorkday(sdk, config, policy, now, reporter);
|
|
926
1088
|
currentSnapshot = activeWorkDay ? await buildPrioritySnapshot(sdk, config, policy, now, String(activeWorkDay.id ?? "")) : previewSnapshot;
|
|
927
1089
|
}
|
|
928
1090
|
}
|
|
@@ -1038,16 +1200,20 @@ async function reconcileManager(options) {
|
|
|
1038
1200
|
async function runOpenWorkday(options) {
|
|
1039
1201
|
const config = options.config ?? resolveManagerServiceConfig();
|
|
1040
1202
|
const sdk = options.sdk ?? createServiceSdk();
|
|
1203
|
+
const reporter = await resolveReporter(options.reporter);
|
|
1041
1204
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
1042
1205
|
const policy = await ensureWorkPolicy(sdk, config);
|
|
1043
1206
|
const active = await getActiveWorkDay(sdk, config.projectId);
|
|
1044
1207
|
if (active) {
|
|
1045
1208
|
return { ok: true, created: false, workDay: active };
|
|
1046
1209
|
}
|
|
1210
|
+
if (policy.enabled === false) {
|
|
1211
|
+
return { ok: true, created: false, skipped: true, reason: "workday_policy_disabled" };
|
|
1212
|
+
}
|
|
1047
1213
|
if (!isWithinWorkWindow(now, policy.schedule)) {
|
|
1048
1214
|
return { ok: true, created: false, skipped: true, reason: "outside_work_window" };
|
|
1049
1215
|
}
|
|
1050
|
-
const workDay = await openWorkday(sdk, config, policy, now);
|
|
1216
|
+
const workDay = await openWorkday(sdk, config, policy, now, reporter);
|
|
1051
1217
|
const prioritySnapshot = workDay ? await buildPrioritySnapshot(sdk, config, policy, now, String(workDay.id ?? "")) : null;
|
|
1052
1218
|
return { ok: true, created: Boolean(workDay), workDay, prioritySnapshot };
|
|
1053
1219
|
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createServiceSdk } from './common.ts';
|
|
3
|
+
import { resolveManagerServiceConfig } from './manager.ts';
|
|
4
|
+
type WorkdayManagerSdk = ReturnType<typeof createServiceSdk>;
|
|
5
|
+
type WorkdayManagerConfig = ReturnType<typeof resolveManagerServiceConfig>;
|
|
6
|
+
export declare function runScheduledWorkdayManager(options?: {
|
|
7
|
+
sdk?: WorkdayManagerSdk;
|
|
8
|
+
config?: WorkdayManagerConfig;
|
|
9
|
+
now?: Date;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
ok: boolean;
|
|
12
|
+
skipped: boolean;
|
|
13
|
+
reason: string;
|
|
14
|
+
initial?: undefined;
|
|
15
|
+
latest?: undefined;
|
|
16
|
+
closed?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
skipped: boolean;
|
|
20
|
+
reason: string;
|
|
21
|
+
initial: {
|
|
22
|
+
ok: boolean;
|
|
23
|
+
mode: "reconcile";
|
|
24
|
+
managerId: string;
|
|
25
|
+
projectId: string;
|
|
26
|
+
environment: "local" | "prod" | "staging";
|
|
27
|
+
insideWorkWindow: boolean;
|
|
28
|
+
workPolicy: import("@treeseed/sdk").WorkdayPolicy;
|
|
29
|
+
workDay: Record<string, unknown>;
|
|
30
|
+
prioritySnapshot: import("@treeseed/sdk").PrioritySnapshot;
|
|
31
|
+
seededTasks: {
|
|
32
|
+
[x: string]: unknown;
|
|
33
|
+
}[];
|
|
34
|
+
queuedCount: number;
|
|
35
|
+
activeLeases: number;
|
|
36
|
+
desiredWorkers: number;
|
|
37
|
+
scaleResult: import("@treeseed/sdk").WorkerPoolScaleResult;
|
|
38
|
+
workdaySummary: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
latest?: undefined;
|
|
41
|
+
closed?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
ok: boolean;
|
|
44
|
+
initial: {
|
|
45
|
+
ok: boolean;
|
|
46
|
+
mode: "reconcile";
|
|
47
|
+
managerId: string;
|
|
48
|
+
projectId: string;
|
|
49
|
+
environment: "local" | "prod" | "staging";
|
|
50
|
+
insideWorkWindow: boolean;
|
|
51
|
+
workPolicy: import("@treeseed/sdk").WorkdayPolicy;
|
|
52
|
+
workDay: Record<string, unknown>;
|
|
53
|
+
prioritySnapshot: import("@treeseed/sdk").PrioritySnapshot;
|
|
54
|
+
seededTasks: {
|
|
55
|
+
[x: string]: unknown;
|
|
56
|
+
}[];
|
|
57
|
+
queuedCount: number;
|
|
58
|
+
activeLeases: number;
|
|
59
|
+
desiredWorkers: number;
|
|
60
|
+
scaleResult: import("@treeseed/sdk").WorkerPoolScaleResult;
|
|
61
|
+
workdaySummary: Record<string, unknown>;
|
|
62
|
+
};
|
|
63
|
+
latest: {
|
|
64
|
+
ok: boolean;
|
|
65
|
+
mode: "reconcile";
|
|
66
|
+
managerId: string;
|
|
67
|
+
projectId: string;
|
|
68
|
+
environment: "local" | "prod" | "staging";
|
|
69
|
+
insideWorkWindow: boolean;
|
|
70
|
+
workPolicy: import("@treeseed/sdk").WorkdayPolicy;
|
|
71
|
+
workDay: Record<string, unknown>;
|
|
72
|
+
prioritySnapshot: import("@treeseed/sdk").PrioritySnapshot;
|
|
73
|
+
seededTasks: {
|
|
74
|
+
[x: string]: unknown;
|
|
75
|
+
}[];
|
|
76
|
+
queuedCount: number;
|
|
77
|
+
activeLeases: number;
|
|
78
|
+
desiredWorkers: number;
|
|
79
|
+
scaleResult: import("@treeseed/sdk").WorkerPoolScaleResult;
|
|
80
|
+
workdaySummary: Record<string, unknown>;
|
|
81
|
+
};
|
|
82
|
+
closed: {
|
|
83
|
+
ok: boolean;
|
|
84
|
+
mode: "reconcile";
|
|
85
|
+
managerId: string;
|
|
86
|
+
projectId: string;
|
|
87
|
+
environment: "local" | "prod" | "staging";
|
|
88
|
+
insideWorkWindow: boolean;
|
|
89
|
+
workPolicy: import("@treeseed/sdk").WorkdayPolicy;
|
|
90
|
+
workDay: Record<string, unknown>;
|
|
91
|
+
prioritySnapshot: import("@treeseed/sdk").PrioritySnapshot;
|
|
92
|
+
seededTasks: {
|
|
93
|
+
[x: string]: unknown;
|
|
94
|
+
}[];
|
|
95
|
+
queuedCount: number;
|
|
96
|
+
activeLeases: number;
|
|
97
|
+
desiredWorkers: number;
|
|
98
|
+
scaleResult: import("@treeseed/sdk").WorkerPoolScaleResult;
|
|
99
|
+
workdaySummary: Record<string, unknown>;
|
|
100
|
+
} | {
|
|
101
|
+
ok: boolean;
|
|
102
|
+
created: boolean;
|
|
103
|
+
workDay: Record<string, unknown>;
|
|
104
|
+
skipped?: undefined;
|
|
105
|
+
reason?: undefined;
|
|
106
|
+
prioritySnapshot?: undefined;
|
|
107
|
+
} | {
|
|
108
|
+
ok: boolean;
|
|
109
|
+
created: boolean;
|
|
110
|
+
skipped: boolean;
|
|
111
|
+
reason: string;
|
|
112
|
+
workDay?: undefined;
|
|
113
|
+
prioritySnapshot?: undefined;
|
|
114
|
+
} | {
|
|
115
|
+
ok: boolean;
|
|
116
|
+
created: boolean;
|
|
117
|
+
workDay: import("@treeseed/sdk").SdkWorkDayEntity;
|
|
118
|
+
prioritySnapshot: import("@treeseed/sdk").PrioritySnapshot;
|
|
119
|
+
skipped?: undefined;
|
|
120
|
+
reason?: undefined;
|
|
121
|
+
} | {
|
|
122
|
+
ok: boolean;
|
|
123
|
+
skipped: boolean;
|
|
124
|
+
reason: string;
|
|
125
|
+
workDay?: undefined;
|
|
126
|
+
summary?: undefined;
|
|
127
|
+
scale?: undefined;
|
|
128
|
+
} | {
|
|
129
|
+
ok: boolean;
|
|
130
|
+
workDay: import("@treeseed/sdk").SdkWorkDayEntity;
|
|
131
|
+
summary: {
|
|
132
|
+
contentSnapshot: {
|
|
133
|
+
relativePath: string;
|
|
134
|
+
slug: string;
|
|
135
|
+
reportVersion: string;
|
|
136
|
+
title: string;
|
|
137
|
+
};
|
|
138
|
+
capacity: {
|
|
139
|
+
providerSplit: any;
|
|
140
|
+
grantedDailyCredits: number;
|
|
141
|
+
reservedCredits: number;
|
|
142
|
+
consumedCredits: number;
|
|
143
|
+
remainingDailyCredits: number | null;
|
|
144
|
+
providerCount: number;
|
|
145
|
+
laneCount: number;
|
|
146
|
+
grantCount: number;
|
|
147
|
+
};
|
|
148
|
+
projectId: string;
|
|
149
|
+
environment: "local" | "prod" | "staging";
|
|
150
|
+
workDayId: string;
|
|
151
|
+
state: string;
|
|
152
|
+
totalTasks: number;
|
|
153
|
+
completedTasks: number;
|
|
154
|
+
failedTasks: number;
|
|
155
|
+
queuedTasks: number;
|
|
156
|
+
activeTasks: number;
|
|
157
|
+
dailyTaskCreditBudget: number;
|
|
158
|
+
usedTaskCredits: number;
|
|
159
|
+
remainingTaskCredits: number;
|
|
160
|
+
creditLedgerEntries: number;
|
|
161
|
+
prioritySnapshotId: string;
|
|
162
|
+
priorityItemCount: number;
|
|
163
|
+
priorityItems: import("@treeseed/sdk").PrioritySnapshotItem[];
|
|
164
|
+
taskItems: {
|
|
165
|
+
id: string;
|
|
166
|
+
agentId: string;
|
|
167
|
+
type: string;
|
|
168
|
+
state: string;
|
|
169
|
+
priority: number;
|
|
170
|
+
idempotencyKey: string;
|
|
171
|
+
createdAt: string;
|
|
172
|
+
startedAt: string;
|
|
173
|
+
completedAt: string;
|
|
174
|
+
lastErrorCode: string;
|
|
175
|
+
lastErrorMessage: string;
|
|
176
|
+
lastEventKind: string;
|
|
177
|
+
outputCount: number;
|
|
178
|
+
changedFiles: string[];
|
|
179
|
+
}[];
|
|
180
|
+
changedFiles: string[];
|
|
181
|
+
releases: {
|
|
182
|
+
id: string;
|
|
183
|
+
deploymentKind: string;
|
|
184
|
+
status: string;
|
|
185
|
+
releaseTag: string;
|
|
186
|
+
commitSha: string;
|
|
187
|
+
sourceRef: string;
|
|
188
|
+
startedAt: string;
|
|
189
|
+
finishedAt: string;
|
|
190
|
+
createdAt: string;
|
|
191
|
+
}[];
|
|
192
|
+
scaleDecision: import("@treeseed/sdk").ScaleDecision;
|
|
193
|
+
scaleResult: import("@treeseed/sdk").WorkerPoolScaleResult;
|
|
194
|
+
generatedAt: string;
|
|
195
|
+
};
|
|
196
|
+
scale: import("@treeseed/sdk").WorkerPoolScaleResult;
|
|
197
|
+
skipped?: undefined;
|
|
198
|
+
reason?: undefined;
|
|
199
|
+
} | {
|
|
200
|
+
ok: boolean;
|
|
201
|
+
skipped: boolean;
|
|
202
|
+
reason: string;
|
|
203
|
+
workDayId?: undefined;
|
|
204
|
+
summary?: undefined;
|
|
205
|
+
} | {
|
|
206
|
+
ok: boolean;
|
|
207
|
+
workDayId: unknown;
|
|
208
|
+
summary: {
|
|
209
|
+
contentSnapshot: {
|
|
210
|
+
relativePath: string;
|
|
211
|
+
slug: string;
|
|
212
|
+
reportVersion: string;
|
|
213
|
+
title: string;
|
|
214
|
+
};
|
|
215
|
+
capacity: {
|
|
216
|
+
providerSplit: any;
|
|
217
|
+
grantedDailyCredits: number;
|
|
218
|
+
reservedCredits: number;
|
|
219
|
+
consumedCredits: number;
|
|
220
|
+
remainingDailyCredits: number | null;
|
|
221
|
+
providerCount: number;
|
|
222
|
+
laneCount: number;
|
|
223
|
+
grantCount: number;
|
|
224
|
+
};
|
|
225
|
+
projectId: string;
|
|
226
|
+
environment: "local" | "prod" | "staging";
|
|
227
|
+
workDayId: string;
|
|
228
|
+
state: string;
|
|
229
|
+
totalTasks: number;
|
|
230
|
+
completedTasks: number;
|
|
231
|
+
failedTasks: number;
|
|
232
|
+
queuedTasks: number;
|
|
233
|
+
activeTasks: number;
|
|
234
|
+
dailyTaskCreditBudget: number;
|
|
235
|
+
usedTaskCredits: number;
|
|
236
|
+
remainingTaskCredits: number;
|
|
237
|
+
creditLedgerEntries: number;
|
|
238
|
+
prioritySnapshotId: string;
|
|
239
|
+
priorityItemCount: number;
|
|
240
|
+
priorityItems: import("@treeseed/sdk").PrioritySnapshotItem[];
|
|
241
|
+
taskItems: {
|
|
242
|
+
id: string;
|
|
243
|
+
agentId: string;
|
|
244
|
+
type: string;
|
|
245
|
+
state: string;
|
|
246
|
+
priority: number;
|
|
247
|
+
idempotencyKey: string;
|
|
248
|
+
createdAt: string;
|
|
249
|
+
startedAt: string;
|
|
250
|
+
completedAt: string;
|
|
251
|
+
lastErrorCode: string;
|
|
252
|
+
lastErrorMessage: string;
|
|
253
|
+
lastEventKind: string;
|
|
254
|
+
outputCount: number;
|
|
255
|
+
changedFiles: string[];
|
|
256
|
+
}[];
|
|
257
|
+
changedFiles: string[];
|
|
258
|
+
releases: {
|
|
259
|
+
id: string;
|
|
260
|
+
deploymentKind: string;
|
|
261
|
+
status: string;
|
|
262
|
+
releaseTag: string;
|
|
263
|
+
commitSha: string;
|
|
264
|
+
sourceRef: string;
|
|
265
|
+
startedAt: string;
|
|
266
|
+
finishedAt: string;
|
|
267
|
+
createdAt: string;
|
|
268
|
+
}[];
|
|
269
|
+
scaleDecision: import("@treeseed/sdk").ScaleDecision;
|
|
270
|
+
scaleResult: import("@treeseed/sdk").WorkerPoolScaleResult;
|
|
271
|
+
generatedAt: string;
|
|
272
|
+
};
|
|
273
|
+
skipped?: undefined;
|
|
274
|
+
reason?: undefined;
|
|
275
|
+
};
|
|
276
|
+
skipped?: undefined;
|
|
277
|
+
reason?: undefined;
|
|
278
|
+
}>;
|
|
279
|
+
export {};
|