@clawos-dev/clawd 0.2.575 → 0.2.576

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.
@@ -21518,7 +21518,18 @@ var EnvPackageSchema = external_exports.object({
21518
21518
  */
21519
21519
  localVersion: external_exports.string().optional(),
21520
21520
  /** `github:` 专用——那个版本是哪个文件。见 EnvArtifactSchema */
21521
- artifact: EnvArtifactSchema.optional()
21521
+ artifact: EnvArtifactSchema.optional(),
21522
+ /**
21523
+ * `apt:` 专用——daemon 上报时查过 Debian 12(bookworm)仓库,**没有**这个包。云上装不了,怎么办由老板在页面上定(换源 / 去掉 / 接受);
21524
+ * 不打回 butler(它也不见得找得到对的 npm / github 源)。有这个包时不写此字段,`version` 就是 Debian 12 会装的那一版(不是本机的)。
21525
+ */
21526
+ aptMissing: external_exports.literal(true).optional(),
21527
+ /**
21528
+ * `apt:` 专用——daemon 查到的 Debian 12 里这个包的版本(上游号,如 `3.11.2`;元包抠不出上游号时是 Debian 的版本串原样)。
21529
+ * 是**事实**不是要求:`version` 才是构建期要验的那个——Debian 版本满足 `min`(或没 `min`)时 `version` = 它;不满足时只记这里、不钉 `version`,
21530
+ * 页面把「Debian 12 只有 x,要求 ≥ min」摆出来让老板定。查不到(出网失败)时两者都不写,页面显示「没查到」。
21531
+ */
21532
+ aptVersion: external_exports.string().optional()
21522
21533
  });
21523
21534
  var EnvSecretSchema = external_exports.object({
21524
21535
  // 凭据的命名引用('aliyun-ak' / 'supabase-shared')。部署时按这个名字去解析实际的值。
@@ -24807,7 +24818,7 @@ var DEPLOY_FILE = import_node_path3.default.join(".clawd", "deploy.json");
24807
24818
  var SCAN_FILE = import_node_path3.default.join(".clawd", "deploy-scan.json");
24808
24819
  var z1 = DeployScanSchema.omit({ id: true, manifest: true }).extend({ releasedHead: DeployScanSchema.shape.head }).strict();
24809
24820
  var z2 = external_exports.object({ version: external_exports.literal(2), scans: external_exports.array(DeployScanSchema), released: DeployReleasedSchema.optional() }).strict();
24810
- var PackageFindingSchema = EnvPackageSchema.omit({ localVersion: true, artifact: true }).extend({
24821
+ var PackageFindingSchema = EnvPackageSchema.omit({ localVersion: true, artifact: true, aptMissing: true, aptVersion: true }).extend({
24811
24822
  artifact: external_exports.object({ url: external_exports.string().url(), bin: external_exports.string() }).strict().optional()
24812
24823
  });
24813
24824
 
package/dist/cli.cjs CHANGED
@@ -5989,7 +5989,7 @@ function sharedConnectorSecrets(m3) {
5989
5989
  function requiredSecretEnvNames(m3) {
5990
5990
  return [.../* @__PURE__ */ new Set([...m3.secrets.flatMap((s2) => s2.env), ...sharedConnectorSecrets(m3).flatMap((s2) => s2.env)])];
5991
5991
  }
5992
- var EnvArtifactSchema, EnvPackageSchema, EnvSecretSchema, ConnectorNameSchema, CONNECTOR_KINDS, CONNECTOR_RUNNERS, CONNECTOR_PROTOCOLS, CREDENTIAL_SOURCES, CONNECTOR_AUTHS, ConnectorFieldSchema, EnvConnectorSchema, normalizeLegacyManifest, MANIFEST_BODY, EnvManifestBodySchema, EnvironmentManifestSchema, EnvEvidenceSchema;
5992
+ var EnvArtifactSchema, CLOUD_ROOT_PROVIDES, EnvPackageSchema, EnvSecretSchema, ConnectorNameSchema, CONNECTOR_KINDS, CONNECTOR_RUNNERS, CONNECTOR_PROTOCOLS, CREDENTIAL_SOURCES, CONNECTOR_AUTHS, ConnectorFieldSchema, EnvConnectorSchema, normalizeLegacyManifest, MANIFEST_BODY, EnvManifestBodySchema, EnvironmentManifestSchema, EnvEvidenceSchema;
5993
5993
  var init_environment_schemas = __esm({
5994
5994
  "../protocol/src/environment-schemas.ts"() {
5995
5995
  "use strict";
@@ -6001,6 +6001,7 @@ var init_environment_schemas = __esm({
6001
6001
  sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
6002
6002
  size: external_exports.number().int().positive()
6003
6003
  });
6004
+ CLOUD_ROOT_PROVIDES = ["node", "npm"];
6004
6005
  EnvPackageSchema = external_exports.object({
6005
6006
  // 装完后在 PATH 里能直接调到的名字('aliyun' / 's' / 'pnpm' / 'python3');npm 包报 bin 名,包名进 from
6006
6007
  name: external_exports.string().min(1),
@@ -6039,7 +6040,18 @@ var init_environment_schemas = __esm({
6039
6040
  */
6040
6041
  localVersion: external_exports.string().optional(),
6041
6042
  /** `github:` 专用——那个版本是哪个文件。见 EnvArtifactSchema */
6042
- artifact: EnvArtifactSchema.optional()
6043
+ artifact: EnvArtifactSchema.optional(),
6044
+ /**
6045
+ * `apt:` 专用——daemon 上报时查过 Debian 12(bookworm)仓库,**没有**这个包。云上装不了,怎么办由老板在页面上定(换源 / 去掉 / 接受);
6046
+ * 不打回 butler(它也不见得找得到对的 npm / github 源)。有这个包时不写此字段,`version` 就是 Debian 12 会装的那一版(不是本机的)。
6047
+ */
6048
+ aptMissing: external_exports.literal(true).optional(),
6049
+ /**
6050
+ * `apt:` 专用——daemon 查到的 Debian 12 里这个包的版本(上游号,如 `3.11.2`;元包抠不出上游号时是 Debian 的版本串原样)。
6051
+ * 是**事实**不是要求:`version` 才是构建期要验的那个——Debian 版本满足 `min`(或没 `min`)时 `version` = 它;不满足时只记这里、不钉 `version`,
6052
+ * 页面把「Debian 12 只有 x,要求 ≥ min」摆出来让老板定。查不到(出网失败)时两者都不写,页面显示「没查到」。
6053
+ */
6054
+ aptVersion: external_exports.string().optional()
6043
6055
  });
6044
6056
  EnvSecretSchema = external_exports.object({
6045
6057
  // 凭据的命名引用('aliyun-ak' / 'supabase-shared')。部署时按这个名字去解析实际的值。
@@ -55654,7 +55666,7 @@ function replaceScan(file, entry) {
55654
55666
  function emptyDeployFile() {
55655
55667
  return { version: 1, manifest: { version: 1, packages: [], secrets: [], connectors: [] } };
55656
55668
  }
55657
- var PackageFindingSchema = EnvPackageSchema.omit({ localVersion: true, artifact: true }).extend({
55669
+ var PackageFindingSchema = EnvPackageSchema.omit({ localVersion: true, artifact: true, aptMissing: true, aptVersion: true }).extend({
55658
55670
  artifact: external_exports.object({ url: external_exports.string().url(), bin: external_exports.string() }).strict().optional()
55659
55671
  });
55660
55672
  var FINDING_SCHEMAS = {
@@ -55759,6 +55771,50 @@ function downloadArtifact(exec) {
55759
55771
  };
55760
55772
  }
55761
55773
 
55774
+ // src/deploy/debian-apt.ts
55775
+ var DEBIAN_SUITE = "bookworm";
55776
+ var MADISON_TIMEOUT_MS = 1e4;
55777
+ function aptPackageName(from) {
55778
+ const m3 = /^apt:([A-Za-z0-9][A-Za-z0-9+.-]*)$/.exec(from ?? "");
55779
+ return m3?.[1];
55780
+ }
55781
+ function madisonUrl(pkg, suite = DEBIAN_SUITE) {
55782
+ return `https://api.ftp-master.debian.org/madison?package=${encodeURIComponent(pkg)}&s=${encodeURIComponent(suite)}&a=amd64,all&text=on`;
55783
+ }
55784
+ function upstreamVersion(debianVersion) {
55785
+ const noEpoch = debianVersion.replace(/^\d+:/, "");
55786
+ const m3 = /^(\d+\.\d+(?:\.\d+)?)(?:[-+~]|$)/.exec(noEpoch);
55787
+ return m3?.[1];
55788
+ }
55789
+ function parseMadison(text, pkg) {
55790
+ for (const line of String(text).split("\n")) {
55791
+ const cols = line.split("|").map((s2) => s2.trim());
55792
+ if (cols.length < 3 || cols[0] !== pkg || !cols[1]) continue;
55793
+ return { debianVersion: cols[1], upstream: upstreamVersion(cols[1]) };
55794
+ }
55795
+ return void 0;
55796
+ }
55797
+ function gteVersion(a2, b3) {
55798
+ const A4 = a2.split(".").map(Number);
55799
+ const B3 = b3.split(".").map(Number);
55800
+ for (let i2 = 0; i2 < Math.max(A4.length, B3.length); i2++) {
55801
+ const x2 = A4[i2] ?? 0;
55802
+ const y3 = B3[i2] ?? 0;
55803
+ if (x2 !== y3) return x2 > y3;
55804
+ }
55805
+ return true;
55806
+ }
55807
+ function lookupDebianPackage(fetchFn = fetch) {
55808
+ return async (pkg) => {
55809
+ const res = await fetchFn(madisonUrl(pkg), { signal: AbortSignal.timeout(MADISON_TIMEOUT_MS) });
55810
+ if (!res.ok) throw new Error(`madison HTTP ${res.status}`);
55811
+ return parseMadison(await res.text(), pkg);
55812
+ };
55813
+ }
55814
+
55815
+ // src/handlers/deploy.ts
55816
+ init_protocol();
55817
+
55762
55818
  // src/deploy/repo.ts
55763
55819
  var import_promises6 = __toESM(require("fs/promises"), 1);
55764
55820
  var import_node_path35 = __toESM(require("path"), 1);
@@ -60163,8 +60219,12 @@ function buildDeployHandlers(deps) {
60163
60219
  };
60164
60220
  async function settlePackage(pkg) {
60165
60221
  const localVersion = await deps.probeLocalVersion(pkg);
60166
- const version2 = localVersion ?? pkg.version;
60167
60222
  const { artifact: reported, ...rest } = pkg;
60223
+ if (pkg.from?.startsWith("apt:")) {
60224
+ if (reported) throw invalid(`\`${pkg.name}\` \u662F apt \u6761\u76EE\uFF0C\u4E0D\u5E26 artifact\uFF08\u90A3\u662F github: \u4E13\u7528\uFF09`);
60225
+ return settleApt(aptPackageName(pkg.from), rest, localVersion, pkg.min);
60226
+ }
60227
+ const version2 = localVersion ?? pkg.version;
60168
60228
  const out = { ...rest, ...version2 ? { version: version2 } : {}, ...localVersion ? { localVersion } : {} };
60169
60229
  if (!reported) return out;
60170
60230
  if (!pkg.version) throw invalid(`\u9489\u8D44\u4EA7\u8981\u5148\u8BF4\u6E05\u662F\u54EA\u4E2A\u7248\u672C\u7684\uFF1A\`${pkg.name}\` \u5E26 artifact \u7684\u4E0A\u62A5\u5FC5\u987B\u540C\u65F6\u5E26 version`);
@@ -60177,6 +60237,26 @@ function buildDeployHandlers(deps) {
60177
60237
  }
60178
60238
  return { ...out, artifact: { ...reported, ...verified } };
60179
60239
  }
60240
+ async function settleApt(aptName, fields, localVersion, min) {
60241
+ const { version: _agentVersion, ...rest } = fields;
60242
+ const local = localVersion ? { localVersion } : {};
60243
+ if (CLOUD_ROOT_PROVIDES.includes(fields.name)) return { ...rest, ...local };
60244
+ if (!aptName) {
60245
+ deps.warn?.("deploy.apt.badName", { from: fields.from });
60246
+ return { ...rest, ...local };
60247
+ }
60248
+ let found;
60249
+ try {
60250
+ found = await deps.debianPackage(aptName);
60251
+ } catch (err) {
60252
+ deps.warn?.("deploy.apt.lookupFailed", { pkg: aptName, error: err instanceof Error ? err.message : String(err) });
60253
+ return { ...rest, ...local };
60254
+ }
60255
+ if (!found) return { ...rest, ...local, aptMissing: true };
60256
+ const aptVersion = found.upstream ?? (found.debianVersion || void 0);
60257
+ const pin = found.upstream && !(min && !gteVersion(found.upstream, min)) ? { version: found.upstream } : {};
60258
+ return { ...rest, ...pin, ...local, ...aptVersion ? { aptVersion } : {} };
60259
+ }
60180
60260
  const reportFinding = async (frame, _client, ctx) => {
60181
60261
  ensureOwner(ctx);
60182
60262
  const args = parseArgs2(DeployReportFindingArgsSchema, frame, "deploy:reportFinding");
@@ -71503,7 +71583,7 @@ function computeMethodAccess(args) {
71503
71583
  }
71504
71584
 
71505
71585
  // src/version.ts
71506
- var version = "0.2.575".length > 0 ? "0.2.575" : "dev";
71586
+ var version = "0.2.576".length > 0 ? "0.2.576" : "dev";
71507
71587
 
71508
71588
  // src/cli-probe/probe.ts
71509
71589
  var fs79 = __toESM(require("fs"), 1);
@@ -75173,6 +75253,8 @@ async function startDaemon(config) {
75173
75253
  return probeLocalVersion(runCommand, pkg);
75174
75254
  },
75175
75255
  fetchArtifact: downloadArtifact(runCommand),
75256
+ // apt 条目的 version 按 Debian 12 仓库定(不是本机):一次出网查 madison,只要元数据不下载
75257
+ debianPackage: lookupDebianPackage(),
75176
75258
  githubIdentity,
75177
75259
  githubApi: (token) => createGithubApi({ token }),
75178
75260
  org: PERSONA_REPO_ORG,
@@ -21332,7 +21332,18 @@ var EnvPackageSchema = external_exports.object({
21332
21332
  */
21333
21333
  localVersion: external_exports.string().optional(),
21334
21334
  /** `github:` 专用——那个版本是哪个文件。见 EnvArtifactSchema */
21335
- artifact: EnvArtifactSchema.optional()
21335
+ artifact: EnvArtifactSchema.optional(),
21336
+ /**
21337
+ * `apt:` 专用——daemon 上报时查过 Debian 12(bookworm)仓库,**没有**这个包。云上装不了,怎么办由老板在页面上定(换源 / 去掉 / 接受);
21338
+ * 不打回 butler(它也不见得找得到对的 npm / github 源)。有这个包时不写此字段,`version` 就是 Debian 12 会装的那一版(不是本机的)。
21339
+ */
21340
+ aptMissing: external_exports.literal(true).optional(),
21341
+ /**
21342
+ * `apt:` 专用——daemon 查到的 Debian 12 里这个包的版本(上游号,如 `3.11.2`;元包抠不出上游号时是 Debian 的版本串原样)。
21343
+ * 是**事实**不是要求:`version` 才是构建期要验的那个——Debian 版本满足 `min`(或没 `min`)时 `version` = 它;不满足时只记这里、不钉 `version`,
21344
+ * 页面把「Debian 12 只有 x,要求 ≥ min」摆出来让老板定。查不到(出网失败)时两者都不写,页面显示「没查到」。
21345
+ */
21346
+ aptVersion: external_exports.string().optional()
21336
21347
  });
21337
21348
  var EnvSecretSchema = external_exports.object({
21338
21349
  // 凭据的命名引用('aliyun-ak' / 'supabase-shared')。部署时按这个名字去解析实际的值。
@@ -21518,7 +21518,18 @@ var EnvPackageSchema = external_exports.object({
21518
21518
  */
21519
21519
  localVersion: external_exports.string().optional(),
21520
21520
  /** `github:` 专用——那个版本是哪个文件。见 EnvArtifactSchema */
21521
- artifact: EnvArtifactSchema.optional()
21521
+ artifact: EnvArtifactSchema.optional(),
21522
+ /**
21523
+ * `apt:` 专用——daemon 上报时查过 Debian 12(bookworm)仓库,**没有**这个包。云上装不了,怎么办由老板在页面上定(换源 / 去掉 / 接受);
21524
+ * 不打回 butler(它也不见得找得到对的 npm / github 源)。有这个包时不写此字段,`version` 就是 Debian 12 会装的那一版(不是本机的)。
21525
+ */
21526
+ aptMissing: external_exports.literal(true).optional(),
21527
+ /**
21528
+ * `apt:` 专用——daemon 查到的 Debian 12 里这个包的版本(上游号,如 `3.11.2`;元包抠不出上游号时是 Debian 的版本串原样)。
21529
+ * 是**事实**不是要求:`version` 才是构建期要验的那个——Debian 版本满足 `min`(或没 `min`)时 `version` = 它;不满足时只记这里、不钉 `version`,
21530
+ * 页面把「Debian 12 只有 x,要求 ≥ min」摆出来让老板定。查不到(出网失败)时两者都不写,页面显示「没查到」。
21531
+ */
21532
+ aptVersion: external_exports.string().optional()
21522
21533
  });
21523
21534
  var EnvSecretSchema = external_exports.object({
21524
21535
  // 凭据的命名引用('aliyun-ak' / 'supabase-shared')。部署时按这个名字去解析实际的值。
@@ -24807,7 +24818,7 @@ var DEPLOY_FILE = import_node_path3.default.join(".clawd", "deploy.json");
24807
24818
  var SCAN_FILE = import_node_path3.default.join(".clawd", "deploy-scan.json");
24808
24819
  var z1 = DeployScanSchema.omit({ id: true, manifest: true }).extend({ releasedHead: DeployScanSchema.shape.head }).strict();
24809
24820
  var z2 = external_exports.object({ version: external_exports.literal(2), scans: external_exports.array(DeployScanSchema), released: DeployReleasedSchema.optional() }).strict();
24810
- var PackageFindingSchema = EnvPackageSchema.omit({ localVersion: true, artifact: true }).extend({
24821
+ var PackageFindingSchema = EnvPackageSchema.omit({ localVersion: true, artifact: true, aptMissing: true, aptVersion: true }).extend({
24811
24822
  artifact: external_exports.object({ url: external_exports.string().url(), bin: external_exports.string() }).strict().optional()
24812
24823
  });
24813
24824
 
@@ -129,11 +129,14 @@ call({ method: "deploy:reportFinding", args: {
129
129
  只有本机没装时才由你按官方文档填一个 `version`,并在收尾的 `notes` 里写明「本机未装 <name>,取的 x.y.z」。
130
130
  `min` 只在你确知下限时填。**不要猜版本号。**
131
131
 
132
- **`from` 必须能装出 `version` 那个确切版本。** 这是选源的硬规则:
133
- - `apt:` 只在 Debian 12 (bookworm) 仓库里有该版本时才报——去 packages.debian.org 核一眼(本机 brew 装的 jq 1.7.1,
134
- bookworm 只有 1.6,那就不能报 `apt:jq`);
135
- - 没有就找上游 release 走 `github:`(jq 有 GitHub release 裸二进制);
136
- - 哪种都装不出本机那一版 → 写进 `notes` 作为存疑项,让老板决定。**不要报一个装出来版本不对的源。**
132
+ **`apt:` 条目的版本由 daemon 按 Debian 12 定,你只管报 `apt:<包名>`。** apt 每个包只有 Debian 12 (bookworm) 冻结的那一个版本,
133
+ 本机 brew 装的永远比它新,「本机是啥就上云啥」对 apt 不成立。daemon 收到 `apt:` 条目会去查 Debian 官方仓库(一次元数据查询,不下载),
134
+ 把云上会装的版本写进 `version`,本机的记在 `localVersion`,页面那一行直接显示「云上装 Debian 12 的 3.11.2,本机 3.12.9」;
135
+ Debian 12 没有这个包也照样记下(页面显示「云上装不了」)。**你不要因为版本对不上就自己换成 npm / github 源,也不要下包来验证**——
136
+ 怎么办由老板在页面上定。想先看一眼 Debian 12 有没有、是哪版,用这条(只回一行元数据):
137
+ `curl -s 'https://api.ftp-master.debian.org/madison?package=<包名>&s=bookworm&a=amd64,all&text=on'`,空输出就是没有。
138
+
139
+ **`npm:` / `github:` 必须能装出 `version` 那个确切版本**:npm 注册表和 GitHub release 每个历史版本都在,选错了就是源选错了,不要报一个装出来版本不对的源。
137
140
 
138
141
  **`github:` 要钉资产。** GitHub 不是包注册表,从「仓库 + 版本」推不出该下哪个文件,构建器不猜。分两步:
139
142
  1. 先报 `{ name, from: "github:<owner>/<repo>" }`,从返回的 view 里读 daemon 定下的 `version`;
@@ -21518,7 +21518,18 @@ var EnvPackageSchema = external_exports.object({
21518
21518
  */
21519
21519
  localVersion: external_exports.string().optional(),
21520
21520
  /** `github:` 专用——那个版本是哪个文件。见 EnvArtifactSchema */
21521
- artifact: EnvArtifactSchema.optional()
21521
+ artifact: EnvArtifactSchema.optional(),
21522
+ /**
21523
+ * `apt:` 专用——daemon 上报时查过 Debian 12(bookworm)仓库,**没有**这个包。云上装不了,怎么办由老板在页面上定(换源 / 去掉 / 接受);
21524
+ * 不打回 butler(它也不见得找得到对的 npm / github 源)。有这个包时不写此字段,`version` 就是 Debian 12 会装的那一版(不是本机的)。
21525
+ */
21526
+ aptMissing: external_exports.literal(true).optional(),
21527
+ /**
21528
+ * `apt:` 专用——daemon 查到的 Debian 12 里这个包的版本(上游号,如 `3.11.2`;元包抠不出上游号时是 Debian 的版本串原样)。
21529
+ * 是**事实**不是要求:`version` 才是构建期要验的那个——Debian 版本满足 `min`(或没 `min`)时 `version` = 它;不满足时只记这里、不钉 `version`,
21530
+ * 页面把「Debian 12 只有 x,要求 ≥ min」摆出来让老板定。查不到(出网失败)时两者都不写,页面显示「没查到」。
21531
+ */
21532
+ aptVersion: external_exports.string().optional()
21522
21533
  });
21523
21534
  var EnvSecretSchema = external_exports.object({
21524
21535
  // 凭据的命名引用('aliyun-ak' / 'supabase-shared')。部署时按这个名字去解析实际的值。
@@ -24807,7 +24818,7 @@ var DEPLOY_FILE = import_node_path3.default.join(".clawd", "deploy.json");
24807
24818
  var SCAN_FILE = import_node_path3.default.join(".clawd", "deploy-scan.json");
24808
24819
  var z1 = DeployScanSchema.omit({ id: true, manifest: true }).extend({ releasedHead: DeployScanSchema.shape.head }).strict();
24809
24820
  var z2 = external_exports.object({ version: external_exports.literal(2), scans: external_exports.array(DeployScanSchema), released: DeployReleasedSchema.optional() }).strict();
24810
- var PackageFindingSchema = EnvPackageSchema.omit({ localVersion: true, artifact: true }).extend({
24821
+ var PackageFindingSchema = EnvPackageSchema.omit({ localVersion: true, artifact: true, aptMissing: true, aptVersion: true }).extend({
24811
24822
  artifact: external_exports.object({ url: external_exports.string().url(), bin: external_exports.string() }).strict().optional()
24812
24823
  });
24813
24824