@clawos-dev/clawd 0.2.708 → 0.2.710

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
@@ -6155,11 +6155,19 @@ function connectorBlockers(c2) {
6155
6155
  if (c2.credentialSource === "shared" && c2.fields.length === 0) out.push(`\u8FDE\u63A5\u5668 ${c2.name} \u9009\u4E86\u53D1\u5E03\u8005\u7684\u8D26\u53F7\uFF0C\u4F46\u8981\u586B\u7684\u53D8\u91CF\u8FD8\u6CA1\u5217`);
6156
6156
  return out;
6157
6157
  }
6158
+ function goSpecPinned(spec) {
6159
+ const m3 = GO_SPEC_RE.exec(spec);
6160
+ return !!m3 && !GO_MOVING_REFS.includes(m3[2]);
6161
+ }
6158
6162
  function packageBlockers(p3) {
6159
6163
  const provided = CLOUD_ROOT_PROVIDES.includes(p3.name) || CLOUD_BASE_PROVIDES.includes(p3.name);
6160
- if (p3.from?.startsWith("github:") && !p3.artifact && !provided) {
6164
+ if (provided) return [];
6165
+ if (p3.from?.startsWith("github:") && !p3.artifact) {
6161
6166
  return [`${p3.name} \u8FD8\u6CA1\u9489\u4E0B\u8F7D\u8D44\u4EA7\uFF08github: \u8981\u5177\u4F53\u5230\u54EA\u4E2A\u6587\u4EF6\uFF09\u2014\u2014\u91CD\u65B0\u626B\u63CF`];
6162
6167
  }
6168
+ if (p3.from?.startsWith("go:") && !goSpecPinned(p3.from.slice("go:".length))) {
6169
+ return [`${p3.name} \u8FD8\u6CA1\u9489\u7248\u672C\uFF08go: \u8981\u5199\u6210 <module>@<tag>\uFF0C\u4E0D\u6536 latest / main \u8FD9\u7C7B\u79FB\u52A8\u5F15\u7528\uFF09\u2014\u2014\u91CD\u65B0\u626B\u63CF`];
6170
+ }
6163
6171
  return [];
6164
6172
  }
6165
6173
  function sharedConnectorSecrets(m3) {
@@ -6168,7 +6176,7 @@ function sharedConnectorSecrets(m3) {
6168
6176
  function requiredSecretEnvNames(m3) {
6169
6177
  return [.../* @__PURE__ */ new Set([...m3.secrets.flatMap((s2) => s2.env), ...sharedConnectorSecrets(m3).flatMap((s2) => s2.env)])];
6170
6178
  }
6171
- var EnvArtifactSchema, CLOUD_DEBIAN, CLOUD_ROOT_PROVIDES, CLOUD_BASE_PROVIDES, EnvPackageSchema, EnvSecretSchema, ConnectorNameSchema, CONNECTOR_KINDS, CONNECTOR_RUNNERS, CONNECTOR_PROTOCOLS, CREDENTIAL_SOURCES, CONNECTOR_AUTHS, ConnectorFieldSchema, EnvConnectorSchema, FEISHU_BOT_FIELDS, normalizeLegacyManifest, PUBLISHER_TEST_NOTE_PREFIX, PublisherTestSchema, MANIFEST_BODY, EnvManifestBodySchema, EnvironmentManifestSchema, EnvEvidenceSchema;
6179
+ var EnvArtifactSchema, CLOUD_DEBIAN, CLOUD_ROOT_PROVIDES, CLOUD_BASE_PROVIDES, EnvPackageSchema, EnvSecretSchema, ConnectorNameSchema, CONNECTOR_KINDS, CONNECTOR_RUNNERS, CONNECTOR_PROTOCOLS, CREDENTIAL_SOURCES, CONNECTOR_AUTHS, ConnectorFieldSchema, EnvConnectorSchema, FEISHU_BOT_FIELDS, GO_SPEC_RE, GO_MOVING_REFS, normalizeLegacyManifest, PUBLISHER_TEST_NOTE_PREFIX, PublisherTestSchema, MANIFEST_BODY, EnvManifestBodySchema, EnvironmentManifestSchema, EnvEvidenceSchema;
6172
6180
  var init_environment_schemas = __esm({
6173
6181
  "../protocol/src/environment-schemas.ts"() {
6174
6182
  "use strict";
@@ -6194,6 +6202,7 @@ var init_environment_schemas = __esm({
6194
6202
  "jq",
6195
6203
  "rsync",
6196
6204
  "psql",
6205
+ "go",
6197
6206
  "chromium",
6198
6207
  "fonts-wqy-microhei",
6199
6208
  "pnpm",
@@ -6263,6 +6272,8 @@ var init_environment_schemas = __esm({
6263
6272
  http: external_exports.object({ url: external_exports.string().min(1), headers: external_exports.record(external_exports.string(), external_exports.string()) }).optional()
6264
6273
  });
6265
6274
  FEISHU_BOT_FIELDS = ["LARKSUITE_CLI_APP_ID", "LARKSUITE_CLI_APP_SECRET"];
6275
+ GO_SPEC_RE = /^([A-Za-z0-9._/-]+)@([A-Za-z0-9._-]+)(?:\?tags=([A-Za-z0-9_,]+))?$/;
6276
+ GO_MOVING_REFS = ["main", "master", "HEAD", "latest"];
6266
6277
  normalizeLegacyManifest = (v3) => {
6267
6278
  if (!v3 || typeof v3 !== "object") return v3;
6268
6279
  let o2 = v3;
@@ -48252,7 +48263,7 @@ function shallowEqMeta(a2, b3) {
48252
48263
  function applyMetaUpdate(state, patch, deps) {
48253
48264
  const next = cloneState(state);
48254
48265
  const merged = { ...next.file, ...patch };
48255
- if (patch.resolvedModel !== void 0) {
48266
+ if (patch.resolvedModel !== void 0 && patch.contextWindowSize === void 0 && (patch.resolvedModel !== next.file.resolvedModel || merged.contextWindowSize === void 0)) {
48256
48267
  const w3 = deps.resolveContextWindow?.(next.file.tool, patch.resolvedModel);
48257
48268
  if (w3 !== void 0) merged.contextWindowSize = w3;
48258
48269
  }
@@ -49219,6 +49230,7 @@ var SessionRunner = class {
49219
49230
  // effect 路由到 session 一等方法(startTurn/respondPermission/answerQuestion/interrupt/stop)。claude 恒 null。
49220
49231
  session = null;
49221
49232
  sessionGeneration = 0;
49233
+ contextRefresh = null;
49222
49234
  stdoutBuf = "";
49223
49235
  // 未决 control_request 表;key = request_id
49224
49236
  pendingControlRequests = /* @__PURE__ */ new Map();
@@ -49387,6 +49399,26 @@ var SessionRunner = class {
49387
49399
  }
49388
49400
  }
49389
49401
  }
49402
+ /** Ask CC for its /context summary, including its own compaction-policy window. */
49403
+ refreshClaudeContext() {
49404
+ const proc = this.proc;
49405
+ if (!proc || !this.state.procAlive || this.state.turnOpen || this.hooks.adapter.id !== "claude" || this.hooks.mode === "tui") return;
49406
+ const refresh = this.sendControlRequest("get_context_usage", { detail: "summary" }).then((raw) => {
49407
+ if (this.proc !== proc || this.contextRefresh !== refresh || this.state.turnOpen || !raw || typeof raw !== "object") return;
49408
+ const usage = raw;
49409
+ const total = usage.totalTokens;
49410
+ const window2 = usage.rawMaxTokens;
49411
+ if (typeof total !== "number" || !Number.isSafeInteger(total) || total < 0 || typeof window2 !== "number" || !Number.isSafeInteger(window2) || window2 <= 0) return;
49412
+ this.feedObserverEvents([{ kind: "meta_update", patch: {
49413
+ ...typeof usage.model === "string" && usage.model ? { resolvedModel: usage.model } : {},
49414
+ contextUsage: { inputTokens: total, outputTokens: 0 },
49415
+ contextWindowSize: window2
49416
+ } }]);
49417
+ }).catch((err) => {
49418
+ this.hooks.logger?.debug("claude context summary unavailable", { message: String(err) });
49419
+ });
49420
+ this.contextRefresh = refresh;
49421
+ }
49390
49422
  // CC control_request 按 request_id 匹配异步 control_response;退出或超时拒绝等待者。
49391
49423
  sendControlRequest(subtype, extraRequestFields = {}, opts = {}) {
49392
49424
  const proc = this.proc;
@@ -49489,9 +49521,12 @@ var SessionRunner = class {
49489
49521
  }
49490
49522
  this.doKill(effect.signal);
49491
49523
  break;
49492
- case "close-stdin":
49493
- this.proc?.stdin?.end();
49524
+ case "close-stdin": {
49525
+ const proc = this.proc;
49526
+ if (this.contextRefresh) void this.contextRefresh.then(() => proc?.stdin?.end());
49527
+ else proc?.stdin?.end();
49494
49528
  break;
49529
+ }
49495
49530
  case "write-stdin":
49496
49531
  if (this.session) {
49497
49532
  this.session.startTurn(effect.payload, this.state.file.cloudPendingTurns?.at(-1)?.id ?? this.state.file.cloudPendingCommand?.id);
@@ -49559,6 +49594,7 @@ var SessionRunner = class {
49559
49594
  ...input.kind === "command" ? { commandKind: input.command.kind } : {}
49560
49595
  });
49561
49596
  }
49597
+ if (event?.kind === "turn_end") this.refreshClaudeContext();
49562
49598
  this.hooks.broadcastFrame(effect.frame, effect.target ?? "broadcast");
49563
49599
  break;
49564
49600
  }
@@ -75926,7 +75962,7 @@ function computeMethodAccess(args) {
75926
75962
  }
75927
75963
 
75928
75964
  // src/version.ts
75929
- var version = "0.2.708".length > 0 ? "0.2.708" : "dev";
75965
+ var version = "0.2.710".length > 0 ? "0.2.710" : "dev";
75930
75966
 
75931
75967
  // src/cli-probe/probe.ts
75932
75968
  var fs87 = __toESM(require("fs"), 1);