@onebrain-ai/cli 2.0.13 → 2.0.14
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/onebrain +26 -23
- package/package.json +1 -1
package/dist/onebrain
CHANGED
|
@@ -10762,7 +10762,7 @@ init_dist3();
|
|
|
10762
10762
|
import { mkdir as mkdir3, readFile as readFile3, rename as rename3, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
|
|
10763
10763
|
import { homedir as homedir3 } from "node:os";
|
|
10764
10764
|
import { dirname as dirname3, join as join5 } from "node:path";
|
|
10765
|
-
var binaryVersion = "2.0.
|
|
10765
|
+
var binaryVersion = "2.0.14";
|
|
10766
10766
|
var STANDARD_FOLDERS = [
|
|
10767
10767
|
"00-inbox",
|
|
10768
10768
|
"01-projects",
|
|
@@ -11182,8 +11182,7 @@ function handleStop(token, vaultRoot, now = Math.floor(Date.now() / 1000), tmpDi
|
|
|
11182
11182
|
const maxNn = maxCheckpointNnSync(vaultRoot, date, token, logsFolder);
|
|
11183
11183
|
const nextNn = String(maxNn + 1).padStart(2, "0");
|
|
11184
11184
|
const since = maxNn === 0 ? " since start" : ` since checkpoint-${String(maxNn).padStart(2, "0")}`;
|
|
11185
|
-
|
|
11186
|
-
emitBlock(`${filename}${since}`);
|
|
11185
|
+
emitBlock(`${nextNn}${since}`);
|
|
11187
11186
|
writeState(token, { count: 0, last_ts: now, last_stop_nn: nextNn }, tmpDir);
|
|
11188
11187
|
}
|
|
11189
11188
|
function handlePostcompact(token, _vaultRoot, now = Math.floor(Date.now() / 1000), tmpDir = osTmpdir()) {
|
|
@@ -11192,7 +11191,7 @@ function handlePostcompact(token, _vaultRoot, now = Math.floor(Date.now() / 1000
|
|
|
11192
11191
|
writeState(token, { count: 0, last_ts: state.last_ts, last_stop_nn: state.last_stop_nn }, tmpDir);
|
|
11193
11192
|
return;
|
|
11194
11193
|
}
|
|
11195
|
-
emitBlock(
|
|
11194
|
+
emitBlock("auto-wrapup");
|
|
11196
11195
|
writeState(token, { count: 0, last_ts: now, last_stop_nn: state.last_stop_nn }, tmpDir);
|
|
11197
11196
|
}
|
|
11198
11197
|
function postcompactFallback(token, vaultRoot, now = Math.floor(Date.now() / 1000), tmpDir = osTmpdir()) {
|
|
@@ -11794,9 +11793,26 @@ async function resolveSessionToken(tmpDir = osTmpdir2()) {
|
|
|
11794
11793
|
if (stripped.length > 0)
|
|
11795
11794
|
return stripped;
|
|
11796
11795
|
}
|
|
11796
|
+
const today = new Date;
|
|
11797
|
+
const yyyymmdd = [
|
|
11798
|
+
today.getFullYear(),
|
|
11799
|
+
String(today.getMonth() + 1).padStart(2, "0"),
|
|
11800
|
+
String(today.getDate()).padStart(2, "0")
|
|
11801
|
+
].join("");
|
|
11802
|
+
const cacheFile = join10(tmpDir, `onebrain-day-${yyyymmdd}.token`);
|
|
11803
|
+
const cacheExists = await Bun.file(cacheFile).exists();
|
|
11804
|
+
if (cacheExists) {
|
|
11805
|
+
const cached = (await Bun.file(cacheFile).text()).trim();
|
|
11806
|
+
const n = Number(cached);
|
|
11807
|
+
if (!Number.isNaN(n) && n > 1)
|
|
11808
|
+
return cached;
|
|
11809
|
+
}
|
|
11797
11810
|
const ppid = process.ppid;
|
|
11798
|
-
if (ppid !== undefined && ppid > 1)
|
|
11799
|
-
|
|
11811
|
+
if (ppid !== undefined && ppid > 1) {
|
|
11812
|
+
const token2 = String(ppid);
|
|
11813
|
+
await Bun.write(cacheFile, token2);
|
|
11814
|
+
return token2;
|
|
11815
|
+
}
|
|
11800
11816
|
try {
|
|
11801
11817
|
const ps = Bun.spawn([
|
|
11802
11818
|
"powershell.exe",
|
|
@@ -11820,27 +11836,14 @@ async function resolveSessionToken(tmpDir = osTmpdir2()) {
|
|
|
11820
11836
|
clearTimeout(timerId);
|
|
11821
11837
|
if (race !== "timeout") {
|
|
11822
11838
|
const out = (await new Response(ps.stdout).text()).replace(/\D/g, "").trim();
|
|
11823
|
-
if (out && Number(out) > 1)
|
|
11839
|
+
if (out && Number(out) > 1) {
|
|
11840
|
+
await Bun.write(cacheFile, out);
|
|
11824
11841
|
return out;
|
|
11842
|
+
}
|
|
11825
11843
|
} else {
|
|
11826
11844
|
ps.kill();
|
|
11827
11845
|
}
|
|
11828
11846
|
} catch {}
|
|
11829
|
-
const today = new Date;
|
|
11830
|
-
const yyyymmdd = [
|
|
11831
|
-
today.getFullYear(),
|
|
11832
|
-
String(today.getMonth() + 1).padStart(2, "0"),
|
|
11833
|
-
String(today.getDate()).padStart(2, "0")
|
|
11834
|
-
].join("");
|
|
11835
|
-
const cacheFile = join10(tmpDir, `onebrain-day-${yyyymmdd}.token`);
|
|
11836
|
-
const f2 = Bun.file(cacheFile);
|
|
11837
|
-
const exists = await f2.exists();
|
|
11838
|
-
if (exists) {
|
|
11839
|
-
const cached = (await f2.text()).trim();
|
|
11840
|
-
const n = Number(cached);
|
|
11841
|
-
if (!Number.isNaN(n) && n > 1)
|
|
11842
|
-
return cached;
|
|
11843
|
-
}
|
|
11844
11847
|
const token = String(Math.floor(Math.random() * 90000) + 1e4);
|
|
11845
11848
|
await Bun.write(cacheFile, token);
|
|
11846
11849
|
return token;
|
|
@@ -12655,7 +12658,7 @@ async function updateCommand(opts = {}) {
|
|
|
12655
12658
|
}
|
|
12656
12659
|
|
|
12657
12660
|
// src/index.ts
|
|
12658
|
-
var VERSION = "2.0.
|
|
12661
|
+
var VERSION = "2.0.14";
|
|
12659
12662
|
var RELEASE_DATE = "2026-04-27";
|
|
12660
12663
|
process.stdout.setDefaultEncoding("utf8");
|
|
12661
12664
|
process.stderr.setDefaultEncoding("utf8");
|