@treeseed/sdk 0.6.50 → 0.6.51

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.
@@ -1230,7 +1230,11 @@ async function monitorProjectPlatform(options) {
1230
1230
  r2: options.dryRun ? { ok: true, skipped: true, reason: "dry_run" } : probeR2(options.tenantRoot, siteConfig, state, target),
1231
1231
  queue: options.dryRun ? Promise.resolve({ ok: true, skipped: true, reason: "dry_run" }) : probeQueue(siteConfig, state),
1232
1232
  scaleProbe: probeScaleConfiguration(siteConfig, state),
1233
- railwayResources: options.scope === "local" || !apiSelected && !agentsSelected ? Promise.resolve({ ok: true, skipped: true, reason: options.scope === "local" ? "local_scope" : "railway_not_selected" }) : verifyRailwayManagedResources(options.tenantRoot, options.scope, { env, settleDeployments: true }),
1233
+ railwayResources: options.scope === "local" || !apiSelected && !agentsSelected ? Promise.resolve({ ok: true, skipped: true, reason: options.scope === "local" ? "local_scope" : "railway_not_selected" }) : verifyRailwayManagedResources(options.tenantRoot, options.scope, {
1234
+ env,
1235
+ settleDeployments: true,
1236
+ onProgress: options.write
1237
+ }),
1234
1238
  readiness: state.readiness
1235
1239
  };
1236
1240
  const resolvedChecks = {
@@ -13,7 +13,7 @@ export declare function runRailway(args: any, { cwd, capture, allowFailure, inpu
13
13
  capture?: boolean | undefined;
14
14
  allowFailure?: boolean | undefined;
15
15
  }): import("child_process").SpawnSyncReturns<string>;
16
- export declare function waitForRailwayManagedDeploymentsSettled(tenantRoot: any, scope: any, { services, env, timeoutMs, pollMs, }?: {
16
+ export declare function waitForRailwayManagedDeploymentsSettled(tenantRoot: any, scope: any, { services, env, timeoutMs, pollMs, onProgress, }?: {
17
17
  services?: ({
18
18
  key: string;
19
19
  scope: string;
@@ -319,7 +319,7 @@ export declare function verifyRailwayScheduledJobs(tenantRoot: any, scope: any,
319
319
  unsupported?: undefined;
320
320
  message?: undefined;
321
321
  }>;
322
- export declare function verifyRailwayManagedResources(tenantRoot: any, scope: any, { fetchImpl, apiToken, apiUrl, env, settleDeployments, settleTimeoutMs, settlePollMs, }?: {
322
+ export declare function verifyRailwayManagedResources(tenantRoot: any, scope: any, { fetchImpl, apiToken, apiUrl, env, settleDeployments, settleTimeoutMs, settlePollMs, onProgress, }?: {
323
323
  fetchImpl?: typeof fetch | undefined;
324
324
  env?: NodeJS.ProcessEnv | undefined;
325
325
  settleDeployments?: boolean | undefined;
@@ -112,6 +112,21 @@ function railwayStatusDeploymentSettled(status) {
112
112
  const normalized = String(status ?? "").trim().toUpperCase();
113
113
  return normalized === "SUCCESS" || normalized === "SLEEPING";
114
114
  }
115
+ function formatRailwayDeploymentStatusSummary(scope, checks) {
116
+ const aliases = {
117
+ api: "api",
118
+ workdayManager: "manager",
119
+ workerRunner: "runner"
120
+ };
121
+ const parts = checks.map((check) => {
122
+ const name = aliases[check.service] ?? String(check.serviceName ?? check.service ?? "service");
123
+ const status = String(check.status ?? "unknown").toUpperCase();
124
+ const instanceStatuses = Array.isArray(check.observed?.instanceStatuses) && check.observed.instanceStatuses.length > 0 ? `/${check.observed.instanceStatuses.join("+")}` : "";
125
+ const stopped = check.observed?.deploymentStopped === true ? "/stopped" : "";
126
+ return `${name}=${status}${instanceStatuses}${stopped}`;
127
+ });
128
+ return `[railway][monitor][${scope}] ${parts.join(" ")}`;
129
+ }
115
130
  function collectRailwayDeploymentStatusChecks(statusPayload, scope, services) {
116
131
  const expectedEnvironment = resolveRailwayEnvironmentForScope(scope);
117
132
  const environments = railwayStatusEnvironmentNodes(statusPayload);
@@ -394,7 +409,8 @@ async function waitForRailwayManagedDeploymentsSettled(tenantRoot, scope, {
394
409
  services = configuredRailwayServices(tenantRoot, scope),
395
410
  env = process.env,
396
411
  timeoutMs = 6e5,
397
- pollMs = 15e3
412
+ pollMs = 15e3,
413
+ onProgress
398
414
  } = {}) {
399
415
  const deadline = Date.now() + timeoutMs;
400
416
  const projectId = services.find((service) => typeof service.projectId === "string" && service.projectId.trim())?.projectId ?? null;
@@ -414,6 +430,7 @@ async function waitForRailwayManagedDeploymentsSettled(tenantRoot, scope, {
414
430
  }
415
431
  let checks = [];
416
432
  let lastError = null;
433
+ let lastSummary = "";
417
434
  for (; ; ) {
418
435
  lastError = null;
419
436
  try {
@@ -434,6 +451,11 @@ async function waitForRailwayManagedDeploymentsSettled(tenantRoot, scope, {
434
451
  message: error instanceof Error ? error.message : String(error)
435
452
  }));
436
453
  }
454
+ const summary = formatRailwayDeploymentStatusSummary(scope, checks);
455
+ if (summary !== lastSummary || !checks.every((entry) => entry.ok === true)) {
456
+ onProgress?.(summary, "stdout");
457
+ lastSummary = summary;
458
+ }
437
459
  if (checks.every((entry) => entry.ok === true)) {
438
460
  return { ok: true, checks };
439
461
  }
@@ -1017,7 +1039,8 @@ async function verifyRailwayManagedResources(tenantRoot, scope, {
1017
1039
  env = process.env,
1018
1040
  settleDeployments = false,
1019
1041
  settleTimeoutMs = 6e5,
1020
- settlePollMs = 15e3
1042
+ settlePollMs = 15e3,
1043
+ onProgress
1021
1044
  } = {}) {
1022
1045
  const effectiveApiToken = apiToken || resolveRailwayAuthToken(env);
1023
1046
  const effectiveApiUrl = apiUrl || resolveRailwayApiUrl(env);
@@ -1129,7 +1152,8 @@ async function verifyRailwayManagedResources(tenantRoot, scope, {
1129
1152
  services: deploymentStatusServices.length > 0 ? deploymentStatusServices : services,
1130
1153
  env: effectiveEnv,
1131
1154
  timeoutMs: settleTimeoutMs,
1132
- pollMs: settlePollMs
1155
+ pollMs: settlePollMs,
1156
+ onProgress
1133
1157
  });
1134
1158
  for (const check of settled.checks ?? []) {
1135
1159
  checks.push(check);
@@ -2923,8 +2923,10 @@ async function workflowSave(helpers, input) {
2923
2923
  if (autoResumeRun) {
2924
2924
  helpers.write(`[workflow][resume] Resuming interrupted save ${autoResumeRun.runId} on ${branch}.`);
2925
2925
  }
2926
+ helpers.write(`[save][workflow] Preparing save on ${branch} (${mode}, ${scope}).`);
2926
2927
  try {
2927
2928
  const saveResult = await executeJournalStep(root, workflowRun.runId, "save-repositories", () => (async () => {
2929
+ helpers.write("[save][workflow] Saving repositories and validating lockfiles.");
2928
2930
  unlinkWorkflowWorkspaceLinks(root, helpers, effectiveInput.workspaceLinks ?? "auto");
2929
2931
  try {
2930
2932
  return await runRepositorySaveOrchestrator({
@@ -2948,6 +2950,7 @@ async function workflowSave(helpers, input) {
2948
2950
  })());
2949
2951
  const savedPackageReports = saveResult?.repos ?? packageReports;
2950
2952
  const savedRootRepo = saveResult?.rootRepo ?? rootRepo;
2953
+ helpers.write("[save][workflow] Repository save phase complete; checking command readiness.");
2951
2954
  const head = savedRootRepo.commitSha ?? run("git", ["rev-parse", "HEAD"], { cwd: gitRoot, capture: true }).trim();
2952
2955
  const commitCreated = savedRootRepo.committed === true;
2953
2956
  const branchSync = {
@@ -2964,34 +2967,38 @@ async function workflowSave(helpers, input) {
2964
2967
  lockfileValidation: repo.lockfileValidation
2965
2968
  }))
2966
2969
  };
2967
- const saveWorkflowGates = shouldUseHostedSaveCi(effectiveInput) ? await executeJournalStep(root, workflowRun.runId, "hosted-ci", () => waitForWorkflowGates("save", [
2968
- ...savedRootRepo.pushed && savedRootRepo.commitSha && branch ? [{
2969
- name: savedRootRepo.name,
2970
- repoPath: savedRootRepo.path,
2971
- workflow: "verify.yml",
2972
- branch,
2973
- headSha: savedRootRepo.commitSha
2974
- }] : [],
2975
- ...effectiveInput.verifyDeployedResources === true && scope !== "local" && savedRootRepo.pushed && savedRootRepo.commitSha && branch ? [{
2976
- name: savedRootRepo.name,
2977
- repoPath: savedRootRepo.path,
2978
- workflow: "deploy.yml",
2979
- branch,
2980
- headSha: savedRootRepo.commitSha
2981
- }] : [],
2982
- ...savedPackageReports.filter((repo) => repo.pushed && repo.commitSha && repo.branch).map((repo) => ({
2983
- name: repo.name,
2984
- repoPath: repo.path,
2985
- workflow: "verify.yml",
2986
- branch: String(repo.branch),
2987
- headSha: String(repo.commitSha)
2988
- }))
2989
- ], "hosted", {
2990
- root,
2991
- runId: workflowRun.runId,
2992
- onProgress: (line, stream) => helpers.write(line, stream)
2993
- }).then((workflowGates) => ({ workflowGates }))) : { workflowGates: [] };
2970
+ const saveWorkflowGates = shouldUseHostedSaveCi(effectiveInput) ? await executeJournalStep(root, workflowRun.runId, "hosted-ci", () => {
2971
+ helpers.write("[save][workflow] Waiting for hosted save workflow gates.");
2972
+ return waitForWorkflowGates("save", [
2973
+ ...savedRootRepo.pushed && savedRootRepo.commitSha && branch ? [{
2974
+ name: savedRootRepo.name,
2975
+ repoPath: savedRootRepo.path,
2976
+ workflow: "verify.yml",
2977
+ branch,
2978
+ headSha: savedRootRepo.commitSha
2979
+ }] : [],
2980
+ ...effectiveInput.verifyDeployedResources === true && scope !== "local" && savedRootRepo.pushed && savedRootRepo.commitSha && branch ? [{
2981
+ name: savedRootRepo.name,
2982
+ repoPath: savedRootRepo.path,
2983
+ workflow: "deploy.yml",
2984
+ branch,
2985
+ headSha: savedRootRepo.commitSha
2986
+ }] : [],
2987
+ ...savedPackageReports.filter((repo) => repo.pushed && repo.commitSha && repo.branch).map((repo) => ({
2988
+ name: repo.name,
2989
+ repoPath: repo.path,
2990
+ workflow: "verify.yml",
2991
+ branch: String(repo.branch),
2992
+ headSha: String(repo.commitSha)
2993
+ }))
2994
+ ], "hosted", {
2995
+ root,
2996
+ runId: workflowRun.runId,
2997
+ onProgress: (line, stream) => helpers.write(line, stream)
2998
+ }).then((workflowGates) => ({ workflowGates }));
2999
+ }) : { workflowGates: [] };
2994
3000
  const releaseCandidate = branch === STAGING_BRANCH ? await executeJournalStep(root, workflowRun.runId, "release-candidate", () => {
3001
+ helpers.write("[save][workflow] Running staging release-candidate readiness checks.");
2995
3002
  const releaseSession = resolveTreeseedWorkflowSession(root);
2996
3003
  const stagingReleasePlan = buildReleasePlanSnapshot({
2997
3004
  root,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.6.50",
3
+ "version": "0.6.51",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {