vibeostheog 0.25.3 → 0.25.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.25.4
2
+ - fix: isApiConnected() self-heals after cooldown without remoteCall()
3
+ - fix: API reconnection cooldown never reset runtime-state, causing permanent offline status
4
+ Merge pull request #183 from DrunkkToys/fix/api-reconnection-cooldown
5
+
6
+
1
7
  ## 0.25.3
2
8
  - fix: model lock now blocks auto-reconcile and cascade slot rewrites
3
9
  - fix: reduce pattern learner noise with self-pair exclusion, sessions threshold, quality gate (#171)
@@ -1 +1 @@
1
- window.__VIBEOS_DASHBOARD_BASE__ = "http://127.0.0.1:52508";
1
+ window.__VIBEOS_DASHBOARD_BASE__ = "http://127.0.0.1:59486";
package/dist/vibeOS.js CHANGED
@@ -5211,11 +5211,35 @@ function setApiBootstrapToken(newToken) {
5211
5211
  }
5212
5212
  }
5213
5213
  var _apiClient = null;
5214
+ var _startupProbeDone = false;
5214
5215
  var _apiFallbackMode = false;
5215
5216
  var _apiFallbackSince = null;
5216
5217
  var _bootstrapExchangeInFlight = null;
5217
5218
  var _bootstrapExchangeFailedAt = 0;
5218
5219
  var _backendVersion = "";
5220
+ var FALLBACK_COOLDOWN_MS = 6e4;
5221
+ function tryResetFallbackCooldown() {
5222
+ if (!_apiFallbackMode || !_apiFallbackSince)
5223
+ return false;
5224
+ const elapsed = Date.now() - new Date(_apiFallbackSince).getTime();
5225
+ if (elapsed > FALLBACK_COOLDOWN_MS) {
5226
+ _apiFallbackMode = false;
5227
+ _apiFallbackSince = null;
5228
+ markApiConnected();
5229
+ return true;
5230
+ }
5231
+ return false;
5232
+ }
5233
+ function confirmReconnection() {
5234
+ _apiFallbackMode = false;
5235
+ _apiFallbackSince = null;
5236
+ markApiConnected();
5237
+ console.warn("[vibeOS] API reconnected \u2014 health probe passed");
5238
+ }
5239
+ function denyReconnection(detail) {
5240
+ _apiFallbackSince = (/* @__PURE__ */ new Date()).toISOString();
5241
+ console.warn(`[vibeOS] API health probe failed during reconnect: ${detail} \u2014 staying in fallback`);
5242
+ }
5219
5243
  function recordBackendVersion(payload) {
5220
5244
  if (!payload || typeof payload !== "object")
5221
5245
  return;
@@ -5329,12 +5353,30 @@ function isApiFallback2() {
5329
5353
  return _apiFallbackMode || !VIBEOS_API_ENABLED;
5330
5354
  }
5331
5355
  function isApiConnected2() {
5356
+ tryResetFallbackCooldown();
5332
5357
  return isApiConnected() && VIBEOS_API_ENABLED && !_apiFallbackMode;
5333
5358
  }
5334
5359
  function getBackendVersion() {
5335
5360
  return _backendVersion;
5336
5361
  }
5362
+ function getApiFallbackSince() {
5363
+ return _apiFallbackSince;
5364
+ }
5337
5365
  async function remoteCall(method, args, fallbackFn) {
5366
+ if (!_startupProbeDone && !_apiFallbackMode) {
5367
+ _startupProbeDone = true;
5368
+ try {
5369
+ syncApiTokenFromDisk();
5370
+ if (VIBEOS_API_ENABLED) {
5371
+ const probeClient = getApiClient2();
5372
+ if (probeClient) {
5373
+ await probeClient.health();
5374
+ confirmReconnection();
5375
+ }
5376
+ }
5377
+ } catch {
5378
+ }
5379
+ }
5338
5380
  syncApiTokenFromDisk();
5339
5381
  if (!VIBEOS_API_TOKEN && VIBEOS_API_BOOTSTRAP_TOKEN) {
5340
5382
  await ensureBootstrapExchange();
@@ -5342,11 +5384,27 @@ async function remoteCall(method, args, fallbackFn) {
5342
5384
  }
5343
5385
  if (_apiFallbackMode && _apiFallbackSince) {
5344
5386
  const elapsed = Date.now() - new Date(_apiFallbackSince).getTime();
5345
- if (elapsed > 6e4) {
5346
- _apiFallbackMode = false;
5347
- _apiFallbackSince = null;
5348
- markApiConnected();
5349
- console.warn("[vibeOS] API fallback cooldown expired \u2014 retrying API");
5387
+ if (elapsed > FALLBACK_COOLDOWN_MS) {
5388
+ try {
5389
+ const probeClient = getApiClient2();
5390
+ if (probeClient) {
5391
+ await probeClient.health();
5392
+ confirmReconnection();
5393
+ } else {
5394
+ denyReconnection("no client");
5395
+ if (fallbackFn)
5396
+ return fallbackFn();
5397
+ return null;
5398
+ }
5399
+ } catch (probeErr) {
5400
+ const probeStatus = probeErr?.statusCode || probeErr?.status || 0;
5401
+ const probeBody = probeErr?.response?.body || probeErr?.body || "";
5402
+ const probePreview = typeof probeBody === "string" ? probeBody.substring(0, 80) : String(probeBody).substring(0, 80);
5403
+ denyReconnection(probeStatus ? `status=${probeStatus} body=${probePreview}` : `message=${probeErr?.message || probeErr}`);
5404
+ if (fallbackFn)
5405
+ return fallbackFn();
5406
+ return null;
5407
+ }
5350
5408
  }
5351
5409
  }
5352
5410
  if (!VIBEOS_API_ENABLED || _apiFallbackMode) {
@@ -15090,7 +15148,6 @@ function ensureDeferredBootstrap() {
15090
15148
  } catch {
15091
15149
  }
15092
15150
  }
15093
- var _apiFallbackSince2 = null;
15094
15151
  var activeJob2 = null;
15095
15152
  var fp = "";
15096
15153
  var _mcpServerRuntime = null;
@@ -15390,7 +15447,7 @@ async function ensureMcpServerRunning() {
15390
15447
  backendHealthUrl: `${VIBEOS_API_URL}/health`,
15391
15448
  backendVersion: getBackendVersion(),
15392
15449
  apiFallbackMode: isApiFallback2(),
15393
- apiFallbackSince: _apiFallbackSince2,
15450
+ apiFallbackSince: getApiFallbackSince(),
15394
15451
  modelLocked: _modelLocked,
15395
15452
  lockedSlot: _lockedSlot,
15396
15453
  lockedModel: _lockedModel
@@ -15777,7 +15834,7 @@ async function DelegationEnforcer({ client: client2, directory: directory3 } = {
15777
15834
  saveBlackboxState,
15778
15835
  isApiFallback: () => isApiFallback2(),
15779
15836
  get _apiFallbackSince() {
15780
- return _apiFallbackSince2;
15837
+ return getApiFallbackSince();
15781
15838
  },
15782
15839
  reportsIndex: reportsIndexStable,
15783
15840
  saveReportsIndex: saveReportsIndexStable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibeostheog",
3
- "version": "0.25.3",
3
+ "version": "0.25.5",
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",