@todos-dev/cli 0.1.9 → 0.1.10
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 +27 -6
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -15630,7 +15630,7 @@ async function postCritical(serverUrl, path, body, token) {
|
|
|
15630
15630
|
`[machine] POST ${path}`
|
|
15631
15631
|
);
|
|
15632
15632
|
}
|
|
15633
|
-
function startHeartbeat(serverUrl, stepId, onSignal, token, onRunners) {
|
|
15633
|
+
function startHeartbeat(serverUrl, stepId, onSignal, token, onRunners, intervalMs = 60 * 1e3) {
|
|
15634
15634
|
let active = true;
|
|
15635
15635
|
let inFlight = false;
|
|
15636
15636
|
const tick = async () => {
|
|
@@ -15645,7 +15645,7 @@ function startHeartbeat(serverUrl, stepId, onSignal, token, onRunners) {
|
|
|
15645
15645
|
}
|
|
15646
15646
|
};
|
|
15647
15647
|
void tick();
|
|
15648
|
-
const id = setInterval(tick,
|
|
15648
|
+
const id = setInterval(tick, intervalMs);
|
|
15649
15649
|
return () => {
|
|
15650
15650
|
active = false;
|
|
15651
15651
|
clearInterval(id);
|
|
@@ -16004,10 +16004,31 @@ async function executeCompact(step, serverUrl, token) {
|
|
|
16004
16004
|
thinkingLevel: step.agent.thinkingLevel ?? "",
|
|
16005
16005
|
webSearch: false
|
|
16006
16006
|
});
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16007
|
+
let cancelled = false;
|
|
16008
|
+
const stopHeartbeat = startHeartbeat(serverUrl, stepId, () => {
|
|
16009
|
+
cancelled = true;
|
|
16010
|
+
session.abortCompaction();
|
|
16011
|
+
}, token, void 0, 2e3);
|
|
16012
|
+
try {
|
|
16013
|
+
let result;
|
|
16014
|
+
try {
|
|
16015
|
+
result = await session.compact();
|
|
16016
|
+
} catch (err) {
|
|
16017
|
+
if (!cancelled) throw err;
|
|
16018
|
+
console.log(`[compact] ${stepId} cancelled (aborted)`);
|
|
16019
|
+
await done({ error: "Cancelled" });
|
|
16020
|
+
return;
|
|
16021
|
+
}
|
|
16022
|
+
const res = await done({ contextUsage: session.getContextUsage(), tokensBefore: result?.tokensBefore });
|
|
16023
|
+
if (res?.owned) {
|
|
16024
|
+
await backupSession(conversationId, session.sessionFile, step.sessionBackupUrl);
|
|
16025
|
+
console.log(`[compact] ${stepId} done (before ~${result?.tokensBefore} tokens)`);
|
|
16026
|
+
} else {
|
|
16027
|
+
console.log(`[compact] ${stepId} superseded after compaction \u2014 discarding`);
|
|
16028
|
+
}
|
|
16029
|
+
} finally {
|
|
16030
|
+
stopHeartbeat();
|
|
16031
|
+
}
|
|
16011
16032
|
} catch (err) {
|
|
16012
16033
|
const msg = err instanceof Error ? err.message : String(err);
|
|
16013
16034
|
console.error(`[compact] ${stepId} failed:`, msg);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todos-dev/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tds": "dist/index.js"
|
|
6
6
|
},
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"@tds/types": "0.1.0"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@todos-dev/cli-darwin-arm64": "0.1.
|
|
34
|
-
"@todos-dev/cli-darwin-x64": "0.1.
|
|
35
|
-
"@todos-dev/cli-linux-x64": "0.1.
|
|
36
|
-
"@todos-dev/cli-linux-arm64": "0.1.
|
|
37
|
-
"@todos-dev/cli-win32-x64": "0.1.
|
|
38
|
-
"@todos-dev/cli-win32-arm64": "0.1.
|
|
33
|
+
"@todos-dev/cli-darwin-arm64": "0.1.10",
|
|
34
|
+
"@todos-dev/cli-darwin-x64": "0.1.10",
|
|
35
|
+
"@todos-dev/cli-linux-x64": "0.1.10",
|
|
36
|
+
"@todos-dev/cli-linux-arm64": "0.1.10",
|
|
37
|
+
"@todos-dev/cli-win32-x64": "0.1.10",
|
|
38
|
+
"@todos-dev/cli-win32-arm64": "0.1.10"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"dev": "tsx watch src/index.ts",
|