@clawos-dev/clawd 0.2.707 → 0.2.709

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.
@@ -33417,6 +33417,8 @@ var SessionUpdateArgs = external_exports.object({
33417
33417
  sessionId: external_exports.string().min(1),
33418
33418
  patch: external_exports.object({
33419
33419
  label: external_exports.string().optional(),
33420
+ // Engine switch is only accepted before the first query (no toolSessionId yet) and never for cloud tools.
33421
+ tool: external_exports.string().min(1).optional(),
33420
33422
  model: external_exports.string().optional(),
33421
33423
  permissionMode: external_exports.string().optional(),
33422
33424
  effort: external_exports.string().optional(),
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;
@@ -8626,6 +8637,8 @@ var init_schemas = __esm({
8626
8637
  sessionId: external_exports.string().min(1),
8627
8638
  patch: external_exports.object({
8628
8639
  label: external_exports.string().optional(),
8640
+ // Engine switch is only accepted before the first query (no toolSessionId yet) and never for cloud tools.
8641
+ tool: external_exports.string().min(1).optional(),
8629
8642
  model: external_exports.string().optional(),
8630
8643
  permissionMode: external_exports.string().optional(),
8631
8644
  effort: external_exports.string().optional(),
@@ -50546,6 +50559,52 @@ var SessionManager = class {
50546
50559
  return existing;
50547
50560
  }
50548
50561
  update(args) {
50562
+ const { tool, ...rest } = args.patch;
50563
+ const current = this.getFile(args.sessionId);
50564
+ if (tool !== void 0 && tool !== (current.tool ?? "claude")) {
50565
+ return this.switchTool(current, tool, rest);
50566
+ }
50567
+ return this.applyUpdate({ sessionId: args.sessionId, patch: rest });
50568
+ }
50569
+ /**
50570
+ * 首条 query 发出前换引擎:还没有进程也没有历史,只需改 tool、清掉从属于旧引擎的
50571
+ * model / effort / serviceTier(同 patch 带了 model / effort 就用带的)。闲置 runner 绑着旧
50572
+ * adapter(newRunner 时取),直接丢掉,下次用到按新 tool 重建。
50573
+ */
50574
+ switchTool(existing, tool, rest) {
50575
+ const state = this.runners.get(existing.sessionId)?.getState();
50576
+ if (existing.toolSessionId || state?.procAlive || state?.turnOpen) {
50577
+ throw new ClawdError(ERROR_CODES.VALIDATION_ERROR, "Engine can only be changed before the first message");
50578
+ }
50579
+ if (isCloudTool(existing.tool) || isCloudTool(tool)) {
50580
+ throw new ClawdError(ERROR_CODES.VALIDATION_ERROR, "Cloud session engine cannot be changed");
50581
+ }
50582
+ this.deps.getAdapter(tool);
50583
+ this.titleGenPending.get(existing.sessionId)?.abort();
50584
+ this.titleGenPending.delete(existing.sessionId);
50585
+ this.runners.delete(existing.sessionId);
50586
+ const {
50587
+ model: _model,
50588
+ effort: _effort,
50589
+ serviceTier: _serviceTier,
50590
+ resolvedModel: _resolvedModel,
50591
+ resolvedEffort: _resolvedEffort,
50592
+ ...base
50593
+ } = existing;
50594
+ const updated = {
50595
+ ...base,
50596
+ ...rest,
50597
+ tool,
50598
+ ...isCodexFamily(tool) ? { serviceTier: CODEX_SERVICE_TIERS.standard } : {},
50599
+ updatedAt: nowIso2(this.deps)
50600
+ };
50601
+ this.writeOwned(updated);
50602
+ return {
50603
+ response: updated,
50604
+ broadcast: [{ frame: { type: "session:info", ...updated }, target: "all" }]
50605
+ };
50606
+ }
50607
+ applyUpdate(args) {
50549
50608
  const existing = this.getFile(args.sessionId);
50550
50609
  if (args.patch.model !== void 0 || args.patch.label) {
50551
50610
  this.titleGenPending.get(args.sessionId)?.abort();
@@ -75878,7 +75937,7 @@ function computeMethodAccess(args) {
75878
75937
  }
75879
75938
 
75880
75939
  // src/version.ts
75881
- var version = "0.2.707".length > 0 ? "0.2.707" : "dev";
75940
+ var version = "0.2.709".length > 0 ? "0.2.709" : "dev";
75882
75941
 
75883
75942
  // src/cli-probe/probe.ts
75884
75943
  var fs87 = __toESM(require("fs"), 1);