@clawos-dev/clawd 0.2.724 → 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.
@@ -31785,7 +31785,9 @@ var DeployJobSchema = external_exports.object({
31785
31785
  /** GitHub 的 job databaseId,`gh run rerun --job` 要用。还没跑起来的段没有 */
31786
31786
  jobId: external_exports.number().optional(),
31787
31787
  startedAt: external_exports.number().optional(),
31788
- completedAt: external_exports.number().optional()
31788
+ completedAt: external_exports.number().optional(),
31789
+ /** 只有 build 段:构建期 CLI 校验没过、只报警没拦的条目(一条一句) */
31790
+ cliWarnings: external_exports.array(external_exports.string()).optional()
31789
31791
  }).strict();
31790
31792
  var DeployRunSchema = external_exports.object({
31791
31793
  runId: external_exports.number(),
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";
@@ -6763,7 +6763,9 @@ var init_deploy_schemas = __esm({
6763
6763
  /** GitHub 的 job databaseId,`gh run rerun --job` 要用。还没跑起来的段没有 */
6764
6764
  jobId: external_exports.number().optional(),
6765
6765
  startedAt: external_exports.number().optional(),
6766
- completedAt: external_exports.number().optional()
6766
+ completedAt: external_exports.number().optional(),
6767
+ /** 只有 build 段:构建期 CLI 校验没过、只报警没拦的条目(一条一句) */
6768
+ cliWarnings: external_exports.array(external_exports.string()).optional()
6767
6769
  }).strict();
6768
6770
  DeployRunSchema = external_exports.object({
6769
6771
  runId: external_exports.number(),
@@ -6927,6 +6929,7 @@ var init_deploy_schemas = __esm({
6927
6929
  releaseId: external_exports.string().optional(),
6928
6930
  jobId: external_exports.number()
6929
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";
6930
6933
  DeployReportFindingArgsSchema = external_exports.object({
6931
6934
  personaId: external_exports.string().min(1),
6932
6935
  kind: external_exports.enum(["package", "secret", "connector"]),
@@ -62835,6 +62838,14 @@ async function readCurrentBase(api) {
62835
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");
62836
62839
  return release2;
62837
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
+ }
62838
62849
 
62839
62850
  // src/deploy/release-workflow.ts
62840
62851
  init_protocol();
@@ -63424,7 +63435,7 @@ async function writeWorkflow(dir) {
63424
63435
  }
63425
63436
  }
63426
63437
  async function writeDockerfile(dir, personaId2, image) {
63427
- const baseImage = image.replace("registry-vpc.cn-hangzhou.aliyuncs.com/", "registry.cn-hangzhou.aliyuncs.com/");
63438
+ const baseImage = publicBaseImage(image);
63428
63439
  await import_promises5.default.mkdir(import_node_path44.default.join(dir, ".clawd"), { recursive: true });
63429
63440
  await import_promises5.default.writeFile(import_node_path44.default.join(dir, ".clawd", "base-image.txt"), `${baseImage}
63430
63441
  `);
@@ -63913,6 +63924,15 @@ function packageNeedsRereport(pkg, probed) {
63913
63924
  init_protocol();
63914
63925
  var INTEGRATION_CONFIG_RUN_PREFIX = "persona-integration-config-";
63915
63926
  var runsOf = (slug, file, query) => `/repos/${slug}/actions/workflows/${encodeURIComponent(file)}/runs?${query}`;
63927
+ var CLI_WARNING_TITLE = "CLI version check";
63928
+ async function withCliWarnings(api, slug, jobs) {
63929
+ const build = jobs.find((j2) => j2.key === "build");
63930
+ if (build?.status !== "done" || build.jobId === void 0) return { jobs, read: true };
63931
+ const listed = await api.getJson(`/repos/${slug}/check-runs/${build.jobId}/annotations?per_page=100`);
63932
+ if (!Array.isArray(listed)) return { jobs, read: false };
63933
+ const warnings = listed.filter((a2) => a2?.annotation_level === "warning" && a2.title === CLI_WARNING_TITLE && typeof a2.message === "string").flatMap((a2) => String(a2.message).split("\n").filter(Boolean));
63934
+ return { jobs: warnings.length ? jobs.map((j2) => j2 === build ? { ...j2, cliWarnings: warnings } : j2) : jobs, read: true };
63935
+ }
63916
63936
  var pipelineJobKey = (name) => DEPLOY_STAGE_KEYS.find((k3) => name === k3 || name.startsWith(`${k3} `));
63917
63937
  function stageStatusOf(status, conclusion) {
63918
63938
  if (status === "queued" || status === "requested" || status === "pending") return "pending";
@@ -64001,8 +64021,9 @@ async function readPinnedRun(api, slug, raw, environment, promotionId, jobsCache
64001
64021
  if (listed.jobs.length < 100 && (listed.total_count === void 0 || page * 100 >= listed.total_count)) break;
64002
64022
  if (page === 30) return void 0;
64003
64023
  }
64004
- jobs = DEPLOY_STAGE_KEYS.map((key) => byKey.get(key)).filter((j2) => j2 !== void 0);
64005
- if (status === "completed" && jobsCache) {
64024
+ const annotated = await withCliWarnings(api, slug, DEPLOY_STAGE_KEYS.map((key) => byKey.get(key)).filter((j2) => j2 !== void 0));
64025
+ jobs = annotated.jobs;
64026
+ if (status === "completed" && jobsCache && annotated.read) {
64006
64027
  if (jobsCache.size >= COMPLETED_JOBS_CACHE_MAX) jobsCache.delete(jobsCache.keys().next().value);
64007
64028
  jobsCache.set(cacheKey, jobs);
64008
64029
  }
@@ -64041,7 +64062,7 @@ async function fetchRun(api, slug, query) {
64041
64062
  status: runStatusOf(String(raw.status ?? "")),
64042
64063
  htmlUrl: raw.html_url,
64043
64064
  // 按流水线的顺序排,不跟着 GitHub 返回的顺序走
64044
- jobs: DEPLOY_STAGE_KEYS.map((k3) => byKey.get(k3)).filter((j2) => j2 !== void 0)
64065
+ jobs: (await withCliWarnings(api, slug, DEPLOY_STAGE_KEYS.map((k3) => byKey.get(k3)).filter((j2) => j2 !== void 0))).jobs
64045
64066
  };
64046
64067
  }
64047
64068
  async function latestUnpublish(api, slug, environment) {
@@ -64910,9 +64931,13 @@ function buildDeployHandlers(deps) {
64910
64931
  const promotion = environment === "production" ? file.promotions.at(-1) : void 0;
64911
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;
64912
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");
64913
- if (!run.jobs.some((j2) => j2.jobId === jobId)) {
64934
+ const job = run.jobs.find((j2) => j2.jobId === jobId);
64935
+ if (!job) {
64914
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");
64915
64937
  }
64938
+ if (environment === "integration" && job.key === "build") {
64939
+ if (await pinnedBaseStale(api, slug, run.headSha)) throw invalid(DEPLOY_STALE_BASE_ERROR);
64940
+ }
64916
64941
  try {
64917
64942
  if (record4?.environment === "integration") {
64918
64943
  await configureTestIdentity(api, slug);
@@ -76133,7 +76158,7 @@ function computeMethodAccess(args) {
76133
76158
  }
76134
76159
 
76135
76160
  // src/version.ts
76136
- var version = "0.2.724".length > 0 ? "0.2.724" : "dev";
76161
+ var version = "0.2.726".length > 0 ? "0.2.726" : "dev";
76137
76162
 
76138
76163
  // src/cli-probe/probe.ts
76139
76164
  var fs87 = __toESM(require("fs"), 1);