@clawos-dev/clawd 0.2.609 → 0.2.611

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
@@ -51726,10 +51726,10 @@ var DashboardDataError = class extends Error {
51726
51726
  code;
51727
51727
  };
51728
51728
  var SUBROUTES = {
51729
- "cloud-persona-metrics": ["personas", "data"],
51729
+ "cloud-persona-metrics": ["personas", "data", "issues"],
51730
51730
  "cloud-persona-conversations": ["personas", "threads", "thread"]
51731
51731
  };
51732
- var UPSTREAM_DOWN = { personas: "UPSTREAM_UNREACHABLE", data: "GATEWAY_UNREACHABLE", threads: "CENTER_UNREACHABLE", thread: "CENTER_UNREACHABLE" };
51732
+ var UPSTREAM_DOWN = { personas: "UPSTREAM_UNREACHABLE", data: "GATEWAY_UNREACHABLE", issues: "GATEWAY_UNREACHABLE", threads: "CENTER_UNREACHABLE", thread: "CENTER_UNREACHABLE" };
51733
51733
  var NO_STORE = { "cache-control": "no-store" };
51734
51734
  function send(res, status, contentType, body) {
51735
51735
  res.writeHead(status, { "content-type": contentType, ...NO_STORE });
@@ -51787,6 +51787,17 @@ function createDashboardRoutes(deps) {
51787
51787
  sendPassthrough(res, await deps.data.metrics({ personaId: personaId2, window: q3.get("window"), entry: q3.get("entry") }));
51788
51788
  return true;
51789
51789
  }
51790
+ if (sub === "issues") {
51791
+ const threadId2 = q3.get("threadId") ?? "";
51792
+ const cursor = q3.get("cursor");
51793
+ const rawSnapshot = q3.get("snapshotTo");
51794
+ if (!ID_RE.test(threadId2) || cursor !== null && !/^[A-Za-z0-9_-]{1,256}$/.test(cursor) || rawSnapshot !== null && (!/^[1-9]\d*$/.test(rawSnapshot) || !Number.isSafeInteger(Number(rawSnapshot))) || cursor === null !== (rawSnapshot === null)) {
51795
+ sendJson(res, 400, { code: "INVALID_PARAM", message: "threadId / cursor / snapshotTo \u65E0\u6548" });
51796
+ return true;
51797
+ }
51798
+ sendPassthrough(res, await deps.data.issues({ personaId: personaId2, threadId: threadId2, window: q3.get("window"), entry: q3.get("entry"), cursor, snapshotTo: rawSnapshot === null ? null : Number(rawSnapshot) }));
51799
+ return true;
51800
+ }
51790
51801
  if (sub === "threads") {
51791
51802
  const limit = q3.get("limit");
51792
51803
  if (limit !== null && !/^\d{1,3}$/.test(limit)) {
@@ -52974,6 +52985,7 @@ function createDashboardData(deps) {
52974
52985
  return visiblePersonaIds(registered, visible);
52975
52986
  },
52976
52987
  metrics: (q3) => deps.metrics(q3),
52988
+ issues: (q3) => deps.issues(q3),
52977
52989
  async threads(q3) {
52978
52990
  return deps.threads(mustLoginPass(), q3);
52979
52991
  },
@@ -64672,6 +64684,24 @@ var CloudGatewayClient = class {
64672
64684
  throw e;
64673
64685
  }
64674
64686
  }
64687
+ async fetchThreadIssues(q3) {
64688
+ const { apiKey, gatewayUrl } = await this.credentials();
64689
+ const qs = new URLSearchParams({ threadId: q3.threadId });
64690
+ if (q3.window) qs.set("window", q3.window);
64691
+ if (q3.entry) qs.set("entry", q3.entry);
64692
+ if (q3.cursor) qs.set("cursor", q3.cursor);
64693
+ if (q3.snapshotTo !== null) qs.set("snapshotTo", String(q3.snapshotTo));
64694
+ try {
64695
+ const res = await this.fetchImpl(`${gatewayUrl}${GATEWAY_ROUTES.metrics(q3.personaId)}/issues?${qs}`, {
64696
+ headers: { authorization: `Bearer ${apiKey}` },
64697
+ signal: AbortSignal.timeout(METRICS_TIMEOUT_MS)
64698
+ });
64699
+ return { status: res.status, body: await res.text() };
64700
+ } catch (e) {
64701
+ if (e.name === "TimeoutError") throw new Error(`\u4E91\u4E0A\u670D\u52A1 ${METRICS_TIMEOUT_MS / 1e3} \u79D2\u6CA1\u56DE`);
64702
+ throw e;
64703
+ }
64704
+ }
64675
64705
  /**
64676
64706
  * 这个人云盘上一轮末的用量(design 2026-09-19-cloud-volume-usage §3.3)。gateway 回 `volume: null` = 还没跑过任务(没有盘)。
64677
64707
  * 没登录 / 没 key 走 credentials() 的抛法,调用方(cloud:volume:get 的 handler)把它们和网络错一并折成 null——角标不该弹错。
@@ -71700,7 +71730,7 @@ function assertGuestPath(ctx, absPath, personaRoot, method, usersRoot) {
71700
71730
  }
71701
71731
  }
71702
71732
  function buildHistoryHandlers(deps) {
71703
- const { manager, history, getHistoryReader, store, personaRoot, usersRoot } = deps;
71733
+ const { manager, history, getHistoryReader, store, personaRoot, usersRoot, logger } = deps;
71704
71734
  const projects = async (_frame, _client, ctx) => {
71705
71735
  const list2 = await history.listProjects();
71706
71736
  if (ctx?.principal.kind === "guest" && personaRoot) {
@@ -71740,15 +71770,41 @@ function buildHistoryHandlers(deps) {
71740
71770
  }
71741
71771
  }
71742
71772
  if (!f2.toolSessionId) {
71773
+ logger?.info("chatflow.history.daemon.result", {
71774
+ sessionId: args.sessionId,
71775
+ toolSessionId: null,
71776
+ reason: "no-tool-session-id",
71777
+ messages: 0,
71778
+ total: 0
71779
+ });
71743
71780
  return {
71744
71781
  response: { type: "history:read", messages: [], total: 0, offset: 0 }
71745
71782
  };
71746
71783
  }
71747
- const res = await getHistoryReader(f2.tool ?? "claude").read({
71748
- cwd: f2.cwd,
71784
+ let res;
71785
+ try {
71786
+ res = await getHistoryReader(f2.tool ?? "claude").read({
71787
+ cwd: f2.cwd,
71788
+ toolSessionId: f2.toolSessionId,
71789
+ limit: args.limit,
71790
+ offset: args.offset
71791
+ });
71792
+ } catch (err) {
71793
+ logger?.warn("chatflow.history.daemon.error", {
71794
+ sessionId: args.sessionId,
71795
+ toolSessionId: f2.toolSessionId,
71796
+ tool: f2.tool ?? "claude",
71797
+ errorCode: err instanceof ClawdError ? err.code : null
71798
+ });
71799
+ throw err;
71800
+ }
71801
+ logger?.info("chatflow.history.daemon.result", {
71802
+ sessionId: args.sessionId,
71749
71803
  toolSessionId: f2.toolSessionId,
71750
- limit: args.limit,
71751
- offset: args.offset
71804
+ tool: f2.tool ?? "claude",
71805
+ messages: res.messages.length,
71806
+ total: res.total,
71807
+ offset: res.offset
71752
71808
  });
71753
71809
  const messages = args.slim ? slimHistoryMessages(res.messages) : res.messages;
71754
71810
  return { response: { type: "history:read", ...res, messages } };
@@ -73431,7 +73487,7 @@ function computeMethodAccess(args) {
73431
73487
  }
73432
73488
 
73433
73489
  // src/version.ts
73434
- var version = "0.2.609".length > 0 ? "0.2.609" : "dev";
73490
+ var version = "0.2.611".length > 0 ? "0.2.611" : "dev";
73435
73491
 
73436
73492
  // src/cli-probe/probe.ts
73437
73493
  var fs83 = __toESM(require("fs"), 1);
@@ -77304,6 +77360,7 @@ async function startDaemon(config) {
77304
77360
  registeredPersonas: async () => (await cloudGateway.listPersonas()).map((p3) => p3.personaId),
77305
77361
  visiblePersonas: (loginPass) => centralVisiblePersonas({ api: dashboardApi(), loginPass }),
77306
77362
  metrics: (q3) => cloudGateway.fetchMetrics(q3),
77363
+ issues: (q3) => cloudGateway.fetchThreadIssues(q3),
77307
77364
  threads: (loginPass, q3) => centralPersonaThreads({ api: dashboardApi(), loginPass, ...q3 }),
77308
77365
  thread: (loginPass, q3) => centralPersonaThread({ api: dashboardApi(), loginPass, ...q3 }),
77309
77366
  logger