@clawos-dev/clawd 0.2.99 → 0.2.100
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 +33 -19
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -31201,7 +31201,11 @@ function tryFlushPending(state, deps) {
|
|
|
31201
31201
|
const payload = deps.encodeStdin(text, { sessionId: state.file.sessionId });
|
|
31202
31202
|
return [{ kind: "write-stdin", payload }];
|
|
31203
31203
|
}
|
|
31204
|
-
function rgDbg(event, info) {
|
|
31204
|
+
function rgDbg(deps, event, info) {
|
|
31205
|
+
if (deps.logger) {
|
|
31206
|
+
deps.logger.debug(`[RG] ${event}`, info);
|
|
31207
|
+
return;
|
|
31208
|
+
}
|
|
31205
31209
|
console.debug(`[RG] ${event}`, info);
|
|
31206
31210
|
}
|
|
31207
31211
|
function resetReadyGate(next) {
|
|
@@ -31477,7 +31481,7 @@ function applyCommand(state, command, deps) {
|
|
|
31477
31481
|
const payload = deps.encodeStdin(command.text, { sessionId });
|
|
31478
31482
|
effects.push({ kind: "write-stdin", payload });
|
|
31479
31483
|
}
|
|
31480
|
-
rgDbg("send", {
|
|
31484
|
+
rgDbg(deps, "send", {
|
|
31481
31485
|
sid: sessionId,
|
|
31482
31486
|
mode: deps.mode ?? "sdk",
|
|
31483
31487
|
procAliveBefore,
|
|
@@ -31849,13 +31853,13 @@ function reduceSession(state, input, deps) {
|
|
|
31849
31853
|
}
|
|
31850
31854
|
case "ready-detected": {
|
|
31851
31855
|
if (deps.mode !== "tui") {
|
|
31852
|
-
rgDbg("ready-input", { sid: state.file.sessionId, skipped: "non-tui-mode" });
|
|
31856
|
+
rgDbg(deps, "ready-input", { sid: state.file.sessionId, skipped: "non-tui-mode" });
|
|
31853
31857
|
return { state, effects: [] };
|
|
31854
31858
|
}
|
|
31855
31859
|
const next = cloneState(state);
|
|
31856
31860
|
next.readyForSend = true;
|
|
31857
31861
|
const flushEffects = tryFlushPending(next, deps);
|
|
31858
|
-
rgDbg("ready-input", {
|
|
31862
|
+
rgDbg(deps, "ready-input", {
|
|
31859
31863
|
sid: next.file.sessionId,
|
|
31860
31864
|
wroteStdin: flushEffects.length > 0,
|
|
31861
31865
|
readyAfter: next.readyForSend,
|
|
@@ -32028,7 +32032,9 @@ var SessionRunner = class {
|
|
|
32028
32032
|
ownerDisplayName: this.hooks.ownerDisplayName,
|
|
32029
32033
|
personaRoot: this.hooks.personaRoot,
|
|
32030
32034
|
// ReadyGate v2:透传 mode 让 reducer send / ready-detected 分支决定走暂存队列还是直写
|
|
32031
|
-
mode: this.hooks.mode
|
|
32035
|
+
mode: this.hooks.mode,
|
|
32036
|
+
// [RG-DBG] 注入 logger 让 reducer rgDbg 走 pino 进 clawd.log;定位完跟 rgDbg 一起删
|
|
32037
|
+
logger: this.hooks.logger
|
|
32032
32038
|
};
|
|
32033
32039
|
const { state, effects } = reduceSession(this.state, inputMsg, deps);
|
|
32034
32040
|
this.state = state;
|
|
@@ -32207,7 +32213,7 @@ var SessionRunner = class {
|
|
|
32207
32213
|
this.doKill(effect.signal);
|
|
32208
32214
|
break;
|
|
32209
32215
|
case "write-stdin":
|
|
32210
|
-
|
|
32216
|
+
this.hooks.logger?.debug("[RG] write-stdin", {
|
|
32211
32217
|
procAlive: !!this.proc,
|
|
32212
32218
|
stdinWritable: !!this.proc?.stdin,
|
|
32213
32219
|
len: effect.payload.length,
|
|
@@ -33863,12 +33869,12 @@ var SessionManager = class {
|
|
|
33863
33869
|
*/
|
|
33864
33870
|
dispatchReadyDetected(toolSessionId) {
|
|
33865
33871
|
if (this.deps.mode !== "tui") {
|
|
33866
|
-
|
|
33872
|
+
this.deps.logger?.debug("[RG] mgr-disp", { tsid: toolSessionId, skipped: "non-tui-mode" });
|
|
33867
33873
|
return;
|
|
33868
33874
|
}
|
|
33869
33875
|
const sid = this.sessionIdByToolSid(toolSessionId);
|
|
33870
33876
|
const runner = sid ? this.runners.get(sid) : void 0;
|
|
33871
|
-
|
|
33877
|
+
this.deps.logger?.debug("[RG] mgr-disp", {
|
|
33872
33878
|
tsid: toolSessionId,
|
|
33873
33879
|
sid: sid ?? null,
|
|
33874
33880
|
runnerFound: !!runner
|
|
@@ -34997,20 +35003,19 @@ var PtyChildProcess = class extends import_node_events.EventEmitter {
|
|
|
34997
35003
|
if (match) {
|
|
34998
35004
|
const paste = match[1];
|
|
34999
35005
|
const enter = match[2];
|
|
35000
|
-
|
|
35006
|
+
logger?.debug("[RG] pty-paste", { tag, pasteLen: paste.length, enterLen: enter.length });
|
|
35001
35007
|
pty.write(paste);
|
|
35002
35008
|
setTimeout(() => {
|
|
35003
35009
|
try {
|
|
35004
35010
|
pty.write(enter);
|
|
35005
|
-
|
|
35006
|
-
logger?.debug("pty bracketed paste submit \\r delayed", { tag, pid: this.pid });
|
|
35011
|
+
logger?.debug("[RG] pty-paste-enter", { tag, wrote: "\\r", disposed: false });
|
|
35007
35012
|
} catch (err) {
|
|
35008
|
-
|
|
35013
|
+
logger?.debug("[RG] pty-paste-enter", { tag, error: err.message });
|
|
35009
35014
|
logger?.warn("pty delayed \\r failed", { tag, error: err.message });
|
|
35010
35015
|
}
|
|
35011
|
-
},
|
|
35016
|
+
}, 240);
|
|
35012
35017
|
} else {
|
|
35013
|
-
|
|
35018
|
+
logger?.debug("[RG] pty-write-direct", { tag, len: data.length });
|
|
35014
35019
|
pty.write(data);
|
|
35015
35020
|
}
|
|
35016
35021
|
};
|
|
@@ -35251,14 +35256,21 @@ function createReadyDetector(opts) {
|
|
|
35251
35256
|
quietTimer = null;
|
|
35252
35257
|
}
|
|
35253
35258
|
};
|
|
35259
|
+
const dbg = (info) => {
|
|
35260
|
+
if (opts.logger) {
|
|
35261
|
+
opts.logger.debug("[RG] det-state", info);
|
|
35262
|
+
return;
|
|
35263
|
+
}
|
|
35264
|
+
console.debug("[RG] det-state", info);
|
|
35265
|
+
};
|
|
35254
35266
|
const quietFire = () => {
|
|
35255
35267
|
quietTimer = null;
|
|
35256
35268
|
if (disposed) return;
|
|
35257
35269
|
if (!scanReadyFrame()) {
|
|
35258
|
-
|
|
35270
|
+
dbg({ event: "quiet-fire-but-not-ready-anymore" });
|
|
35259
35271
|
return;
|
|
35260
35272
|
}
|
|
35261
|
-
|
|
35273
|
+
dbg({ event: "quiet-fire \u2192 onReady" });
|
|
35262
35274
|
opts.onReady();
|
|
35263
35275
|
};
|
|
35264
35276
|
let prevReady = false;
|
|
@@ -35268,13 +35280,13 @@ function createReadyDetector(opts) {
|
|
|
35268
35280
|
if (!ready) {
|
|
35269
35281
|
clearQuiet();
|
|
35270
35282
|
if (prevReady) {
|
|
35271
|
-
|
|
35283
|
+
dbg({ event: "ready \u2192 not-ready" });
|
|
35272
35284
|
prevReady = false;
|
|
35273
35285
|
}
|
|
35274
35286
|
return;
|
|
35275
35287
|
}
|
|
35276
35288
|
if (!prevReady) {
|
|
35277
|
-
|
|
35289
|
+
dbg({ event: "not-ready \u2192 ready-candidate (quiet timer set)" });
|
|
35278
35290
|
prevReady = true;
|
|
35279
35291
|
}
|
|
35280
35292
|
clearQuiet();
|
|
@@ -35391,7 +35403,9 @@ var ClaudeTuiAdapter = class extends ClaudeAdapter {
|
|
|
35391
35403
|
if (!ctx.toolSessionId || !this.tuiOpts.onReady) return;
|
|
35392
35404
|
this.tuiLogger?.debug("ready-detected", { toolSessionId: ctx.toolSessionId });
|
|
35393
35405
|
this.tuiOpts.onReady(ctx.toolSessionId);
|
|
35394
|
-
}
|
|
35406
|
+
},
|
|
35407
|
+
// [RG-DBG] 排查 ReadyGate 偶现卡输入用;定位完跟所有 [RG] 日志一起删
|
|
35408
|
+
logger: this.tuiLogger
|
|
35395
35409
|
});
|
|
35396
35410
|
if (ctx.toolSessionId && this.tuiOpts.onDetectorRegister) {
|
|
35397
35411
|
this.tuiOpts.onDetectorRegister(ctx.toolSessionId, detector);
|