@treeseed/sdk 0.6.39 → 0.6.40
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.d.ts +53 -0
- package/dist/capacity.js +100 -0
- package/dist/control-plane-client.d.ts +41 -1
- package/dist/control-plane-client.js +154 -0
- package/dist/control-plane.d.ts +6 -1
- package/dist/control-plane.js +39 -2
- package/dist/d1-store.d.ts +63 -1
- package/dist/d1-store.js +190 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -0
- package/dist/operations/services/config-runtime.js +2 -2
- package/dist/operations/services/deploy.js +3 -2
- package/dist/operations/services/knowledge-coop-launch.js +5 -28
- package/dist/operations/services/package-reference-policy.d.ts +68 -0
- package/dist/operations/services/package-reference-policy.js +135 -0
- package/dist/operations/services/project-platform.d.ts +14 -0
- package/dist/operations/services/project-platform.js +3 -2
- package/dist/operations/services/railway-api.d.ts +33 -0
- package/dist/operations/services/railway-api.js +273 -0
- package/dist/operations/services/railway-deploy.d.ts +22 -0
- package/dist/operations/services/railway-deploy.js +81 -19
- package/dist/operations/services/release-candidate.d.ts +2 -0
- package/dist/operations/services/release-candidate.js +28 -0
- package/dist/operations/services/runtime-tools.js +1 -1
- package/dist/operations-registry.js +1 -0
- package/dist/reconcile/bootstrap-systems.js +1 -1
- package/dist/reconcile/builtin-adapters.js +5 -9
- package/dist/reconcile/contracts.d.ts +1 -1
- package/dist/reconcile/desired-state.js +9 -17
- package/dist/reconcile/state.js +4 -4
- package/dist/reconcile/units.js +4 -8
- package/dist/sdk-types.d.ts +566 -3
- package/dist/sdk.d.ts +12 -1
- package/dist/sdk.js +44 -0
- package/dist/stores/operational-store.d.ts +12 -1
- package/dist/stores/operational-store.js +283 -5
- package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +5 -24
- package/dist/types/agents.d.ts +27 -0
- package/dist/workflow/operations.d.ts +94 -2
- package/dist/workflow/operations.js +90 -32
- package/dist/workflow-state.js +3 -5
- package/dist/workflow.d.ts +8 -1
- package/dist/workflow.js +6 -0
- package/package.json +5 -1
|
@@ -13,6 +13,7 @@ import { loadCliDeployConfig } from "./runtime-tools.js";
|
|
|
13
13
|
import { packagesWithScript, run, workspacePackages } from "./workspace-tools.js";
|
|
14
14
|
import { createBuildWarningSummary, formatAllowedBuildWarnings } from "./build-warning-policy.js";
|
|
15
15
|
const RELEASE_CANDIDATE_CACHE_DIR = ".treeseed/workflow/release-candidates";
|
|
16
|
+
const RELEASE_CANDIDATE_POLICY_VERSION = "strict-output-v1";
|
|
16
17
|
const STABLE_SEMVER = /^\d+\.\d+\.\d+$/u;
|
|
17
18
|
const REHEARSAL_IGNORED_SEGMENTS = /* @__PURE__ */ new Set([
|
|
18
19
|
".git",
|
|
@@ -86,6 +87,7 @@ function buildReleaseCandidateFingerprint(input) {
|
|
|
86
87
|
...Object.fromEntries(packages.map((pkg) => [pkg.name, fileSha256(resolve(pkg.dir, "package-lock.json"))]))
|
|
87
88
|
});
|
|
88
89
|
const base = {
|
|
90
|
+
policyVersion: RELEASE_CANDIDATE_POLICY_VERSION,
|
|
89
91
|
rootSha: safeGitHead(input.root),
|
|
90
92
|
packageShas,
|
|
91
93
|
plannedVersions,
|
|
@@ -241,11 +243,15 @@ function runNpmRehearsalCommand(args, options) {
|
|
|
241
243
|
throw new Error(message);
|
|
242
244
|
}
|
|
243
245
|
const warningSummary = createBuildWarningSummary();
|
|
246
|
+
const outputFailures = [];
|
|
244
247
|
const emitFiltered = (text, stream) => {
|
|
245
248
|
for (const line of text.split(/\r?\n/u)) {
|
|
246
249
|
if (!line) continue;
|
|
247
250
|
const classified = warningSummary.record(line);
|
|
248
251
|
if (classified.kind === "allowed") continue;
|
|
252
|
+
for (const failure of collectReleaseCandidateOutputFailures(line)) {
|
|
253
|
+
outputFailures.push(failure);
|
|
254
|
+
}
|
|
249
255
|
stream.write(`${line}
|
|
250
256
|
`);
|
|
251
257
|
}
|
|
@@ -256,6 +262,27 @@ function runNpmRehearsalCommand(args, options) {
|
|
|
256
262
|
process.stdout.write(`${line}
|
|
257
263
|
`);
|
|
258
264
|
}
|
|
265
|
+
if (outputFailures.length > 0) {
|
|
266
|
+
throw new Error([
|
|
267
|
+
`npm ${args.join(" ")} completed with error output despite exit code 0.`,
|
|
268
|
+
...outputFailures.slice(0, 12)
|
|
269
|
+
].join("\n"));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function collectReleaseCandidateOutputFailures(line) {
|
|
273
|
+
const value = String(line ?? "").trim();
|
|
274
|
+
if (!value) return [];
|
|
275
|
+
const failures = [];
|
|
276
|
+
if (/^stderr\s+\|\s+/u.test(value)) {
|
|
277
|
+
failures.push(`Captured test stderr: ${value}`);
|
|
278
|
+
}
|
|
279
|
+
if (/(^|\s)ERROR(?:\s|\[|:)/u.test(value)) {
|
|
280
|
+
failures.push(`Error output: ${value}`);
|
|
281
|
+
}
|
|
282
|
+
if (/\bFailed to run background task\b/u.test(value)) {
|
|
283
|
+
failures.push(`Background task failure output: ${value}`);
|
|
284
|
+
}
|
|
285
|
+
return failures;
|
|
259
286
|
}
|
|
260
287
|
function buildRehearsalWorkspacePackageArtifacts(root) {
|
|
261
288
|
for (const pkg of packagesWithScript("build:dist", root)) {
|
|
@@ -561,6 +588,7 @@ async function runReleaseCandidateGate(input) {
|
|
|
561
588
|
}
|
|
562
589
|
export {
|
|
563
590
|
buildReleaseCandidateFingerprint,
|
|
591
|
+
collectReleaseCandidateOutputFailures,
|
|
564
592
|
readCachedReleaseCandidateReport,
|
|
565
593
|
runReleaseCandidateGate,
|
|
566
594
|
writeReleaseCandidateReport
|
|
@@ -53,7 +53,7 @@ const TREESEED_DEFAULT_PROVIDER_SELECTIONS = {
|
|
|
53
53
|
},
|
|
54
54
|
site: "default"
|
|
55
55
|
};
|
|
56
|
-
const TRESEED_MANAGED_SERVICE_KEYS = ["api", "
|
|
56
|
+
const TRESEED_MANAGED_SERVICE_KEYS = ["api", "workdayManager", "workerRunner"];
|
|
57
57
|
const TRESEED_WORKSPACE_PACKAGE_DIRS = ["sdk", "core", "cli"];
|
|
58
58
|
const CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER = "replace-with-cloudflare-account-id";
|
|
59
59
|
function normalizePlanesFromLegacyHosting(hosting) {
|
|
@@ -10,6 +10,7 @@ const TRESEED_OPERATION_SPECS = [
|
|
|
10
10
|
operation({ id: "branch.save", name: "save", aliases: [], group: "Workflow", summary: "Recursively verify, commit, and push the current task checkpoint.", description: "Save dirty package repos in dependency order, then verify, commit, push, and optionally refresh preview for market.", provider: "default", related: ["switch", "stage", "status"] }),
|
|
11
11
|
operation({ id: "branch.close", name: "close", aliases: [], group: "Workflow", summary: "Recursively archive and delete a task branch.", description: "Auto-save if needed, clean preview resources, create deprecated tags, and remove the task branch across market and checked-out package repos.", provider: "default", related: ["tasks", "switch", "stage"] }),
|
|
12
12
|
operation({ id: "branch.stage", name: "stage", aliases: [], group: "Workflow", summary: "Squash a task branch into staging across market and packages.", description: "Auto-save if needed, squash-merge package task branches into staging first, update market submodule pointers, then squash-merge market into staging and clean up the task branch.", provider: "default", related: ["save", "release", "close"] }),
|
|
13
|
+
operation({ id: "workspace.tags.cleanup", name: "tags:cleanup", aliases: [], group: "Utilities", summary: "Clean stale Treeseed-managed package dev tags.", description: "Plan or delete stale staging and preview package dev tags that are older than each package current version line while preserving active references and non-Treeseed tags.", provider: "default", related: ["release", "status"] }),
|
|
13
14
|
operation({ id: "workspace.resume", name: "resume", aliases: [], group: "Workflow", summary: "Resume an interrupted workflow run.", description: "Continue a failed journaled workflow run from its next incomplete step after validating current workspace preconditions.", provider: "default", related: ["recover", "status"] }),
|
|
14
15
|
operation({ id: "workspace.recover", name: "recover", aliases: [], group: "Workflow", summary: "Inspect active workflow locks and interrupted runs.", description: "List active workflow locks, resumable interrupted runs, and the exact commands needed to continue or recover the workspace state.", provider: "default", related: ["resume", "status"] }),
|
|
15
16
|
operation({ id: "workspace.links.status", name: workspaceCommand("status"), aliases: [], group: "Utilities", summary: "Inspect local workspace dependency links.", description: "Inspect whether Treeseed package dependencies are linked to local package checkouts or resolved through deployment references.", provider: "default", related: ["dev", "save"] }),
|
|
@@ -55,7 +55,7 @@ function agentsSystemDisabled(config) {
|
|
|
55
55
|
if (config.runtime?.mode === "none") {
|
|
56
56
|
return "runtime.mode is none.";
|
|
57
57
|
}
|
|
58
|
-
const enabled = ["
|
|
58
|
+
const enabled = ["workdayManager", "workerRunner"].some((serviceKey) => serviceEnabled(config, serviceKey));
|
|
59
59
|
return enabled ? null : "No agent Railway services are enabled.";
|
|
60
60
|
}
|
|
61
61
|
function hasValue(env, key) {
|
|
@@ -1439,7 +1439,7 @@ async function syncRailwayEnvironmentForScope(input, { dryRun = false } = {}) {
|
|
|
1439
1439
|
includeInstances: !dryRun,
|
|
1440
1440
|
includeVariables: false
|
|
1441
1441
|
});
|
|
1442
|
-
const workerEntry = topology.services.get("worker") ?? null;
|
|
1442
|
+
const workerEntry = topology.services.get("workerRunner") ?? topology.services.get("worker") ?? null;
|
|
1443
1443
|
const railwayRuntimeVariables = Object.fromEntries(
|
|
1444
1444
|
[
|
|
1445
1445
|
["TREESEED_RAILWAY_PROJECT_ID", workerEntry?.project?.id],
|
|
@@ -2140,16 +2140,12 @@ function createCloudflareReconcileAdapters() {
|
|
|
2140
2140
|
function createRailwayReconcileAdapters() {
|
|
2141
2141
|
return [
|
|
2142
2142
|
buildRailwayAdapter("railway-service:api"),
|
|
2143
|
-
buildRailwayAdapter("railway-service:manager"),
|
|
2144
|
-
buildRailwayAdapter("railway-service:worker"),
|
|
2145
|
-
buildRailwayAdapter("railway-service:workday-start"),
|
|
2146
|
-
buildRailwayAdapter("railway-service:workday-report"),
|
|
2143
|
+
buildRailwayAdapter("railway-service:workday-manager"),
|
|
2144
|
+
buildRailwayAdapter("railway-service:worker-runner"),
|
|
2147
2145
|
buildCustomDomainAdapter("custom-domain:api", "railway"),
|
|
2148
2146
|
buildCompositeAdapter("api-runtime"),
|
|
2149
|
-
buildCompositeAdapter("manager-runtime"),
|
|
2150
|
-
buildCompositeAdapter("worker-runtime")
|
|
2151
|
-
buildCompositeAdapter("workday-start-runtime"),
|
|
2152
|
-
buildCompositeAdapter("workday-report-runtime")
|
|
2147
|
+
buildCompositeAdapter("workday-manager-runtime"),
|
|
2148
|
+
buildCompositeAdapter("worker-runner-runtime")
|
|
2153
2149
|
];
|
|
2154
2150
|
}
|
|
2155
2151
|
export {
|
|
@@ -3,7 +3,7 @@ export type TreeseedReconcileProviderId = string;
|
|
|
3
3
|
export type TreeseedReconcileActionKind = 'noop' | 'create' | 'update' | 'reuse' | 'drift_correct' | 'destroy';
|
|
4
4
|
export type TreeseedReconcileStatusKind = 'pending' | 'ready' | 'drifted' | 'error';
|
|
5
5
|
export type TreeseedReconcileVerificationSource = 'cli' | 'api' | 'sdk' | 'derived';
|
|
6
|
-
export type TreeseedReconcileUnitType = 'web-ui' | 'api-runtime' | 'manager-runtime' | 'worker-
|
|
6
|
+
export type TreeseedReconcileUnitType = 'web-ui' | 'api-runtime' | 'workday-manager-runtime' | 'worker-runner-runtime' | 'edge-worker' | 'content-store' | 'queue' | 'database' | 'kv-form-guard' | 'pages-project' | 'custom-domain:web' | 'custom-domain:api' | 'dns-record' | 'railway-service:api' | 'railway-service:workday-manager' | 'railway-service:worker-runner';
|
|
7
7
|
export type TreeseedReconcileTarget = {
|
|
8
8
|
kind: 'persistent';
|
|
9
9
|
scope: 'local' | 'staging' | 'prod';
|
|
@@ -11,14 +11,10 @@ function railwayConcreteUnitTypeForServiceKey(serviceKey) {
|
|
|
11
11
|
switch (serviceKey) {
|
|
12
12
|
case "api":
|
|
13
13
|
return "railway-service:api";
|
|
14
|
-
case "
|
|
15
|
-
return "railway-service:manager";
|
|
16
|
-
case "
|
|
17
|
-
return "railway-service:worker";
|
|
18
|
-
case "workdayStart":
|
|
19
|
-
return "railway-service:workday-start";
|
|
20
|
-
case "workdayReport":
|
|
21
|
-
return "railway-service:workday-report";
|
|
14
|
+
case "workdayManager":
|
|
15
|
+
return "railway-service:workday-manager";
|
|
16
|
+
case "workerRunner":
|
|
17
|
+
return "railway-service:worker-runner";
|
|
22
18
|
default:
|
|
23
19
|
return "railway-service:api";
|
|
24
20
|
}
|
|
@@ -227,7 +223,7 @@ function deriveTreeseedDesiredUnits({
|
|
|
227
223
|
serviceKey,
|
|
228
224
|
scheduleManaged: Array.isArray(configuredService.schedule) && configuredService.schedule.length > 0,
|
|
229
225
|
scheduleBootstrap: false,
|
|
230
|
-
scheduleDeployScopes: ["prod"],
|
|
226
|
+
scheduleDeployScopes: ["staging", "prod"],
|
|
231
227
|
bootstrapSystem: serviceBootstrapSystem
|
|
232
228
|
}
|
|
233
229
|
});
|
|
@@ -270,14 +266,10 @@ function deriveTreeseedDesiredUnits({
|
|
|
270
266
|
switch (serviceKey) {
|
|
271
267
|
case "api":
|
|
272
268
|
return "api-runtime";
|
|
273
|
-
case "
|
|
274
|
-
return "manager-runtime";
|
|
275
|
-
case "
|
|
276
|
-
return "worker-runtime";
|
|
277
|
-
case "workdayStart":
|
|
278
|
-
return "workday-start-runtime";
|
|
279
|
-
case "workdayReport":
|
|
280
|
-
return "workday-report-runtime";
|
|
269
|
+
case "workdayManager":
|
|
270
|
+
return "workday-manager-runtime";
|
|
271
|
+
case "workerRunner":
|
|
272
|
+
return "worker-runner-runtime";
|
|
281
273
|
default:
|
|
282
274
|
return "api-runtime";
|
|
283
275
|
}
|
package/dist/reconcile/state.js
CHANGED
|
@@ -6,11 +6,11 @@ function stableHash(value) {
|
|
|
6
6
|
return createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
7
7
|
}
|
|
8
8
|
function railwayUnitTypeForServiceKey(serviceKey) {
|
|
9
|
-
if (serviceKey === "
|
|
10
|
-
return "railway-service:workday-
|
|
9
|
+
if (serviceKey === "workdayManager") {
|
|
10
|
+
return "railway-service:workday-manager";
|
|
11
11
|
}
|
|
12
|
-
if (serviceKey === "
|
|
13
|
-
return "railway-service:
|
|
12
|
+
if (serviceKey === "workerRunner") {
|
|
13
|
+
return "railway-service:worker-runner";
|
|
14
14
|
}
|
|
15
15
|
return `railway-service:${serviceKey}`;
|
|
16
16
|
}
|
package/dist/reconcile/units.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
const TRESEED_RECONCILE_UNIT_TYPES = [
|
|
2
2
|
"web-ui",
|
|
3
3
|
"api-runtime",
|
|
4
|
-
"manager-runtime",
|
|
5
|
-
"worker-runtime",
|
|
6
|
-
"workday-start-runtime",
|
|
7
|
-
"workday-report-runtime",
|
|
4
|
+
"workday-manager-runtime",
|
|
5
|
+
"worker-runner-runtime",
|
|
8
6
|
"edge-worker",
|
|
9
7
|
"content-store",
|
|
10
8
|
"queue",
|
|
@@ -15,10 +13,8 @@ const TRESEED_RECONCILE_UNIT_TYPES = [
|
|
|
15
13
|
"custom-domain:api",
|
|
16
14
|
"dns-record",
|
|
17
15
|
"railway-service:api",
|
|
18
|
-
"railway-service:manager",
|
|
19
|
-
"railway-service:worker"
|
|
20
|
-
"railway-service:workday-start",
|
|
21
|
-
"railway-service:workday-report"
|
|
16
|
+
"railway-service:workday-manager",
|
|
17
|
+
"railway-service:worker-runner"
|
|
22
18
|
];
|
|
23
19
|
function targetKey(target) {
|
|
24
20
|
return target.kind === "persistent" ? target.scope : `branch:${target.branchName}`;
|