@bubblebrain-ai/bubble 0.0.22 → 0.0.24
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/README.md +197 -34
- package/dist/agent/internal-reminder-sanitizer.js +29 -9
- package/dist/goal/command.d.ts +20 -0
- package/dist/goal/command.js +71 -0
- package/dist/goal/engine.d.ts +33 -0
- package/dist/goal/engine.js +65 -0
- package/dist/goal/format.d.ts +18 -0
- package/dist/goal/format.js +82 -0
- package/dist/goal/prompts.d.ts +13 -0
- package/dist/goal/prompts.js +84 -0
- package/dist/goal/store.d.ts +61 -0
- package/dist/goal/store.js +161 -0
- package/dist/goal/tools.d.ts +10 -0
- package/dist/goal/tools.js +70 -0
- package/dist/main.js +10 -2
- package/dist/model-catalog.js +17 -0
- package/dist/provider-transform.js +31 -0
- package/dist/session-types.d.ts +3 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +2 -0
- package/dist/tui/run.d.ts +8 -0
- package/dist/tui/run.js +318 -29
- package/dist/tui/trace-groups.js +41 -5
- package/dist/tui-ink/run.d.ts +2 -0
- package/dist/update/index.d.ts +18 -4
- package/dist/update/index.js +41 -19
- package/package.json +1 -1
package/dist/update/index.js
CHANGED
|
@@ -16,7 +16,9 @@ import { getBubbleHome } from "../bubble-home.js";
|
|
|
16
16
|
const require = createRequire(import.meta.url);
|
|
17
17
|
export const PACKAGE_NAME = "@bubblebrain-ai/bubble";
|
|
18
18
|
const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
19
|
-
|
|
19
|
+
// Throttle for the startup registry check. Short on purpose: with frequent
|
|
20
|
+
// releases, a long TTL means users only learn about a new version a day late.
|
|
21
|
+
const REFRESH_THROTTLE_MS = 30 * 60 * 1000;
|
|
20
22
|
export function getCurrentVersion() {
|
|
21
23
|
try {
|
|
22
24
|
const pkg = require("../../package.json");
|
|
@@ -209,32 +211,52 @@ async function writeCache(cache) {
|
|
|
209
211
|
// best-effort; never fail startup over a cache write
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (latest) {
|
|
215
|
-
await writeCache({ lastCheck: now, latest });
|
|
216
|
-
}
|
|
214
|
+
function formatUpdateNotice(current, latest) {
|
|
215
|
+
return `Update available: v${current} → v${latest} · run \`bubble update\``;
|
|
217
216
|
}
|
|
218
217
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
218
|
+
* Startup "update available" check. The immediate `notice` comes from the
|
|
219
|
+
* local cache file (fast, no network on the hot path). A registry refresh
|
|
220
|
+
* always runs in the background (throttled to once per 30 minutes) so a
|
|
221
|
+
* release published since the last launch surfaces in the *current* session
|
|
222
|
+
* via `refreshed`, instead of only after the cache TTL plus another restart.
|
|
223
|
+
* Never throws.
|
|
223
224
|
*/
|
|
224
|
-
export async function
|
|
225
|
+
export async function startStartupUpdateCheck() {
|
|
225
226
|
try {
|
|
226
227
|
const current = getCurrentVersion();
|
|
227
228
|
const now = Date.now();
|
|
228
229
|
const cache = await readCache();
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
230
|
+
const notice = cache && compareVersions(cache.latest, current) > 0
|
|
231
|
+
? formatUpdateNotice(current, cache.latest)
|
|
232
|
+
: null;
|
|
233
|
+
const refreshed = (async () => {
|
|
234
|
+
try {
|
|
235
|
+
if (cache && now - cache.lastCheck < REFRESH_THROTTLE_MS)
|
|
236
|
+
return null;
|
|
237
|
+
const latest = await fetchLatestVersion(4000);
|
|
238
|
+
if (!latest)
|
|
239
|
+
return null;
|
|
240
|
+
await writeCache({ lastCheck: now, latest });
|
|
241
|
+
if (compareVersions(latest, current) <= 0)
|
|
242
|
+
return null;
|
|
243
|
+
// The cache already surfaced this version in `notice` — stay quiet.
|
|
244
|
+
if (notice && cache && compareVersions(latest, cache.latest) <= 0)
|
|
245
|
+
return null;
|
|
246
|
+
return formatUpdateNotice(current, latest);
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
})();
|
|
252
|
+
return { notice, refreshed };
|
|
236
253
|
}
|
|
237
254
|
catch {
|
|
238
|
-
return null;
|
|
255
|
+
return { notice: null, refreshed: Promise.resolve(null) };
|
|
239
256
|
}
|
|
240
257
|
}
|
|
258
|
+
/** Cache-only variant of {@link startStartupUpdateCheck} (still refreshes in the background). */
|
|
259
|
+
export async function getStartupUpdateNotice() {
|
|
260
|
+
const check = await startStartupUpdateCheck();
|
|
261
|
+
return check.notice;
|
|
262
|
+
}
|