@clawos-dev/clawd 0.2.746 → 0.2.748

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
@@ -53626,11 +53626,11 @@ var DashboardDataError = class extends Error {
53626
53626
  code;
53627
53627
  };
53628
53628
  var SUBROUTES = {
53629
- "cloud-persona-metrics": ["personas", "data", "issues"],
53629
+ "cloud-persona-metrics": ["personas", "data", "issues", "overview"],
53630
53630
  "cloud-persona-conversations": ["personas", "threads", "thread"],
53631
53631
  "cloud-persona-schedules": ["personas", "schedules", "runs"]
53632
53632
  };
53633
- var UPSTREAM_DOWN = { personas: "UPSTREAM_UNREACHABLE", data: "GATEWAY_UNREACHABLE", issues: "GATEWAY_UNREACHABLE", threads: "CENTER_UNREACHABLE", thread: "CENTER_UNREACHABLE", schedules: "GATEWAY_UNREACHABLE", runs: "GATEWAY_UNREACHABLE" };
53633
+ var UPSTREAM_DOWN = { personas: "UPSTREAM_UNREACHABLE", data: "GATEWAY_UNREACHABLE", overview: "GATEWAY_UNREACHABLE", issues: "GATEWAY_UNREACHABLE", threads: "CENTER_UNREACHABLE", thread: "CENTER_UNREACHABLE", schedules: "GATEWAY_UNREACHABLE", runs: "GATEWAY_UNREACHABLE" };
53634
53634
  var NO_STORE = { "cache-control": "no-store" };
53635
53635
  function send(res, status, contentType, body) {
53636
53636
  res.writeHead(status, { "content-type": contentType, ...NO_STORE });
@@ -53676,7 +53676,12 @@ function createDashboardRoutes(deps) {
53676
53676
  const q3 = url.searchParams;
53677
53677
  try {
53678
53678
  if (sub === "personas") {
53679
- sendJson(res, 200, { personas: await deps.data.personas() });
53679
+ const [personas, admin] = await Promise.all([deps.data.personas(), page === "cloud-persona-metrics" ? deps.data.isAdmin() : Promise.resolve(false)]);
53680
+ sendJson(res, 200, page === "cloud-persona-metrics" ? { personas, admin } : { personas });
53681
+ return true;
53682
+ }
53683
+ if (sub === "overview") {
53684
+ sendPassthrough(res, await deps.data.overview());
53680
53685
  return true;
53681
53686
  }
53682
53687
  const personaId2 = q3.get("persona") ?? "";
@@ -54111,6 +54116,10 @@ function createDashboardData(deps) {
54111
54116
  const [registered, visible] = await Promise.all([deps.registeredPersonas(), deps.visiblePersonas(lp)]);
54112
54117
  return visiblePersonaIds(registered, visible);
54113
54118
  },
54119
+ async isAdmin() {
54120
+ return (await deps.visiblePersonas(mustLoginPass())).all;
54121
+ },
54122
+ overview: () => deps.overview(),
54114
54123
  metrics: (q3) => deps.metrics(q3),
54115
54124
  issues: (q3) => deps.issues(q3),
54116
54125
  schedules: (q3) => deps.schedules(q3),
@@ -58843,6 +58852,7 @@ var GATEWAY_ROUTES = {
58843
58852
  volume: () => "/me/volume",
58844
58853
  workspace: (personaId2) => `/p/${encodeURIComponent(personaId2)}/workspace`,
58845
58854
  fork: (personaId2) => `/p/${encodeURIComponent(personaId2)}/fork`,
58855
+ overview: () => "/overview",
58846
58856
  metrics: (personaId2) => `/metrics/${encodeURIComponent(personaId2)}`,
58847
58857
  schedules: (personaId2) => `/schedules/${encodeURIComponent(personaId2)}`,
58848
58858
  scheduleRuns: (personaId2, scheduleId) => `/schedules/${encodeURIComponent(personaId2)}/${encodeURIComponent(scheduleId)}/runs`
@@ -59045,6 +59055,20 @@ var CloudGatewayClient = class {
59045
59055
  throw e;
59046
59056
  }
59047
59057
  }
59058
+ /** 全部 persona 的概览(仅管理员,gateway 问中心判):状态码 + body 原样转,鉴权同 fetchMetrics */
59059
+ async fetchOverview() {
59060
+ const { apiKey, gatewayUrl } = await this.credentials();
59061
+ try {
59062
+ const res = await this.fetchImpl(gatewayUrl + GATEWAY_ROUTES.overview(), {
59063
+ headers: { authorization: `Bearer ${apiKey}` },
59064
+ signal: AbortSignal.timeout(METRICS_TIMEOUT_MS)
59065
+ });
59066
+ return { status: res.status, body: await res.text() };
59067
+ } catch (e) {
59068
+ if (e.name === "TimeoutError") throw new Error(`\u4E91\u4E0A\u670D\u52A1 ${METRICS_TIMEOUT_MS / 1e3} \u79D2\u6CA1\u56DE`);
59069
+ throw e;
59070
+ }
59071
+ }
59048
59072
  /**
59049
59073
  * 看板的定时任务页(design 2026-10-27-cloud-schedule):gateway 回什么原样转(状态码 + body),鉴权同 fetchMetrics。
59050
59074
  * 带 scheduleId = 展开一条任务的运行记录一页(limit / before 分页)
@@ -63196,9 +63220,14 @@ function createGithubApi(args) {
63196
63220
  }
63197
63221
  },
63198
63222
  async putSecret(slug, name, value, environment) {
63199
- if (environment) await must("PUT", `/repos/${slug}/environments/${environment}`, "\u51C6\u5907\u73AF\u5883\u51ED\u636E", {});
63200
63223
  const base = secretsPath(slug, environment);
63201
- const pk = await must("GET", `${base}/public-key`, "\u53D6\u51ED\u636E\u516C\u94A5");
63224
+ let first = await request("GET", `${base}/public-key`);
63225
+ if (environment && first.status === 404) {
63226
+ await must("PUT", `/repos/${slug}/environments/${encodeURIComponent(environment)}`, "\u51C6\u5907\u73AF\u5883\u51ED\u636E", {});
63227
+ first = await request("GET", `${base}/public-key`);
63228
+ }
63229
+ if (first.status < 200 || first.status >= 300) throw new GithubApiError(first.status, explain(first.status, "\u53D6\u51ED\u636E\u516C\u94A5", first.json));
63230
+ const pk = first.json;
63202
63231
  if (typeof pk?.key !== "string" || typeof pk?.key_id !== "string") throw new GithubApiError(200, "\u4ED3\u5E93\u516C\u94A5\u63A5\u53E3\u56DE\u7684\u5F62\u72B6\u4E0D\u5BF9");
63203
63232
  const encrypted_value = await seal(pk.key, value);
63204
63233
  await must("PUT", `${base}/${encodeURIComponent(name)}`, `\u5199 ${name}`, { encrypted_value, key_id: pk.key_id });
@@ -76405,7 +76434,7 @@ function computeMethodAccess(args) {
76405
76434
  }
76406
76435
 
76407
76436
  // src/version.ts
76408
- var version = "0.2.746".length > 0 ? "0.2.746" : "dev";
76437
+ var version = "0.2.748".length > 0 ? "0.2.748" : "dev";
76409
76438
 
76410
76439
  // src/cli-probe/probe.ts
76411
76440
  var fs87 = __toESM(require("fs"), 1);
@@ -80563,6 +80592,7 @@ async function startDaemon(config) {
80563
80592
  loginPass: () => ownerIdentityStore.read()?.loginPass ?? null,
80564
80593
  registeredPersonas: async () => (await cloudGateway.listPersonas()).map((p3) => p3.personaId),
80565
80594
  visiblePersonas: (loginPass) => centralVisiblePersonas({ api: dashboardApi(), loginPass }),
80595
+ overview: () => cloudGateway.fetchOverview(),
80566
80596
  metrics: (q3) => cloudGateway.fetchMetrics(q3),
80567
80597
  issues: (q3) => cloudGateway.fetchThreadIssues(q3),
80568
80598
  schedules: (q3) => cloudGateway.fetchSchedules(q3),