@evident-ai/cli 3.1.1-dev.45e3647 → 3.1.1-dev.49429a0
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/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6148,8 +6148,10 @@ async function driveChannels(state, driver) {
|
|
|
6148
6148
|
const proxiedActivity = state.lastProxiedActivityAt !== lastSeenProxiedActivityAt;
|
|
6149
6149
|
lastSeenProxiedActivityAt = state.lastProxiedActivityAt;
|
|
6150
6150
|
const appliedFiles = driver.fileSyncActivity().appliedFiles;
|
|
6151
|
-
const
|
|
6151
|
+
const filesApplied = appliedFiles !== lastSeenAppliedFiles;
|
|
6152
|
+
const fileActivity = carriedOverFileSync || filesApplied;
|
|
6152
6153
|
lastSeenAppliedFiles = appliedFiles;
|
|
6154
|
+
if (filesApplied) state.claudeUsageRearm?.();
|
|
6153
6155
|
if (processed > 0 || driver.hasInFlightWatchers() || proxiedActivity || fileActivity) {
|
|
6154
6156
|
idlePolls = 0;
|
|
6155
6157
|
if (processed > 0 && state.interactive) displayStatus(state);
|
|
@@ -6310,13 +6312,26 @@ function scheduleClaudeUsageReporting(state, options) {
|
|
|
6310
6312
|
level: "debug",
|
|
6311
6313
|
message: "Claude usage reporting is off (--claude-usage-reporting off)"
|
|
6312
6314
|
});
|
|
6313
|
-
return;
|
|
6315
|
+
return null;
|
|
6314
6316
|
}
|
|
6315
6317
|
let consecutiveFailures = 0;
|
|
6318
|
+
let armed = false;
|
|
6319
|
+
let rearmRequested = false;
|
|
6316
6320
|
const scheduleNextTick = () => {
|
|
6321
|
+
armed = true;
|
|
6322
|
+
rearmRequested = false;
|
|
6317
6323
|
state.claudeUsageTimer = setTimeout(() => void tick(false), nextReportDelayMs());
|
|
6318
6324
|
};
|
|
6319
|
-
const
|
|
6325
|
+
const rearm = () => {
|
|
6326
|
+
if (armed) {
|
|
6327
|
+
rearmRequested = true;
|
|
6328
|
+
return;
|
|
6329
|
+
}
|
|
6330
|
+
rearmRequested = false;
|
|
6331
|
+
armed = true;
|
|
6332
|
+
state.claudeUsageTimer = setTimeout(() => void tick(true), FIRST_REPORT_DELAY_MS);
|
|
6333
|
+
};
|
|
6334
|
+
const tick = async (isProbe) => {
|
|
6320
6335
|
try {
|
|
6321
6336
|
const usage = await getClaudeUsage();
|
|
6322
6337
|
const result = await reportClaudeUsage(state.agentId, state.authHeader, usage);
|
|
@@ -6352,12 +6367,14 @@ function scheduleClaudeUsageReporting(state, options) {
|
|
|
6352
6367
|
message: "Claude usage reporting is forced on but no usable Claude Code login was found \u2014 run `claude` to sign in; reporting will keep retrying"
|
|
6353
6368
|
});
|
|
6354
6369
|
scheduleNextTick();
|
|
6355
|
-
} else if (
|
|
6370
|
+
} else if (isProbe) {
|
|
6356
6371
|
logActivity(state, {
|
|
6357
6372
|
type: "info",
|
|
6358
6373
|
level: "debug",
|
|
6359
6374
|
message: `Claude usage reporting: ${error2.message}`
|
|
6360
6375
|
});
|
|
6376
|
+
armed = false;
|
|
6377
|
+
if (rearmRequested) rearm();
|
|
6361
6378
|
} else {
|
|
6362
6379
|
logActivity(state, {
|
|
6363
6380
|
type: "info",
|
|
@@ -6378,7 +6395,9 @@ function scheduleClaudeUsageReporting(state, options) {
|
|
|
6378
6395
|
}
|
|
6379
6396
|
}
|
|
6380
6397
|
};
|
|
6398
|
+
armed = true;
|
|
6381
6399
|
state.claudeUsageTimer = setTimeout(() => void tick(true), FIRST_REPORT_DELAY_MS);
|
|
6400
|
+
return rearm;
|
|
6382
6401
|
}
|
|
6383
6402
|
async function notifyOffline(state) {
|
|
6384
6403
|
if (!state.agentId || !state.authHeader) return;
|
|
@@ -6419,6 +6438,7 @@ async function cleanup(state, opts = {}) {
|
|
|
6419
6438
|
clearTimeout(state.claudeUsageTimer);
|
|
6420
6439
|
state.claudeUsageTimer = null;
|
|
6421
6440
|
}
|
|
6441
|
+
state.claudeUsageRearm = null;
|
|
6422
6442
|
if (opts.graceful && state.channelDriver) {
|
|
6423
6443
|
state.channelDriver.stop();
|
|
6424
6444
|
log2(state, "Draining in-flight channel work before shutdown...");
|
|
@@ -6500,6 +6520,7 @@ async function run(options) {
|
|
|
6500
6520
|
lastProxiedActivityAt: null,
|
|
6501
6521
|
sessionCleanupTimers: [],
|
|
6502
6522
|
claudeUsageTimer: null,
|
|
6523
|
+
claudeUsageRearm: null,
|
|
6503
6524
|
authHeader: ""
|
|
6504
6525
|
};
|
|
6505
6526
|
setTelemetryAuthProvider(() => ({ authHeader: state.authHeader, agentId: state.agentId }));
|
|
@@ -6886,7 +6907,7 @@ async function run(options) {
|
|
|
6886
6907
|
throw error2;
|
|
6887
6908
|
}
|
|
6888
6909
|
scheduleSessionCleanup(state, channelDriver, options);
|
|
6889
|
-
scheduleClaudeUsageReporting(state, options);
|
|
6910
|
+
state.claudeUsageRearm = scheduleClaudeUsageReporting(state, options);
|
|
6890
6911
|
if (!interactive || state.json) {
|
|
6891
6912
|
log2(state, "Driving channel messages...");
|
|
6892
6913
|
}
|