substrate-ai 0.2.14 → 0.2.15
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/index.js +9 -8
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2675,11 +2675,11 @@ function defaultSupervisorDeps() {
|
|
|
2675
2675
|
sleep: (ms) => new Promise((resolve$2) => setTimeout(resolve$2, ms)),
|
|
2676
2676
|
incrementRestarts: (() => {
|
|
2677
2677
|
let cachedDbWrapper = null;
|
|
2678
|
-
return (runId, projectRoot) => {
|
|
2678
|
+
return async (runId, projectRoot) => {
|
|
2679
2679
|
try {
|
|
2680
2680
|
if (cachedDbWrapper === null) {
|
|
2681
|
-
const
|
|
2682
|
-
const dbPath = join(
|
|
2681
|
+
const dbRoot = await resolveMainRepoRoot(projectRoot);
|
|
2682
|
+
const dbPath = join(dbRoot, ".substrate", "substrate.db");
|
|
2683
2683
|
cachedDbWrapper = new DatabaseWrapper(dbPath);
|
|
2684
2684
|
}
|
|
2685
2685
|
incrementRunRestarts(cachedDbWrapper.getDb(), runId);
|
|
@@ -2691,9 +2691,10 @@ function defaultSupervisorDeps() {
|
|
|
2691
2691
|
}
|
|
2692
2692
|
};
|
|
2693
2693
|
})(),
|
|
2694
|
-
getTokenSnapshot: (runId, projectRoot) => {
|
|
2694
|
+
getTokenSnapshot: async (runId, projectRoot) => {
|
|
2695
2695
|
try {
|
|
2696
|
-
const
|
|
2696
|
+
const dbRoot = await resolveMainRepoRoot(projectRoot);
|
|
2697
|
+
const dbPath = join(dbRoot, ".substrate", "substrate.db");
|
|
2697
2698
|
if (!existsSync(dbPath)) return {
|
|
2698
2699
|
input: 0,
|
|
2699
2700
|
output: 0,
|
|
@@ -2852,7 +2853,7 @@ async function handleStallRecovery(health, state, config, deps, io) {
|
|
|
2852
2853
|
};
|
|
2853
2854
|
}
|
|
2854
2855
|
const newRestartCount = state.restartCount + 1;
|
|
2855
|
-
if (health.run_id !== null) incrementRestarts(health.run_id, projectRoot);
|
|
2856
|
+
if (health.run_id !== null) await incrementRestarts(health.run_id, projectRoot);
|
|
2856
2857
|
emitEvent({
|
|
2857
2858
|
type: "supervisor:restart",
|
|
2858
2859
|
run_id: health.run_id,
|
|
@@ -2927,7 +2928,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
2927
2928
|
});
|
|
2928
2929
|
const ts = new Date().toISOString();
|
|
2929
2930
|
if (outputFormat === "json") {
|
|
2930
|
-
const tokenSnapshot = health.run_id !== null ? getTokenSnapshot(health.run_id, projectRoot) : {
|
|
2931
|
+
const tokenSnapshot = health.run_id !== null ? await getTokenSnapshot(health.run_id, projectRoot) : {
|
|
2931
2932
|
input: 0,
|
|
2932
2933
|
output: 0,
|
|
2933
2934
|
cost_usd: 0
|
|
@@ -3147,7 +3148,7 @@ async function runMultiProjectSupervisor(options, deps = {}) {
|
|
|
3147
3148
|
}
|
|
3148
3149
|
const state = states.get(projectRoot);
|
|
3149
3150
|
if (outputFormat === "json") {
|
|
3150
|
-
const tokenSnapshot = health.run_id !== null ? getTokenSnapshot(health.run_id, projectRoot) : {
|
|
3151
|
+
const tokenSnapshot = health.run_id !== null ? await getTokenSnapshot(health.run_id, projectRoot) : {
|
|
3151
3152
|
input: 0,
|
|
3152
3153
|
output: 0,
|
|
3153
3154
|
cost_usd: 0
|