@treeseed/sdk 0.10.10 → 0.10.12
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 +2 -2
- package/dist/capacity-provider.d.ts +53 -1
- package/dist/capacity.d.ts +80 -1
- package/dist/capacity.js +687 -8
- package/dist/db/d1.d.ts +109 -3227
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.js +1 -0
- package/dist/db/market-schema.d.ts +42517 -0
- package/dist/db/market-schema.js +1822 -0
- package/dist/db/node-sqlite.d.ts +109 -3227
- package/dist/db/schema.d.ts +226 -5757
- package/dist/db/schema.js +35 -226
- package/dist/index.d.ts +4 -4
- package/dist/index.js +14 -0
- package/dist/market-client.d.ts +28 -0
- package/dist/market-client.js +43 -0
- package/dist/operations/services/commit-message-provider.js +1 -1
- package/dist/operations/services/d1-migration.js +0 -59
- package/dist/operations/services/deploy.js +2 -1
- package/dist/operations/services/local-dev.js +3 -3
- package/dist/operations/services/release-candidate.js +9 -9
- package/dist/operations/services/runtime-paths.d.ts +1 -1
- package/dist/operations/services/runtime-paths.js +2 -2
- package/dist/operations/services/template-registry.js +10 -1
- package/dist/scripts/tenant-d1-migrate-local.js +2 -3
- package/dist/sdk-types.d.ts +172 -2
- package/dist/seeds/normalize.js +6 -0
- package/dist/seeds/schema.js +61 -1
- package/dist/seeds/types.d.ts +32 -0
- package/drizzle/d1/0000_treeseed_d1.sql +37 -0
- package/drizzle/market/0000_market_control_plane.sql +2863 -0
- package/drizzle/market/0001_capacity_budget_mode_default.sql +4 -0
- package/package.json +8 -1
|
@@ -543,30 +543,30 @@ async function configParityChecks(root, failures) {
|
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
545
|
function migrationCompatibilityChecks(root, failures) {
|
|
546
|
-
if (!existsSync(resolve(root, "
|
|
546
|
+
if (!existsSync(resolve(root, "packages/sdk/package.json"))) {
|
|
547
547
|
return {
|
|
548
548
|
name: "migration-compatibility",
|
|
549
549
|
status: "skipped",
|
|
550
|
-
detail: "No
|
|
550
|
+
detail: "No SDK package checkout is present in this workspace."
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
|
-
const
|
|
554
|
-
"
|
|
555
|
-
"
|
|
553
|
+
const requiredArtifacts = [
|
|
554
|
+
"packages/sdk/drizzle/d1/0000_treeseed_d1.sql",
|
|
555
|
+
"packages/sdk/drizzle/market/0000_market_control_plane.sql"
|
|
556
556
|
];
|
|
557
|
-
const missing =
|
|
557
|
+
const missing = requiredArtifacts.filter((path) => !existsSync(resolve(root, path)));
|
|
558
558
|
for (const path of missing) {
|
|
559
559
|
addFailure(failures, {
|
|
560
|
-
code: "
|
|
560
|
+
code: "missing_drizzle_migration_artifact",
|
|
561
561
|
scope: "@treeseed/market",
|
|
562
|
-
message: `
|
|
562
|
+
message: `Drizzle migration compatibility check is missing ${path}.`,
|
|
563
563
|
details: { path }
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
return {
|
|
567
567
|
name: "migration-compatibility",
|
|
568
568
|
status: missing.length > 0 ? "failed" : "passed",
|
|
569
|
-
detail: "Checked required
|
|
569
|
+
detail: "Checked required Drizzle migration artifacts for Market PostgreSQL and SDK D1."
|
|
570
570
|
};
|
|
571
571
|
}
|
|
572
572
|
async function runReleaseCandidateGate(input) {
|
|
@@ -11,7 +11,7 @@ export declare const servicesRoot: string;
|
|
|
11
11
|
export declare const mailpitComposeFile: string;
|
|
12
12
|
export declare const fixtureRoot: string;
|
|
13
13
|
export declare const fixtureWranglerConfig: string;
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const sdkD1MigrationsRoot: string;
|
|
15
15
|
export declare const fixtureSrcRoot: string;
|
|
16
16
|
export declare const templateCatalogRoot: string;
|
|
17
17
|
export declare const localTemplateArtifactsRoot: string;
|
|
@@ -25,7 +25,7 @@ const servicesRoot = resolve(cliRuntimeRoot, "services");
|
|
|
25
25
|
const mailpitComposeFile = resolve(servicesRoot, "compose.yml");
|
|
26
26
|
const fixtureRoot = resolve(corePackageRoot, "fixture");
|
|
27
27
|
const fixtureWranglerConfig = resolve(fixtureRoot, "wrangler.toml");
|
|
28
|
-
const
|
|
28
|
+
const sdkD1MigrationsRoot = resolve(sdkPackageRoot, "drizzle", "d1");
|
|
29
29
|
const fixtureSrcRoot = resolve(fixtureRoot, "src");
|
|
30
30
|
const templateCatalogRoot = resolve(cliRuntimeRoot, "template-catalog");
|
|
31
31
|
const localTemplateArtifactsRoot = resolve(templateCatalogRoot, "templates");
|
|
@@ -40,7 +40,6 @@ export {
|
|
|
40
40
|
corePackageRoot,
|
|
41
41
|
corePackageVersion,
|
|
42
42
|
examplesRoot,
|
|
43
|
-
fixtureMigrationsRoot,
|
|
44
43
|
fixtureRoot,
|
|
45
44
|
fixtureSrcRoot,
|
|
46
45
|
fixtureWranglerConfig,
|
|
@@ -49,6 +48,7 @@ export {
|
|
|
49
48
|
mailpitComposeFile,
|
|
50
49
|
packageRoot,
|
|
51
50
|
referenceAppsRoot,
|
|
51
|
+
sdkD1MigrationsRoot,
|
|
52
52
|
sdkPackageVersion,
|
|
53
53
|
servicesRoot,
|
|
54
54
|
templateCatalogRoot,
|
|
@@ -126,11 +126,20 @@ function runGit(commandArgs, cwd) {
|
|
|
126
126
|
throw new Error(result.stderr?.trim() || result.stdout?.trim() || `git ${commandArgs.join(" ")} failed`);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
function readGitOutput(commandArgs, cwd) {
|
|
130
|
+
const result = spawnSync("git", commandArgs, {
|
|
131
|
+
cwd,
|
|
132
|
+
stdio: "pipe",
|
|
133
|
+
encoding: "utf8"
|
|
134
|
+
});
|
|
135
|
+
return result.status === 0 ? result.stdout.trim() : null;
|
|
136
|
+
}
|
|
129
137
|
function materializeGitTemplateSource(product, options) {
|
|
130
138
|
const cacheRoot = resolveTemplateSourceCacheRoot(product, options);
|
|
131
139
|
const repoRoot = resolve(cacheRoot, "repo");
|
|
132
140
|
const source = product.fulfillment.source;
|
|
133
|
-
|
|
141
|
+
const cachedOrigin = existsSync(resolve(repoRoot, ".git")) ? readGitOutput(["config", "--get", "remote.origin.url"], repoRoot) : null;
|
|
142
|
+
if (cachedOrigin !== source.repoUrl) {
|
|
134
143
|
rmSync(cacheRoot, { recursive: true, force: true });
|
|
135
144
|
mkdirSync(cacheRoot, { recursive: true });
|
|
136
145
|
runGit(["clone", "--no-checkout", source.repoUrl, repoRoot]);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
1
|
import { runLocalD1Migrations } from '../operations/services/d1-migration.js';
|
|
3
2
|
import { createPersistentDeployTarget, ensureGeneratedWranglerConfig } from '../operations/services/deploy.js';
|
|
3
|
+
import { sdkD1MigrationsRoot } from '../operations/services/runtime-paths.js';
|
|
4
4
|
const tenantRoot = process.cwd();
|
|
5
|
-
const migrationsRoot = resolve(tenantRoot, 'migrations');
|
|
6
5
|
const { wranglerPath: wranglerConfig } = ensureGeneratedWranglerConfig(tenantRoot, {
|
|
7
6
|
target: createPersistentDeployTarget('local'),
|
|
8
7
|
env: process.env,
|
|
@@ -10,7 +9,7 @@ const { wranglerPath: wranglerConfig } = ensureGeneratedWranglerConfig(tenantRoo
|
|
|
10
9
|
runLocalD1Migrations({
|
|
11
10
|
cwd: tenantRoot,
|
|
12
11
|
wranglerConfig,
|
|
13
|
-
migrationsRoot,
|
|
12
|
+
migrationsRoot: sdkD1MigrationsRoot,
|
|
14
13
|
persistTo: process.env.TREESEED_API_D1_LOCAL_PERSIST_TO?.trim() || undefined,
|
|
15
14
|
});
|
|
16
15
|
process.exit(0);
|
package/dist/sdk-types.d.ts
CHANGED
|
@@ -641,6 +641,7 @@ export interface CapacityProvider {
|
|
|
641
641
|
billingScope: CapacityProviderBillingScope;
|
|
642
642
|
monthlyCreditBudget: number;
|
|
643
643
|
dailyCreditBudget: number;
|
|
644
|
+
creditBudgetMode?: 'static' | 'hybrid' | 'derived' | string;
|
|
644
645
|
maxConcurrentWorkdays: number;
|
|
645
646
|
maxConcurrentWorkers: number;
|
|
646
647
|
capacityModel: Record<string, unknown>;
|
|
@@ -656,6 +657,53 @@ export interface CapacityProvider {
|
|
|
656
657
|
createdAt: string;
|
|
657
658
|
updatedAt: string;
|
|
658
659
|
}
|
|
660
|
+
export interface ExecutionProviderNativeLimit {
|
|
661
|
+
id: string;
|
|
662
|
+
executionProviderId: string;
|
|
663
|
+
scope: string;
|
|
664
|
+
nativeUnit: string;
|
|
665
|
+
limitAmount: number;
|
|
666
|
+
reserveBufferPercent: number;
|
|
667
|
+
resetCadence: string | null;
|
|
668
|
+
resetAt: string | null;
|
|
669
|
+
confidence: string;
|
|
670
|
+
source: string;
|
|
671
|
+
metadata?: Record<string, unknown>;
|
|
672
|
+
createdAt: string;
|
|
673
|
+
updatedAt: string;
|
|
674
|
+
}
|
|
675
|
+
export interface ExecutionProviderObservation {
|
|
676
|
+
id: string;
|
|
677
|
+
executionProviderId: string;
|
|
678
|
+
observedAt: string;
|
|
679
|
+
health: string;
|
|
680
|
+
activeWorkers: number | null;
|
|
681
|
+
queuedTasks: number | null;
|
|
682
|
+
throttleState: string | null;
|
|
683
|
+
nativeRemaining: Record<string, unknown>;
|
|
684
|
+
resetAt: string | null;
|
|
685
|
+
confidence: string;
|
|
686
|
+
metadata?: Record<string, unknown>;
|
|
687
|
+
createdAt: string;
|
|
688
|
+
}
|
|
689
|
+
export interface ExecutionProvider {
|
|
690
|
+
id: string;
|
|
691
|
+
teamId: string;
|
|
692
|
+
capacityProviderId: string | null;
|
|
693
|
+
name: string;
|
|
694
|
+
kind: string;
|
|
695
|
+
status: string;
|
|
696
|
+
nativeUnit: string;
|
|
697
|
+
quotaVisibility: string;
|
|
698
|
+
maxConcurrentWorkers: number;
|
|
699
|
+
resetCadence: string | null;
|
|
700
|
+
config: Record<string, unknown>;
|
|
701
|
+
metadata?: Record<string, unknown>;
|
|
702
|
+
nativeLimits?: ExecutionProviderNativeLimit[];
|
|
703
|
+
latestObservation?: ExecutionProviderObservation | null;
|
|
704
|
+
createdAt: string;
|
|
705
|
+
updatedAt: string;
|
|
706
|
+
}
|
|
659
707
|
export interface CapacityProviderHost {
|
|
660
708
|
id: string;
|
|
661
709
|
capacityProviderId: string;
|
|
@@ -697,6 +745,10 @@ export interface CapacityGrant {
|
|
|
697
745
|
dailyUsdLimit: number | null;
|
|
698
746
|
weeklyQuotaMinutes: number | null;
|
|
699
747
|
monthlyProviderUnits: number | null;
|
|
748
|
+
portfolioAllocationPercent?: number | null;
|
|
749
|
+
reservePoolPercent?: number | null;
|
|
750
|
+
maxDailyProjectCredits?: number | null;
|
|
751
|
+
emergencyOverride?: boolean;
|
|
700
752
|
priorityWeight: number;
|
|
701
753
|
overflowPolicy: CapacityOverflowPolicy;
|
|
702
754
|
metadata?: Record<string, unknown>;
|
|
@@ -706,6 +758,7 @@ export interface CapacityGrant {
|
|
|
706
758
|
export interface CapacityReservation {
|
|
707
759
|
id: string;
|
|
708
760
|
capacityProviderId: string;
|
|
761
|
+
executionProviderId?: string | null;
|
|
709
762
|
laneId: string;
|
|
710
763
|
teamId: string;
|
|
711
764
|
projectId: string;
|
|
@@ -714,6 +767,9 @@ export interface CapacityReservation {
|
|
|
714
767
|
state: CapacityReservationState;
|
|
715
768
|
reservedCredits: number;
|
|
716
769
|
consumedCredits: number;
|
|
770
|
+
nativeUnit?: string | null;
|
|
771
|
+
reservedNativeAmount?: number | null;
|
|
772
|
+
consumedNativeAmount?: number | null;
|
|
717
773
|
reservedProviderUnits: number | null;
|
|
718
774
|
consumedProviderUnits: number | null;
|
|
719
775
|
reservedUsd: number | null;
|
|
@@ -784,6 +840,7 @@ export interface TaskUsageActual {
|
|
|
784
840
|
taskSignature: string;
|
|
785
841
|
executionProfileId: string;
|
|
786
842
|
capacityProviderId: string | null;
|
|
843
|
+
executionProviderId?: string | null;
|
|
787
844
|
laneId: string | null;
|
|
788
845
|
businessModel: CapacityBusinessModel | string;
|
|
789
846
|
modelName: string | null;
|
|
@@ -800,9 +857,106 @@ export interface TaskUsageActual {
|
|
|
800
857
|
retryCount: number | null;
|
|
801
858
|
actualCredits: number;
|
|
802
859
|
actualUsd: number | null;
|
|
860
|
+
creditFormulaVersion?: string | null;
|
|
861
|
+
actualCreditSource?: string | null;
|
|
862
|
+
nativeUsage?: NativeUsageObservation | Record<string, unknown> | null;
|
|
803
863
|
metadata?: Record<string, unknown>;
|
|
804
864
|
createdAt: string;
|
|
805
865
|
}
|
|
866
|
+
export interface NativeUsageObservation {
|
|
867
|
+
nativeUnit?: string | null;
|
|
868
|
+
amount?: number | null;
|
|
869
|
+
wallMinutes?: number | null;
|
|
870
|
+
quotaMinutes?: number | null;
|
|
871
|
+
inputTokens?: number | null;
|
|
872
|
+
outputTokens?: number | null;
|
|
873
|
+
cachedInputTokens?: number | null;
|
|
874
|
+
usd?: number | null;
|
|
875
|
+
filesOpened?: number | null;
|
|
876
|
+
filesChanged?: number | null;
|
|
877
|
+
diffLinesAdded?: number | null;
|
|
878
|
+
diffLinesRemoved?: number | null;
|
|
879
|
+
testRuns?: number | null;
|
|
880
|
+
retryCount?: number | null;
|
|
881
|
+
partial?: boolean | null;
|
|
882
|
+
interrupted?: boolean | null;
|
|
883
|
+
source?: string | null;
|
|
884
|
+
observedAt?: string | null;
|
|
885
|
+
metadata?: Record<string, unknown> | null;
|
|
886
|
+
[key: string]: unknown;
|
|
887
|
+
}
|
|
888
|
+
export interface CreditConversionProfile {
|
|
889
|
+
id?: string | null;
|
|
890
|
+
taskSignature: string;
|
|
891
|
+
executionProfileId: string;
|
|
892
|
+
executionProviderKind: string;
|
|
893
|
+
nativeUnit: string;
|
|
894
|
+
sampleCount: number;
|
|
895
|
+
completedSampleCount: number;
|
|
896
|
+
interruptedSampleCount?: number;
|
|
897
|
+
nativeUnitsPerCreditP50: number | null;
|
|
898
|
+
nativeUnitsPerCreditP90: number | null;
|
|
899
|
+
creditsPerNativeUnitP50: number | null;
|
|
900
|
+
creditsPerNativeUnitP90: number | null;
|
|
901
|
+
actualCreditsP50: number | null;
|
|
902
|
+
actualCreditsP90: number | null;
|
|
903
|
+
confidence: 'low' | 'medium' | 'high' | string;
|
|
904
|
+
formulaVersion: string;
|
|
905
|
+
metadata?: Record<string, unknown>;
|
|
906
|
+
createdAt?: string | null;
|
|
907
|
+
updatedAt: string;
|
|
908
|
+
}
|
|
909
|
+
export interface DerivedCapacityAvailability {
|
|
910
|
+
executionProviderId: string;
|
|
911
|
+
capacityProviderId: string | null;
|
|
912
|
+
executionProviderKind: string;
|
|
913
|
+
nativeUnit: string;
|
|
914
|
+
scope: string | null;
|
|
915
|
+
configuredNativeLimit: number | null;
|
|
916
|
+
observedNativeRemaining: number | null;
|
|
917
|
+
nativeRemainingSource: 'observation' | 'configured_limit' | 'unknown';
|
|
918
|
+
activeReservedNativeAmount: number;
|
|
919
|
+
activeConsumedNativeAmount: number;
|
|
920
|
+
reserveBufferPercent: number;
|
|
921
|
+
reserveBufferNativeAmount: number;
|
|
922
|
+
availableNativeAmount: number;
|
|
923
|
+
nativeUnitsPerCredit: number | null;
|
|
924
|
+
conversionProfileId?: string | null;
|
|
925
|
+
conversionTaskSignature?: string | null;
|
|
926
|
+
conversionConfidence?: string | null;
|
|
927
|
+
derivedAvailableCredits: number | null;
|
|
928
|
+
confidence: 'low' | 'medium' | 'high' | string;
|
|
929
|
+
resetAt?: string | null;
|
|
930
|
+
reasons: string[];
|
|
931
|
+
metadata?: Record<string, unknown>;
|
|
932
|
+
}
|
|
933
|
+
export interface DerivedCapacitySummary {
|
|
934
|
+
entries: DerivedCapacityAvailability[];
|
|
935
|
+
totalDerivedAvailableCredits?: number | null;
|
|
936
|
+
derivedEntryCount?: number;
|
|
937
|
+
learningEntryCount?: number;
|
|
938
|
+
availableNativeByUnit?: Record<string, number>;
|
|
939
|
+
providers?: Array<{
|
|
940
|
+
capacityProviderId: string;
|
|
941
|
+
entries?: DerivedCapacityAvailability[];
|
|
942
|
+
totalDerivedAvailableCredits?: number | null;
|
|
943
|
+
derivedEntryCount?: number;
|
|
944
|
+
learningEntryCount?: number;
|
|
945
|
+
availableNativeByUnit?: Record<string, number>;
|
|
946
|
+
[key: string]: unknown;
|
|
947
|
+
}>;
|
|
948
|
+
[key: string]: unknown;
|
|
949
|
+
}
|
|
950
|
+
export interface DerivedCapacityInput {
|
|
951
|
+
executionProvider: ExecutionProvider;
|
|
952
|
+
nativeLimit?: ExecutionProviderNativeLimit | null;
|
|
953
|
+
latestObservation?: ExecutionProviderObservation | null;
|
|
954
|
+
activeReservations?: CapacityReservation[];
|
|
955
|
+
conversionProfile?: CreditConversionProfile | null;
|
|
956
|
+
scope?: string | null;
|
|
957
|
+
nativeUnit?: string | null;
|
|
958
|
+
now?: Date | string | null;
|
|
959
|
+
}
|
|
806
960
|
export interface TaskEstimateProfile {
|
|
807
961
|
taskSignature: string;
|
|
808
962
|
executionProfileId: string;
|
|
@@ -901,6 +1055,7 @@ export interface CapacityPlan {
|
|
|
901
1055
|
grants: CapacityGrant[];
|
|
902
1056
|
activeReservations: CapacityReservation[];
|
|
903
1057
|
estimateProfiles: TaskEstimateProfile[];
|
|
1058
|
+
derivedCapacity?: DerivedCapacitySummary | null;
|
|
904
1059
|
remaining: {
|
|
905
1060
|
dailyCredits: number | null;
|
|
906
1061
|
weeklyCredits: number | null;
|
|
@@ -1921,6 +2076,10 @@ export interface UpsertCapacityGrantRequest {
|
|
|
1921
2076
|
dailyUsdLimit?: number | null;
|
|
1922
2077
|
weeklyQuotaMinutes?: number | null;
|
|
1923
2078
|
monthlyProviderUnits?: number | null;
|
|
2079
|
+
portfolioAllocationPercent?: number | null;
|
|
2080
|
+
reservePoolPercent?: number | null;
|
|
2081
|
+
maxDailyProjectCredits?: number | null;
|
|
2082
|
+
emergencyOverride?: boolean;
|
|
1924
2083
|
priorityWeight?: number;
|
|
1925
2084
|
overflowPolicy?: CapacityOverflowPolicy;
|
|
1926
2085
|
metadata?: Record<string, unknown> | null;
|
|
@@ -1928,6 +2087,7 @@ export interface UpsertCapacityGrantRequest {
|
|
|
1928
2087
|
export interface CreateCapacityReservationRequest {
|
|
1929
2088
|
id?: string;
|
|
1930
2089
|
capacityProviderId: string;
|
|
2090
|
+
executionProviderId?: string | null;
|
|
1931
2091
|
laneId: string;
|
|
1932
2092
|
teamId: string;
|
|
1933
2093
|
projectId: string;
|
|
@@ -1935,6 +2095,9 @@ export interface CreateCapacityReservationRequest {
|
|
|
1935
2095
|
taskId?: string | null;
|
|
1936
2096
|
state?: CapacityReservationState;
|
|
1937
2097
|
reservedCredits: number;
|
|
2098
|
+
nativeUnit?: string | null;
|
|
2099
|
+
reservedNativeAmount?: number | null;
|
|
2100
|
+
consumedNativeAmount?: number | null;
|
|
1938
2101
|
reservedProviderUnits?: number | null;
|
|
1939
2102
|
reservedUsd?: number | null;
|
|
1940
2103
|
expiresAt?: string | null;
|
|
@@ -1951,6 +2114,8 @@ export interface RecordCapacityUsageRequest {
|
|
|
1951
2114
|
taskId?: string | null;
|
|
1952
2115
|
phase?: TaskCreditLedgerEntry['phase'];
|
|
1953
2116
|
credits: number;
|
|
2117
|
+
nativeUnit?: string | null;
|
|
2118
|
+
nativeAmount?: number | null;
|
|
1954
2119
|
providerUnits?: number | null;
|
|
1955
2120
|
usd?: number | null;
|
|
1956
2121
|
source?: string;
|
|
@@ -1999,8 +2164,9 @@ export interface CreateTaskUsageActualRequest {
|
|
|
1999
2164
|
taskSignature: string;
|
|
2000
2165
|
executionProfileId?: string | null;
|
|
2001
2166
|
capacityProviderId?: string | null;
|
|
2167
|
+
executionProviderId?: string | null;
|
|
2002
2168
|
laneId?: string | null;
|
|
2003
|
-
businessModel
|
|
2169
|
+
businessModel?: CapacityBusinessModel | string;
|
|
2004
2170
|
modelName?: string | null;
|
|
2005
2171
|
inputTokens?: number | null;
|
|
2006
2172
|
outputTokens?: number | null;
|
|
@@ -2013,8 +2179,12 @@ export interface CreateTaskUsageActualRequest {
|
|
|
2013
2179
|
diffLinesRemoved?: number | null;
|
|
2014
2180
|
testRuns?: number | null;
|
|
2015
2181
|
retryCount?: number | null;
|
|
2016
|
-
actualCredits
|
|
2182
|
+
actualCredits?: number | null;
|
|
2017
2183
|
actualUsd?: number | null;
|
|
2184
|
+
creditFormulaVersion?: string | null;
|
|
2185
|
+
actualCreditSource?: string | null;
|
|
2186
|
+
actualCreditsOverride?: boolean | null;
|
|
2187
|
+
nativeUsage?: NativeUsageObservation | Record<string, unknown> | null;
|
|
2018
2188
|
metadata?: Record<string, unknown> | null;
|
|
2019
2189
|
}
|
|
2020
2190
|
export interface CreateApprovalRequestRequest {
|
package/dist/seeds/normalize.js
CHANGED
|
@@ -124,12 +124,14 @@ function normalizeSeedResources(manifest, selected) {
|
|
|
124
124
|
kind: provider.kind ?? null,
|
|
125
125
|
provider: provider.provider,
|
|
126
126
|
billingScope: provider.billingScope ?? null,
|
|
127
|
+
creditBudgetMode: provider.creditBudgetMode ?? "derived",
|
|
127
128
|
monthlyCreditBudget: provider.monthlyCreditBudget ?? null,
|
|
128
129
|
dailyCreditBudget: provider.dailyCreditBudget ?? null,
|
|
129
130
|
maxConcurrentWorkdays: provider.maxConcurrentWorkdays ?? null,
|
|
130
131
|
maxConcurrentWorkers: provider.maxConcurrentWorkers ?? null,
|
|
131
132
|
capacityModel: provider.capacityModel ?? null,
|
|
132
133
|
registration: provider.registration ?? null,
|
|
134
|
+
executionProviders: provider.executionProviders ?? [],
|
|
133
135
|
metadata: withMetadata(manifest, provider.key, provider.metadata)
|
|
134
136
|
}
|
|
135
137
|
});
|
|
@@ -175,6 +177,10 @@ function normalizeSeedResources(manifest, selected) {
|
|
|
175
177
|
dailyUsdLimit: grant.dailyUsdLimit ?? null,
|
|
176
178
|
weeklyQuotaMinutes: grant.weeklyQuotaMinutes ?? null,
|
|
177
179
|
monthlyProviderUnits: grant.monthlyProviderUnits ?? null,
|
|
180
|
+
portfolioAllocationPercent: grant.portfolioAllocationPercent ?? null,
|
|
181
|
+
reservePoolPercent: grant.reservePoolPercent ?? null,
|
|
182
|
+
maxDailyProjectCredits: grant.maxDailyProjectCredits ?? null,
|
|
183
|
+
emergencyOverride: grant.emergencyOverride ?? null,
|
|
178
184
|
priorityWeight: grant.priorityWeight ?? null,
|
|
179
185
|
overflowPolicy: grant.overflowPolicy ?? null,
|
|
180
186
|
state: grant.state ?? null,
|
package/dist/seeds/schema.js
CHANGED
|
@@ -58,6 +58,14 @@ function numberField(record, field, path, diagnostics) {
|
|
|
58
58
|
}
|
|
59
59
|
return value;
|
|
60
60
|
}
|
|
61
|
+
function nonNegativeNumberField(record, field, path, diagnostics) {
|
|
62
|
+
const value = numberField(record, field, path, diagnostics);
|
|
63
|
+
if (value !== void 0 && value < 0) {
|
|
64
|
+
diagnostics.push(errorDiagnostic("seed.invalid_number", `Expected ${field} to be non-negative.`, `${path}.${field}`));
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
61
69
|
function objectField(record, field, path, diagnostics) {
|
|
62
70
|
const value = record[field];
|
|
63
71
|
if (value === void 0) return void 0;
|
|
@@ -276,6 +284,50 @@ function parseProviderRegistration(value, path, diagnostics) {
|
|
|
276
284
|
}
|
|
277
285
|
};
|
|
278
286
|
}
|
|
287
|
+
function parseNativeLimit(value, path, diagnostics) {
|
|
288
|
+
if (!isRecord(value)) {
|
|
289
|
+
diagnostics.push(errorDiagnostic("seed.invalid_resource", "Expected native limit to be an object.", path));
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
const limitAmount = nonNegativeNumberField(value, "limitAmount", path, diagnostics);
|
|
293
|
+
if (limitAmount === void 0) {
|
|
294
|
+
diagnostics.push(errorDiagnostic("seed.missing_field", "Missing required field: limitAmount.", `${path}.limitAmount`));
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
id: asString(value.id) || void 0,
|
|
298
|
+
scope: asString(value.scope) || void 0,
|
|
299
|
+
limitScope: asString(value.limitScope) || void 0,
|
|
300
|
+
nativeUnit: asString(value.nativeUnit) || void 0,
|
|
301
|
+
limitAmount: limitAmount ?? 0,
|
|
302
|
+
reserveBufferPercent: nonNegativeNumberField(value, "reserveBufferPercent", path, diagnostics),
|
|
303
|
+
resetCadence: asString(value.resetCadence) || void 0,
|
|
304
|
+
resetAt: asString(value.resetAt) || void 0,
|
|
305
|
+
confidence: asString(value.confidence) || void 0,
|
|
306
|
+
source: asString(value.source) || void 0,
|
|
307
|
+
metadata: objectField(value, "metadata", path, diagnostics)
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function parseExecutionProvider(value, path, diagnostics) {
|
|
311
|
+
if (!isRecord(value)) {
|
|
312
|
+
diagnostics.push(errorDiagnostic("seed.invalid_resource", "Expected execution provider resource to be an object.", path));
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
const limitsValue = value.nativeLimits;
|
|
316
|
+
const nativeLimits = limitsValue === void 0 ? [] : Array.isArray(limitsValue) ? limitsValue.map((limit, index) => parseNativeLimit(limit, `${path}.nativeLimits[${index}]`, diagnostics)).filter((limit) => Boolean(limit)) : (diagnostics.push(errorDiagnostic("seed.invalid_native_limits", "Expected nativeLimits to be an array.", `${path}.nativeLimits`)), []);
|
|
317
|
+
return {
|
|
318
|
+
id: asString(value.id) || void 0,
|
|
319
|
+
name: requireString(value, "name", path, diagnostics),
|
|
320
|
+
kind: requireString(value, "kind", path, diagnostics),
|
|
321
|
+
status: asString(value.status) || void 0,
|
|
322
|
+
nativeUnit: requireString(value, "nativeUnit", path, diagnostics),
|
|
323
|
+
quotaVisibility: asString(value.quotaVisibility) || void 0,
|
|
324
|
+
maxConcurrentWorkers: nonNegativeNumberField(value, "maxConcurrentWorkers", path, diagnostics),
|
|
325
|
+
resetCadence: asString(value.resetCadence) || void 0,
|
|
326
|
+
config: objectField(value, "config", path, diagnostics),
|
|
327
|
+
metadata: objectField(value, "metadata", path, diagnostics),
|
|
328
|
+
nativeLimits
|
|
329
|
+
};
|
|
330
|
+
}
|
|
279
331
|
function parseProvider(value, path, diagnostics) {
|
|
280
332
|
if (!isRecord(value)) {
|
|
281
333
|
diagnostics.push(errorDiagnostic("seed.invalid_resource", "Expected capacity provider resource to be an object.", path));
|
|
@@ -283,6 +335,8 @@ function parseProvider(value, path, diagnostics) {
|
|
|
283
335
|
}
|
|
284
336
|
const lanesValue = value.lanes;
|
|
285
337
|
const lanes = lanesValue === void 0 ? [] : Array.isArray(lanesValue) ? lanesValue.map((lane, index) => parseLane(lane, `${path}.lanes[${index}]`, diagnostics)).filter((lane) => Boolean(lane)) : (diagnostics.push(errorDiagnostic("seed.invalid_lanes", "Expected lanes to be an array.", `${path}.lanes`)), []);
|
|
338
|
+
const executionProvidersValue = value.executionProviders;
|
|
339
|
+
const executionProviders = executionProvidersValue === void 0 ? [] : Array.isArray(executionProvidersValue) ? executionProvidersValue.map((entry, index) => parseExecutionProvider(entry, `${path}.executionProviders[${index}]`, diagnostics)).filter((entry) => Boolean(entry)) : (diagnostics.push(errorDiagnostic("seed.invalid_execution_providers", "Expected executionProviders to be an array.", `${path}.executionProviders`)), []);
|
|
286
340
|
return {
|
|
287
341
|
...keyBase(value, path, diagnostics),
|
|
288
342
|
team: requireString(value, "team", path, diagnostics),
|
|
@@ -290,6 +344,7 @@ function parseProvider(value, path, diagnostics) {
|
|
|
290
344
|
kind: asString(value.kind) || void 0,
|
|
291
345
|
provider: requireString(value, "provider", path, diagnostics),
|
|
292
346
|
billingScope: asString(value.billingScope) || void 0,
|
|
347
|
+
creditBudgetMode: asString(value.creditBudgetMode) || void 0,
|
|
293
348
|
monthlyCreditBudget: numberField(value, "monthlyCreditBudget", path, diagnostics),
|
|
294
349
|
dailyCreditBudget: numberField(value, "dailyCreditBudget", path, diagnostics),
|
|
295
350
|
maxConcurrentWorkdays: numberField(value, "maxConcurrentWorkdays", path, diagnostics),
|
|
@@ -297,7 +352,8 @@ function parseProvider(value, path, diagnostics) {
|
|
|
297
352
|
capacityModel: objectField(value, "capacityModel", path, diagnostics),
|
|
298
353
|
registration: parseProviderRegistration(value.registration, `${path}.registration`, diagnostics),
|
|
299
354
|
metadata: objectField(value, "metadata", path, diagnostics),
|
|
300
|
-
lanes
|
|
355
|
+
lanes,
|
|
356
|
+
executionProviders
|
|
301
357
|
};
|
|
302
358
|
}
|
|
303
359
|
function parseGrant(value, path, diagnostics) {
|
|
@@ -323,6 +379,10 @@ function parseGrant(value, path, diagnostics) {
|
|
|
323
379
|
dailyUsdLimit: numberField(value, "dailyUsdLimit", path, diagnostics),
|
|
324
380
|
weeklyQuotaMinutes: numberField(value, "weeklyQuotaMinutes", path, diagnostics),
|
|
325
381
|
monthlyProviderUnits: numberField(value, "monthlyProviderUnits", path, diagnostics),
|
|
382
|
+
portfolioAllocationPercent: numberField(value, "portfolioAllocationPercent", path, diagnostics),
|
|
383
|
+
reservePoolPercent: numberField(value, "reservePoolPercent", path, diagnostics),
|
|
384
|
+
maxDailyProjectCredits: numberField(value, "maxDailyProjectCredits", path, diagnostics),
|
|
385
|
+
emergencyOverride: typeof value.emergencyOverride === "boolean" ? value.emergencyOverride : void 0,
|
|
326
386
|
priorityWeight: numberField(value, "priorityWeight", path, diagnostics),
|
|
327
387
|
overflowPolicy: asString(value.overflowPolicy) || void 0,
|
|
328
388
|
state: asString(value.state) || void 0,
|
package/dist/seeds/types.d.ts
CHANGED
|
@@ -139,12 +139,39 @@ export type SeedCapacityProviderRegistrationApiKey = {
|
|
|
139
139
|
export type SeedCapacityProviderRegistration = {
|
|
140
140
|
apiKey?: SeedCapacityProviderRegistrationApiKey;
|
|
141
141
|
};
|
|
142
|
+
export type SeedExecutionProviderNativeLimitResource = {
|
|
143
|
+
id?: string;
|
|
144
|
+
scope?: string;
|
|
145
|
+
limitScope?: string;
|
|
146
|
+
nativeUnit?: string;
|
|
147
|
+
limitAmount: number;
|
|
148
|
+
reserveBufferPercent?: number;
|
|
149
|
+
resetCadence?: string;
|
|
150
|
+
resetAt?: string;
|
|
151
|
+
confidence?: string;
|
|
152
|
+
source?: string;
|
|
153
|
+
metadata?: Record<string, unknown>;
|
|
154
|
+
};
|
|
155
|
+
export type SeedExecutionProviderResource = {
|
|
156
|
+
id?: string;
|
|
157
|
+
name: string;
|
|
158
|
+
kind: string;
|
|
159
|
+
status?: string;
|
|
160
|
+
nativeUnit: string;
|
|
161
|
+
quotaVisibility?: string;
|
|
162
|
+
maxConcurrentWorkers?: number;
|
|
163
|
+
resetCadence?: string;
|
|
164
|
+
config?: Record<string, unknown>;
|
|
165
|
+
metadata?: Record<string, unknown>;
|
|
166
|
+
nativeLimits?: SeedExecutionProviderNativeLimitResource[];
|
|
167
|
+
};
|
|
142
168
|
export type SeedCapacityProviderResource = SeedResourceBase & {
|
|
143
169
|
team: string;
|
|
144
170
|
name: string;
|
|
145
171
|
kind?: string;
|
|
146
172
|
provider: string;
|
|
147
173
|
billingScope?: string;
|
|
174
|
+
creditBudgetMode?: 'static' | 'hybrid' | 'derived' | string;
|
|
148
175
|
monthlyCreditBudget?: number;
|
|
149
176
|
dailyCreditBudget?: number;
|
|
150
177
|
maxConcurrentWorkdays?: number;
|
|
@@ -153,6 +180,7 @@ export type SeedCapacityProviderResource = SeedResourceBase & {
|
|
|
153
180
|
registration?: SeedCapacityProviderRegistration;
|
|
154
181
|
metadata?: Record<string, unknown>;
|
|
155
182
|
lanes?: SeedCapacityLaneResource[];
|
|
183
|
+
executionProviders?: SeedExecutionProviderResource[];
|
|
156
184
|
};
|
|
157
185
|
export type SeedCapacityGrantResource = SeedResourceBase & {
|
|
158
186
|
provider: string;
|
|
@@ -167,6 +195,10 @@ export type SeedCapacityGrantResource = SeedResourceBase & {
|
|
|
167
195
|
dailyUsdLimit?: number;
|
|
168
196
|
weeklyQuotaMinutes?: number;
|
|
169
197
|
monthlyProviderUnits?: number;
|
|
198
|
+
portfolioAllocationPercent?: number;
|
|
199
|
+
reservePoolPercent?: number;
|
|
200
|
+
maxDailyProjectCredits?: number;
|
|
201
|
+
emergencyOverride?: boolean;
|
|
170
202
|
priorityWeight?: number;
|
|
171
203
|
overflowPolicy?: string;
|
|
172
204
|
state?: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS `contact_submissions` (
|
|
2
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
+
`name` text,
|
|
4
|
+
`email` text NOT NULL,
|
|
5
|
+
`organization` text,
|
|
6
|
+
`contact_type` text,
|
|
7
|
+
`subject` text,
|
|
8
|
+
`message` text NOT NULL,
|
|
9
|
+
`user_agent` text,
|
|
10
|
+
`created_at` text NOT NULL,
|
|
11
|
+
`ip_hash` text
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
CREATE INDEX IF NOT EXISTS `idx_contact_submissions_created_at` ON `contact_submissions` (`created_at`);
|
|
15
|
+
CREATE INDEX IF NOT EXISTS `idx_contact_submissions_email` ON `contact_submissions` (`email`);
|
|
16
|
+
CREATE TABLE IF NOT EXISTS `runtime_records` (
|
|
17
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
18
|
+
`record_type` text NOT NULL,
|
|
19
|
+
`record_key` text NOT NULL,
|
|
20
|
+
`lookup_key` text,
|
|
21
|
+
`secondary_key` text,
|
|
22
|
+
`status` text NOT NULL,
|
|
23
|
+
`schema_version` integer DEFAULT 1 NOT NULL,
|
|
24
|
+
`created_at` text NOT NULL,
|
|
25
|
+
`updated_at` text NOT NULL,
|
|
26
|
+
`expires_at` text,
|
|
27
|
+
`payload_json` text NOT NULL,
|
|
28
|
+
`meta_json` text NOT NULL
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
CREATE INDEX IF NOT EXISTS `idx_runtime_records_type_lookup_updated` ON `runtime_records` (`record_type`,`lookup_key`,`updated_at`);
|
|
32
|
+
CREATE INDEX IF NOT EXISTS `idx_runtime_records_type_status_updated` ON `runtime_records` (`record_type`,`status`,`updated_at`);
|
|
33
|
+
CREATE UNIQUE INDEX IF NOT EXISTS `idx_runtime_records_type_record_key` ON `runtime_records` (`record_type`,`record_key`);
|
|
34
|
+
CREATE TABLE IF NOT EXISTS `subscribers` (
|
|
35
|
+
`email` text PRIMARY KEY NOT NULL,
|
|
36
|
+
`created_at` text NOT NULL
|
|
37
|
+
);
|