@clawos-dev/clawd 0.2.725 → 0.2.726

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/cli.cjs CHANGED
@@ -6650,7 +6650,7 @@ function changedConfigKeys(a2, b3) {
6650
6650
  function repoSlug(url) {
6651
6651
  return url.trim().replace(/^git@[^:]+:/, "").replace(/^https?:\/\/[^/]+\//, "").replace(/\.git$/, "");
6652
6652
  }
6653
- var DeployFileSchema, SCAN_BASE_KINDS, ScanBaseKindSchema, DeployScanStatusSchema, DeployScanSchema, DeployReleasedSchema, DEPLOY_PROMOTION_PHASES, DeployPromotionSchema, DeployEngineChannelSchema, DeployEngineChannelsSchema, DeployScanFileSchema, DeployRepoSchema, DeploySecretPresenceSchema, ENGINE_AUTH_SECRETS, ENGINE_AUTH_PARTIAL_BLOCKER, DEPLOY_STAGE_STATUSES, DeployStageStatusSchema, DEPLOY_VERIFY_STAGE, DEPLOY_STAGE_KEYS, DeployStageKeySchema, DeployJobSchema, DeployRunSchema, CLOUD_ENGINES, DeployUnpublishRunSchema, ReservationStateSchema, DeployCloudStatusSchema, DeployStateSchema, DeployUnpublishResultSchema, DeployLocalStateSchema, DeployPatchResultSchema, DeploySecretsResultSchema, DEPLOY_WORKFLOW_VERSION, workflowVersionForConfigKeys, DEFAULT_TASK_CONCURRENCY, CONFIG_KEYS, DeployReleaseResultSchema, DeployPersonaArgsSchema, DeployGetArgsSchema, DeployScanArgsSchema, DeployReleaseArgsSchema, DeployConfirmTestArgsSchema, DeployPromoteArgsSchema, DeployApplyConfigArgsSchema, DeployOpenTestArgsSchema, DeployEnvironmentArgsSchema, DeployConfirmTestResultSchema, DeployPromoteResultSchema, DeployOpenTestResultSchema, DeployPatchArgsSchema, DeployPutSecretArgsSchema, DeploySetEngineAuthArgsSchema, DeployRerunJobArgsSchema, DeployReportFindingArgsSchema, DeployFinishScanArgsSchema, PERSONA_REPO_ORG;
6653
+ var DeployFileSchema, SCAN_BASE_KINDS, ScanBaseKindSchema, DeployScanStatusSchema, DeployScanSchema, DeployReleasedSchema, DEPLOY_PROMOTION_PHASES, DeployPromotionSchema, DeployEngineChannelSchema, DeployEngineChannelsSchema, DeployScanFileSchema, DeployRepoSchema, DeploySecretPresenceSchema, ENGINE_AUTH_SECRETS, ENGINE_AUTH_PARTIAL_BLOCKER, DEPLOY_STAGE_STATUSES, DeployStageStatusSchema, DEPLOY_VERIFY_STAGE, DEPLOY_STAGE_KEYS, DeployStageKeySchema, DeployJobSchema, DeployRunSchema, CLOUD_ENGINES, DeployUnpublishRunSchema, ReservationStateSchema, DeployCloudStatusSchema, DeployStateSchema, DeployUnpublishResultSchema, DeployLocalStateSchema, DeployPatchResultSchema, DeploySecretsResultSchema, DEPLOY_WORKFLOW_VERSION, workflowVersionForConfigKeys, DEFAULT_TASK_CONCURRENCY, CONFIG_KEYS, DeployReleaseResultSchema, DeployPersonaArgsSchema, DeployGetArgsSchema, DeployScanArgsSchema, DeployReleaseArgsSchema, DeployConfirmTestArgsSchema, DeployPromoteArgsSchema, DeployApplyConfigArgsSchema, DeployOpenTestArgsSchema, DeployEnvironmentArgsSchema, DeployConfirmTestResultSchema, DeployPromoteResultSchema, DeployOpenTestResultSchema, DeployPatchArgsSchema, DeployPutSecretArgsSchema, DeploySetEngineAuthArgsSchema, DeployRerunJobArgsSchema, DEPLOY_STALE_BASE_ERROR, DeployReportFindingArgsSchema, DeployFinishScanArgsSchema, PERSONA_REPO_ORG;
6654
6654
  var init_deploy_schemas = __esm({
6655
6655
  "../protocol/src/deploy-schemas.ts"() {
6656
6656
  "use strict";
@@ -6929,6 +6929,7 @@ var init_deploy_schemas = __esm({
6929
6929
  releaseId: external_exports.string().optional(),
6930
6930
  jobId: external_exports.number()
6931
6931
  }).strict();
6932
+ DEPLOY_STALE_BASE_ERROR = "\u5E95\u5EA7\u5DF2\u66F4\u65B0\uFF0C\u91CD\u8BD5\u4ECD\u4F1A\u7528\u65E7\u5E95\u5EA7\u6784\u5EFA\u2014\u2014\u8BF7\u91CD\u65B0\u53D1\u5E03\u6D4B\u8BD5\u73AF\u5883";
6932
6933
  DeployReportFindingArgsSchema = external_exports.object({
6933
6934
  personaId: external_exports.string().min(1),
6934
6935
  kind: external_exports.enum(["package", "secret", "connector"]),
@@ -62837,6 +62838,14 @@ async function readCurrentBase(api) {
62837
62838
  if (release2.source.cloudHost !== source.cloudHost || release2.source.workflow !== source.workflow) throw new Error("\u5E95\u5EA7\u5236\u54C1\u6E90\u7801\u7248\u672C\u4E0E\u6784\u5EFA\u63D0\u4EA4\u4E0D\u5339\u914D\uFF0C\u8BF7\u91CD\u65B0\u8FD0\u884C\u5E95\u5EA7\u6D41\u6C34\u7EBF");
62838
62839
  return release2;
62839
62840
  }
62841
+ var publicBaseImage = (image) => image.replace("registry-vpc.cn-hangzhou.aliyuncs.com/", "registry.cn-hangzhou.aliyuncs.com/");
62842
+ async function pinnedBaseStale(api, slug, sha) {
62843
+ const file = await api.getJson(`/repos/${slug}/contents/.clawd/base-image.txt?ref=${sha}`);
62844
+ if (file?.type !== "file" || file.encoding !== "base64" || typeof file.content !== "string") return false;
62845
+ const pinned = Buffer.from(file.content, "base64").toString("utf8").trim();
62846
+ const current = await readCurrentBase(api).catch(() => void 0);
62847
+ return !!current && publicBaseImage(pinned) !== publicBaseImage(current.image);
62848
+ }
62840
62849
 
62841
62850
  // src/deploy/release-workflow.ts
62842
62851
  init_protocol();
@@ -63426,7 +63435,7 @@ async function writeWorkflow(dir) {
63426
63435
  }
63427
63436
  }
63428
63437
  async function writeDockerfile(dir, personaId2, image) {
63429
- const baseImage = image.replace("registry-vpc.cn-hangzhou.aliyuncs.com/", "registry.cn-hangzhou.aliyuncs.com/");
63438
+ const baseImage = publicBaseImage(image);
63430
63439
  await import_promises5.default.mkdir(import_node_path44.default.join(dir, ".clawd"), { recursive: true });
63431
63440
  await import_promises5.default.writeFile(import_node_path44.default.join(dir, ".clawd", "base-image.txt"), `${baseImage}
63432
63441
  `);
@@ -64922,9 +64931,13 @@ function buildDeployHandlers(deps) {
64922
64931
  const promotion = environment === "production" ? file.promotions.at(-1) : void 0;
64923
64932
  const run = record4?.legacy ? await runByHead(api, slug, record4.head) : record4 ? await findReleaseRun(api, slug, { environment, head: record4.head, promotionId: promotion?.id }) : void 0;
64924
64933
  if (!run) throw invalid("\u67E5\u4E0D\u5230\u8FD9\u4E2A\u4ED3\u5E93\u4E0A\u7684\u6D41\u6C34\u7EBF\uFF08GitHub \u6CA1\u54CD\u5E94\uFF0C\u6216\u8005\u8FD8\u6CA1\u8DD1\u8FC7\uFF09");
64925
- if (!run.jobs.some((j2) => j2.jobId === jobId)) {
64934
+ const job = run.jobs.find((j2) => j2.jobId === jobId);
64935
+ if (!job) {
64926
64936
  throw invalid("\u8FD9\u4E00\u6BB5\u4E0D\u5728\u6700\u65B0\u90A3\u6761\u6D41\u6C34\u7EBF\u91CC\u4E86\uFF0C\u5237\u65B0\u4E00\u4E0B\u518D\u91CD\u8BD5");
64927
64937
  }
64938
+ if (environment === "integration" && job.key === "build") {
64939
+ if (await pinnedBaseStale(api, slug, run.headSha)) throw invalid(DEPLOY_STALE_BASE_ERROR);
64940
+ }
64928
64941
  try {
64929
64942
  if (record4?.environment === "integration") {
64930
64943
  await configureTestIdentity(api, slug);
@@ -76145,7 +76158,7 @@ function computeMethodAccess(args) {
76145
76158
  }
76146
76159
 
76147
76160
  // src/version.ts
76148
- var version = "0.2.725".length > 0 ? "0.2.725" : "dev";
76161
+ var version = "0.2.726".length > 0 ? "0.2.726" : "dev";
76149
76162
 
76150
76163
  // src/cli-probe/probe.ts
76151
76164
  var fs87 = __toESM(require("fs"), 1);