vibeostheog 0.24.26 → 0.24.27
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/vibeOS.js +93 -56
- package/package.json +1 -1
package/dist/vibeOS.js
CHANGED
|
@@ -3802,26 +3802,10 @@ function loadBlackboxState() {
|
|
|
3802
3802
|
for (const [sid, session] of Object.entries(raw.sessions)) {
|
|
3803
3803
|
if (!session || typeof session !== "object")
|
|
3804
3804
|
continue;
|
|
3805
|
-
const next =
|
|
3806
|
-
const createdAtRaw = typeof next.createdAt === "string" ? next.createdAt : "";
|
|
3807
|
-
const updatedAtRaw = typeof next.updatedAt === "string" ? next.updatedAt : "";
|
|
3808
|
-
const startedRaw = typeof next.started === "string" ? next.started : "";
|
|
3809
|
-
const sessionStartedRaw = typeof next.session_started_at === "string" ? next.session_started_at : "";
|
|
3810
|
-
const anchorRaw = [createdAtRaw, updatedAtRaw, startedRaw, sessionStartedRaw].find((v) => v && !Number.isNaN(Date.parse(v)));
|
|
3811
|
-
const anchorMs = anchorRaw ? Date.parse(anchorRaw) : NaN;
|
|
3812
|
-
if (!Number.isFinite(Date.parse(createdAtRaw))) {
|
|
3813
|
-
next.createdAt = Number.isFinite(anchorMs) ? new Date(anchorMs).toISOString() : new Date(now).toISOString();
|
|
3814
|
-
changed = true;
|
|
3815
|
-
}
|
|
3816
|
-
if (!Number.isFinite(Date.parse(updatedAtRaw))) {
|
|
3817
|
-
next.updatedAt = next.createdAt || new Date(now).toISOString();
|
|
3818
|
-
changed = true;
|
|
3819
|
-
}
|
|
3820
|
-
if (typeof next.sessionId !== "string" || !next.sessionId.trim()) {
|
|
3821
|
-
next.sessionId = String(sid || "");
|
|
3822
|
-
changed = true;
|
|
3823
|
-
}
|
|
3805
|
+
const { record: next, changed: recordChanged } = normalizeBlackboxRecord(session, sid, now);
|
|
3824
3806
|
raw.sessions[sid] = next;
|
|
3807
|
+
if (recordChanged)
|
|
3808
|
+
changed = true;
|
|
3825
3809
|
}
|
|
3826
3810
|
if (changed) {
|
|
3827
3811
|
try {
|
|
@@ -3844,22 +3828,7 @@ function saveBlackboxState(state) {
|
|
|
3844
3828
|
for (const [sid, session] of Object.entries(next.sessions)) {
|
|
3845
3829
|
if (!session || typeof session !== "object")
|
|
3846
3830
|
continue;
|
|
3847
|
-
|
|
3848
|
-
const createdAtRaw = typeof record.createdAt === "string" ? record.createdAt : "";
|
|
3849
|
-
const updatedAtRaw = typeof record.updatedAt === "string" ? record.updatedAt : "";
|
|
3850
|
-
const startedRaw = typeof record.started === "string" ? record.started : "";
|
|
3851
|
-
const sessionStartedRaw = typeof record.session_started_at === "string" ? record.session_started_at : "";
|
|
3852
|
-
const anchorRaw = [createdAtRaw, updatedAtRaw, startedRaw, sessionStartedRaw].find((v) => v && !Number.isNaN(Date.parse(v)));
|
|
3853
|
-
const anchorMs = anchorRaw ? Date.parse(anchorRaw) : NaN;
|
|
3854
|
-
if (!Number.isFinite(Date.parse(createdAtRaw))) {
|
|
3855
|
-
record.createdAt = Number.isFinite(anchorMs) ? new Date(anchorMs).toISOString() : new Date(now).toISOString();
|
|
3856
|
-
}
|
|
3857
|
-
if (!Number.isFinite(Date.parse(updatedAtRaw))) {
|
|
3858
|
-
record.updatedAt = record.createdAt || new Date(now).toISOString();
|
|
3859
|
-
}
|
|
3860
|
-
if (typeof record.sessionId !== "string" || !record.sessionId.trim()) {
|
|
3861
|
-
record.sessionId = String(sid || "");
|
|
3862
|
-
}
|
|
3831
|
+
next.sessions[sid] = normalizeBlackboxRecord(session, sid, now).record;
|
|
3863
3832
|
}
|
|
3864
3833
|
mkdirSync3(dirname4(blackboxFile), { recursive: true });
|
|
3865
3834
|
const tmp = blackboxFile + ".tmp";
|
|
@@ -3869,6 +3838,81 @@ function saveBlackboxState(state) {
|
|
|
3869
3838
|
console.error(`[vibeOS] saveBlackboxState failed: ${err.message}`);
|
|
3870
3839
|
}
|
|
3871
3840
|
}
|
|
3841
|
+
function normalizeBlackboxRecord(record, sid, now) {
|
|
3842
|
+
const next = { ...record || {} };
|
|
3843
|
+
let changed = false;
|
|
3844
|
+
const createdAtRaw = typeof next.createdAt === "string" ? next.createdAt : "";
|
|
3845
|
+
const updatedAtRaw = typeof next.updatedAt === "string" ? next.updatedAt : "";
|
|
3846
|
+
const startedRaw = typeof next.started === "string" ? next.started : "";
|
|
3847
|
+
const sessionStartedRaw = typeof next.session_started_at === "string" ? next.session_started_at : "";
|
|
3848
|
+
const anchorRaw = [createdAtRaw, updatedAtRaw, startedRaw, sessionStartedRaw].find((v) => v && !Number.isNaN(Date.parse(v)));
|
|
3849
|
+
const anchorMs = anchorRaw ? Date.parse(anchorRaw) : NaN;
|
|
3850
|
+
if (!Number.isFinite(Date.parse(createdAtRaw))) {
|
|
3851
|
+
next.createdAt = Number.isFinite(anchorMs) ? new Date(anchorMs).toISOString() : new Date(now).toISOString();
|
|
3852
|
+
changed = true;
|
|
3853
|
+
}
|
|
3854
|
+
if (!Number.isFinite(Date.parse(updatedAtRaw))) {
|
|
3855
|
+
next.updatedAt = next.createdAt || new Date(now).toISOString();
|
|
3856
|
+
changed = true;
|
|
3857
|
+
}
|
|
3858
|
+
if (typeof next.sessionId !== "string" || !next.sessionId.trim()) {
|
|
3859
|
+
next.sessionId = String(sid || "");
|
|
3860
|
+
changed = true;
|
|
3861
|
+
}
|
|
3862
|
+
if (typeof next.project_fingerprint !== "string" || !next.project_fingerprint.trim()) {
|
|
3863
|
+
if (typeof currentProjectFingerprint === "string" && currentProjectFingerprint.trim()) {
|
|
3864
|
+
next.project_fingerprint = currentProjectFingerprint.trim();
|
|
3865
|
+
changed = true;
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
if (typeof next.project_name !== "string" || !next.project_name.trim()) {
|
|
3869
|
+
if (typeof currentProjectName === "string" && currentProjectName.trim()) {
|
|
3870
|
+
next.project_name = currentProjectName.trim();
|
|
3871
|
+
changed = true;
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
if (typeof next.regime !== "string" || !next.regime.trim()) {
|
|
3875
|
+
next.regime = typeof next.sub_regime === "string" && next.sub_regime.trim() ? next.sub_regime.trim() : "INIT";
|
|
3876
|
+
changed = true;
|
|
3877
|
+
}
|
|
3878
|
+
if (typeof next.sub_regime !== "string" || !next.sub_regime.trim()) {
|
|
3879
|
+
next.sub_regime = "INIT";
|
|
3880
|
+
changed = true;
|
|
3881
|
+
}
|
|
3882
|
+
if (typeof next.resolution !== "string" || !next.resolution.trim()) {
|
|
3883
|
+
next.resolution = "unresolved";
|
|
3884
|
+
changed = true;
|
|
3885
|
+
}
|
|
3886
|
+
if (!Number.isFinite(Number(next.momentum))) {
|
|
3887
|
+
next.momentum = 0;
|
|
3888
|
+
changed = true;
|
|
3889
|
+
}
|
|
3890
|
+
if (!Number.isFinite(Number(next.turn_counter))) {
|
|
3891
|
+
next.turn_counter = 0;
|
|
3892
|
+
changed = true;
|
|
3893
|
+
}
|
|
3894
|
+
if (!Number.isFinite(Number(next.loopCount))) {
|
|
3895
|
+
next.loopCount = 0;
|
|
3896
|
+
changed = true;
|
|
3897
|
+
}
|
|
3898
|
+
if (!Number.isFinite(Number(next.loop_consecutive))) {
|
|
3899
|
+
next.loop_consecutive = Number(next.loopCount || 0);
|
|
3900
|
+
changed = true;
|
|
3901
|
+
}
|
|
3902
|
+
if (!Array.isArray(next.history)) {
|
|
3903
|
+
next.history = [];
|
|
3904
|
+
changed = true;
|
|
3905
|
+
}
|
|
3906
|
+
if (!Array.isArray(next.pivotHistory)) {
|
|
3907
|
+
next.pivotHistory = [];
|
|
3908
|
+
changed = true;
|
|
3909
|
+
}
|
|
3910
|
+
if (!Array.isArray(next.outcomeHistory)) {
|
|
3911
|
+
next.outcomeHistory = [];
|
|
3912
|
+
changed = true;
|
|
3913
|
+
}
|
|
3914
|
+
return { record: next, changed };
|
|
3915
|
+
}
|
|
3872
3916
|
function getSessionRoot() {
|
|
3873
3917
|
return join4(SCRATCHPAD_SESSIONS_DIR, _OC_SID);
|
|
3874
3918
|
}
|
|
@@ -11761,8 +11805,9 @@ async function _appendFooter(input, output, directory3) {
|
|
|
11761
11805
|
}
|
|
11762
11806
|
}
|
|
11763
11807
|
const selNowFooter = loadSelection3();
|
|
11808
|
+
const normalizedIntent = classifyTurnSimple2(latestUserIntent || "");
|
|
11809
|
+
const currentSubRegime = _latestBlackboxState?.sub_regime || normalizedIntent;
|
|
11764
11810
|
const bbMode = resolveEnforcementMode();
|
|
11765
|
-
const optModeFooter = loadOptimizationMode();
|
|
11766
11811
|
const enfTags = buildEnforcementTags({
|
|
11767
11812
|
delegationEnforce: selNowFooter.delegation_enforce,
|
|
11768
11813
|
flowEnforce: selNowFooter.flow_enforce,
|
|
@@ -11770,11 +11815,6 @@ async function _appendFooter(input, output, directory3) {
|
|
|
11770
11815
|
bbMode,
|
|
11771
11816
|
modelLocked: _modelLocked
|
|
11772
11817
|
});
|
|
11773
|
-
const resolvedMode = peekBudgetFirstMode({
|
|
11774
|
-
requestedMode: optModeFooter,
|
|
11775
|
-
subRegime: _latestBlackboxState?.sub_regime || classifyTurnSimple2(latestUserIntent || ""),
|
|
11776
|
-
stress: _footerStress
|
|
11777
|
-
}).mode;
|
|
11778
11818
|
const stripped = text.replace(/\u2014 [^\u2014]+ \u2014\s*/g, "").trimEnd();
|
|
11779
11819
|
if (stripped !== text)
|
|
11780
11820
|
return;
|
|
@@ -11782,11 +11822,9 @@ async function _appendFooter(input, output, directory3) {
|
|
|
11782
11822
|
return;
|
|
11783
11823
|
const ltTotal = ltTasks + ltCache;
|
|
11784
11824
|
const activeSlot = selNowFooter.active_slot || "brain";
|
|
11785
|
-
const optMode = (resolvedMode || "budget").toLowerCase();
|
|
11786
11825
|
const flashIcon = isApiConnected2() ? " \u26A1" : "";
|
|
11787
|
-
const displayMode =
|
|
11826
|
+
const displayMode = autoSelectMode2(currentSubRegime, _footerStress);
|
|
11788
11827
|
const vibeBrand = resolveBrand(displayMode, activeSlot);
|
|
11789
|
-
const currentSubRegime = _latestBlackboxState?.sub_regime || classifyTurnSimple2(latestUserIntent || "");
|
|
11790
11828
|
const vibeLine = buildFooterLine({
|
|
11791
11829
|
activeSlot,
|
|
11792
11830
|
providerLabel: execution.provider_label,
|
|
@@ -13865,14 +13903,6 @@ var onToolExecuteAfter = async (input, output) => {
|
|
|
13865
13903
|
const { ltTasks, ltCache, ltCost, sesTrend } = readLifetimeSavings();
|
|
13866
13904
|
const ltTotal = ltTasks + ltCache;
|
|
13867
13905
|
const selNow = loadSelection();
|
|
13868
|
-
const bbMode = resolveEnforcementMode();
|
|
13869
|
-
const enfTags = buildEnforcementTags({
|
|
13870
|
-
delegationEnforce: selNow.delegation_enforce,
|
|
13871
|
-
flowEnforce: selNow.flow_enforce,
|
|
13872
|
-
tddEnforce: selNow.tdd_enforce,
|
|
13873
|
-
bbMode,
|
|
13874
|
-
modelLocked: _modelLocked
|
|
13875
|
-
});
|
|
13876
13906
|
let liveModel = "";
|
|
13877
13907
|
try {
|
|
13878
13908
|
const cfg = await client.config.get("model");
|
|
@@ -13891,12 +13921,19 @@ var onToolExecuteAfter = async (input, output) => {
|
|
|
13891
13921
|
}
|
|
13892
13922
|
const execution = resolveExecutionIdentity(input?.args?.model || resolvedModel || "", projectDirectory);
|
|
13893
13923
|
const currentSid = _OC_SID;
|
|
13894
|
-
const
|
|
13924
|
+
const currentSubRegime = loadBlackboxState()?.sessions?.[currentSid]?.sub_regime || classifyTurnSimple2(latestUserIntent || "");
|
|
13925
|
+
const bbMode = resolveEnforcementMode();
|
|
13926
|
+
const enfTags = buildEnforcementTags({
|
|
13927
|
+
delegationEnforce: selNow.delegation_enforce,
|
|
13928
|
+
flowEnforce: selNow.flow_enforce,
|
|
13929
|
+
tddEnforce: selNow.tdd_enforce,
|
|
13930
|
+
bbMode,
|
|
13931
|
+
modelLocked: _modelLocked
|
|
13932
|
+
});
|
|
13895
13933
|
const activeSlot = selNow.active_slot || (execution.quality === "brain" ? "brain" : execution.quality === "medium" ? "medium" : "cheap");
|
|
13896
|
-
const
|
|
13934
|
+
const displayMode = autoSelectMode2(currentSubRegime, latestUserIntent ? scoreStress(latestUserIntent) : 0);
|
|
13935
|
+
const vibeBrand = resolveBrand(displayMode, activeSlot);
|
|
13897
13936
|
const sessionSlot = loadSessionSlot(currentSid);
|
|
13898
|
-
const displayMode = selNow.optimization_mode || optModeFooter || "auto";
|
|
13899
|
-
const currentSubRegime = loadBlackboxState()?.sessions?.[currentSid]?.sub_regime || classifyTurnSimple2(latestUserIntent || "");
|
|
13900
13937
|
const flashIcon = isApiConnected2() ? " \u26A1" : "";
|
|
13901
13938
|
_footerText = buildFooterLine({
|
|
13902
13939
|
activeSlot,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibeostheog",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.27",
|
|
4
4
|
"description": "Cost-aware delegation enforcer for OpenCode. Tracks model usage, routes Task subagents to cheaper tiers, surfaces cumulative savings in chat. Includes research audit, reporting framework, project memory, progressive scratchpad decadence, and trinity CLI for brain/medium/cheap slot switching.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"release": "node scripts/release.mjs",
|