@clawos-dev/clawd 0.2.186-beta.371.fccc918 → 0.2.187-beta.372.beee855

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
@@ -48858,8 +48858,24 @@ var SessionObserver = class {
48858
48858
  return import_node_path21.default.join(this.home, ".claude", "projects", cwdToHashDir(cwd), `${toolSessionId}.jsonl`);
48859
48859
  }
48860
48860
  start(args) {
48861
- this.stop(args.sessionId);
48862
48861
  const filePath = this.resolveJsonlPath(args.cwd, args.toolSessionId, args.jsonlPath);
48862
+ const existing = this.watches.get(args.sessionId);
48863
+ if (existing && existing.filePath === filePath) {
48864
+ this.opts.logger?.info("observer.start no-op", {
48865
+ sessionId: args.sessionId,
48866
+ filePath,
48867
+ reason: "already-watching-same-file"
48868
+ });
48869
+ return { filePath };
48870
+ }
48871
+ if (existing) {
48872
+ this.stop(args.sessionId, "file-changed");
48873
+ }
48874
+ this.opts.logger?.info("observer.start", {
48875
+ sessionId: args.sessionId,
48876
+ filePath,
48877
+ reason: existing ? "file-changed" : "first-attach"
48878
+ });
48863
48879
  let size = 0;
48864
48880
  try {
48865
48881
  size = import_node_fs23.default.statSync(filePath).size;
@@ -49006,7 +49022,7 @@ var SessionObserver = class {
49006
49022
  isObserving(sessionId) {
49007
49023
  return this.watches.has(sessionId);
49008
49024
  }
49009
- stop(sessionId) {
49025
+ stop(sessionId, reason = "session-delete") {
49010
49026
  const w2 = this.watches.get(sessionId);
49011
49027
  if (!w2) return false;
49012
49028
  try {
@@ -49017,6 +49033,11 @@ var SessionObserver = class {
49017
49033
  this.watches.delete(sessionId);
49018
49034
  this.metaObserver?.stop(sessionId);
49019
49035
  this.opts.onStatus?.(sessionId, "stopped");
49036
+ this.opts.logger?.info("observer.stop", {
49037
+ sessionId,
49038
+ filePath: w2.filePath,
49039
+ reason
49040
+ });
49020
49041
  return true;
49021
49042
  }
49022
49043
  stopAll() {
@@ -53009,7 +53030,7 @@ function buildSessionHandlers(deps) {
53009
53030
  const newSession = async (frame, _client, ctx) => {
53010
53031
  const args = SessionIdArgs.parse(frame);
53011
53032
  ensureSessionAccess(ctx, args.sessionId, "send");
53012
- observer.stop(args.sessionId);
53033
+ observer.stop(args.sessionId, "session-delete");
53013
53034
  const { response, broadcast } = manager.newSession(args);
53014
53035
  return { response: { type: "session:info", ...response }, broadcast };
53015
53036
  };
@@ -57461,7 +57482,9 @@ async function startDaemon(config) {
57461
57482
  // daemon 内部转译,UI 看到的始终是 events 流里的 synth uuid(详见 manager 注释)
57462
57483
  onUserMessageObserved: (sessionId, realUuid, text) => {
57463
57484
  manager.recordRealUserUuid({ sessionId, realUuid, text });
57464
- }
57485
+ },
57486
+ // 永久取证 log:observer.start / start no-op / stop(spec 2026-06-26-observer-restart-fix §3.3)
57487
+ logger
57465
57488
  });
57466
57489
  manager.attachObserver(observer);
57467
57490
  const claudeAdapter = config.mode === "tui" ? new ClaudeTuiAdapter({