@usebitl/cli 0.1.11 → 0.1.13
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/adapters/dist/core.mjs +1 -1
- package/dist/chunks/{chunk-V6S7JUFW.mjs → chunk-VVNOFPMO.mjs} +4 -2
- package/dist/chunks/{src-AT3GZJZ6.mjs → src-MWG3MA6Y.mjs} +29 -4
- package/dist/cli.mjs +4 -4
- package/package.json +1 -1
- package/web/assets/index-B7qa9R6O.js +9 -0
- package/web/assets/index-BRI9Dc0z.css +2 -0
- package/web/index.html +2 -2
- package/web/sw.js +1 -1
- package/web/assets/index-BqtWjy33.js +0 -9
- package/web/assets/index-P_OV048r.css +0 -2
package/adapters/dist/core.mjs
CHANGED
|
@@ -124,6 +124,7 @@ async function keysFromBase64Url(master) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// ../../shared/src/session.ts
|
|
127
|
+
var isEmptySession = (s) => s.turnCount === 0 && s.toolCount === 0;
|
|
127
128
|
var sessionKey = (source, sessionId) => `${source}:${sessionId}`;
|
|
128
129
|
var TITLE_LABELS = { locked: "\u{1F512} Can't be opened with this device's key", untitled: "(untitled)" };
|
|
129
130
|
var displayTitle = (s, labels = TITLE_LABELS) => s.aiTitle ?? s.title ?? s.project ?? (s.locked ? labels.locked : labels.untitled);
|
|
@@ -20060,7 +20061,7 @@ function removeCloudLogin(home = bitlHome()) {
|
|
|
20060
20061
|
rmSync(cloudKeyPath(home), { force: true });
|
|
20061
20062
|
}
|
|
20062
20063
|
function clientVersionHeader() {
|
|
20063
|
-
const v = "0.1.
|
|
20064
|
+
const v = "0.1.13";
|
|
20064
20065
|
return v ? { "x-bitl-client": v } : {};
|
|
20065
20066
|
}
|
|
20066
20067
|
function resolveTarget(home = bitlHome()) {
|
|
@@ -20117,7 +20118,7 @@ async function latestVersion(home, now) {
|
|
|
20117
20118
|
return latest;
|
|
20118
20119
|
}
|
|
20119
20120
|
var updateCommand = (install = process.env.BITL_INSTALL) => install === "npx" ? "npx @usebitl/cli@latest start" : "npm i -g @usebitl/cli";
|
|
20120
|
-
async function checkCliUpdate(current = "0.1.
|
|
20121
|
+
async function checkCliUpdate(current = "0.1.13", opts = {}) {
|
|
20121
20122
|
if (!current || process.env.BITL_NO_UPDATE_CHECK === "1") return void 0;
|
|
20122
20123
|
const latest = await latestVersion(opts.home ?? bitlHome(), opts.now ?? Date.now());
|
|
20123
20124
|
if (!latest || compareVersions(latest, current) <= 0) return void 0;
|
|
@@ -20150,6 +20151,7 @@ export {
|
|
|
20150
20151
|
verifyPublicKey,
|
|
20151
20152
|
wrapMasterKey,
|
|
20152
20153
|
unwrapMasterKey,
|
|
20154
|
+
isEmptySession,
|
|
20153
20155
|
sessionKey,
|
|
20154
20156
|
displayTitle,
|
|
20155
20157
|
openSession,
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
__require,
|
|
9
9
|
__toESM,
|
|
10
10
|
checkCliUpdate,
|
|
11
|
+
isEmptySession,
|
|
11
12
|
parseWireRecord,
|
|
12
13
|
sessionKey
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VVNOFPMO.mjs";
|
|
14
15
|
|
|
15
16
|
// ../../../node_modules/.pnpm/bn.js@4.12.5/node_modules/bn.js/lib/bn.js
|
|
16
17
|
var require_bn = __commonJS({
|
|
@@ -9003,6 +9004,7 @@ var PushStore = class {
|
|
|
9003
9004
|
// ../../server/src/state.ts
|
|
9004
9005
|
var STALE_AFTER_MS = 10 * 60 * 1e3;
|
|
9005
9006
|
var PERMISSION_RACE_MS = 2e3;
|
|
9007
|
+
var QUIET_EVENTS = /* @__PURE__ */ new Set(["session_start", "session_end", "notice"]);
|
|
9006
9008
|
function newSession(e) {
|
|
9007
9009
|
return {
|
|
9008
9010
|
key: sessionKey(e.source, e.sessionId),
|
|
@@ -9036,6 +9038,7 @@ function applyEvent(prev, e, c = {}) {
|
|
|
9036
9038
|
else s.enc[field] = value;
|
|
9037
9039
|
};
|
|
9038
9040
|
if (e.at > s.lastEventAt) s.lastEventAt = e.at;
|
|
9041
|
+
if (s.cleared && !late && !QUIET_EVENTS.has(e.type) && e.waitingReason !== "idle") delete s.cleared;
|
|
9039
9042
|
for (const field of ["cwd", "project", "gitBranch", "aiTitle", "model"]) if (c[field]) put(field, c[field]);
|
|
9040
9043
|
const fromSubagent = Boolean(e.agentId) && e.type !== "subagent_start" && e.type !== "subagent_end";
|
|
9041
9044
|
if (e.requestTag && e.type !== "prompt" && e.requestTag !== s.lastPromptTag) {
|
|
@@ -9325,6 +9328,19 @@ var SqlStore = class _SqlStore {
|
|
|
9325
9328
|
}
|
|
9326
9329
|
return n;
|
|
9327
9330
|
}
|
|
9331
|
+
async clearBoard(accountId) {
|
|
9332
|
+
const deleted = await this.deleteEnded(accountId);
|
|
9333
|
+
const { rows } = await this.db.query(`SELECT key FROM sessions WHERE account_id = ? AND status != 'ended' AND archived = 0`, [accountId]);
|
|
9334
|
+
let cleared = 0;
|
|
9335
|
+
for (const r of rows) {
|
|
9336
|
+
await this.update(accountId, r.key, (cur) => {
|
|
9337
|
+
if (cur.cleared || cur.archived) return null;
|
|
9338
|
+
cleared++;
|
|
9339
|
+
return { ...cur, cleared: true };
|
|
9340
|
+
});
|
|
9341
|
+
}
|
|
9342
|
+
return { deleted, cleared };
|
|
9343
|
+
}
|
|
9328
9344
|
async sweepStale(now3 = /* @__PURE__ */ new Date()) {
|
|
9329
9345
|
const { rows } = await this.db.query(`SELECT account_id, key FROM sessions WHERE status = 'running'`);
|
|
9330
9346
|
let n = 0;
|
|
@@ -12187,6 +12203,15 @@ function createApp({ store, webDist, account, push, approvals, goals, access = a
|
|
|
12187
12203
|
const keys = Array.isArray(body?.keys) ? body.keys.filter((k) => typeof k === "string").slice(0, 5e3) : void 0;
|
|
12188
12204
|
return c.json({ deleted: await store.deleteEnded(c.var.accountId, keys) });
|
|
12189
12205
|
});
|
|
12206
|
+
app.post("/api/board/clear", async (c) => {
|
|
12207
|
+
const body = await c.req.json().catch(() => ({}));
|
|
12208
|
+
const result = await store.clearBoard(c.var.accountId);
|
|
12209
|
+
let goalsDeleted = 0;
|
|
12210
|
+
if (body?.goals === true && goals) {
|
|
12211
|
+
for (const g of await goals.list(c.var.accountId, true)) if (await goals.delete(c.var.accountId, g.id)) goalsDeleted++;
|
|
12212
|
+
}
|
|
12213
|
+
return c.json({ ...result, goals: goalsDeleted });
|
|
12214
|
+
});
|
|
12190
12215
|
app.post("/api/sessions/:key/ack", async (c) => found(c, await store.acknowledge(c.var.accountId, c.req.param("key"))));
|
|
12191
12216
|
app.post(
|
|
12192
12217
|
"/api/sessions/:key/archive",
|
|
@@ -12293,8 +12318,8 @@ function mountPush(app, push) {
|
|
|
12293
12318
|
}
|
|
12294
12319
|
|
|
12295
12320
|
// ../../server/src/push.ts
|
|
12296
|
-
var import_web_push = __toESM(require_src2(), 1);
|
|
12297
12321
|
import { createHash } from "node:crypto";
|
|
12322
|
+
var import_web_push = __toESM(require_src2(), 1);
|
|
12298
12323
|
function buildApprovalPayload(a) {
|
|
12299
12324
|
const payload = { v: 1, kind: "approval", id: a.id, key: a.sessionKey, expiresAt: a.expiresAt, request: a.request };
|
|
12300
12325
|
const json2 = JSON.stringify(payload);
|
|
@@ -12355,13 +12380,13 @@ function startPushNotifier(opts) {
|
|
|
12355
12380
|
};
|
|
12356
12381
|
const notify = async (accountId, s) => {
|
|
12357
12382
|
if (!(await push.list(accountId)).length) return;
|
|
12358
|
-
const attention = (await store.listSessions(accountId)).filter((x) => ALERT.has(x.status)).length;
|
|
12383
|
+
const attention = (await store.listSessions(accountId)).filter((x) => ALERT.has(x.status) && !isEmptySession(x) && !x.cleared).length;
|
|
12359
12384
|
await sendAll(accountId, buildPayload(s, attention), topicOf(s.key));
|
|
12360
12385
|
};
|
|
12361
12386
|
const off = store.subscribe((change) => {
|
|
12362
12387
|
if (change.type !== "session") return;
|
|
12363
12388
|
const s = change.session;
|
|
12364
|
-
if (!ALERT.has(s.status) || change.prevStatus === s.status) return;
|
|
12389
|
+
if (!ALERT.has(s.status) || change.prevStatus === s.status || isEmptySession(s) || s.cleared) return;
|
|
12365
12390
|
const id = `${change.accountId}
|
|
12366
12391
|
${s.key}`;
|
|
12367
12392
|
const t = Date.now();
|
package/dist/cli.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
unwrapMasterKey,
|
|
22
22
|
verifyPublicKey,
|
|
23
23
|
wrapMasterKey
|
|
24
|
-
} from "./chunks/chunk-
|
|
24
|
+
} from "./chunks/chunk-VVNOFPMO.mjs";
|
|
25
25
|
|
|
26
26
|
// ../src/index.ts
|
|
27
27
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -453,7 +453,7 @@ async function logout() {
|
|
|
453
453
|
}
|
|
454
454
|
|
|
455
455
|
// ../src/update.ts
|
|
456
|
-
async function updateNotice(current = "0.1.
|
|
456
|
+
async function updateNotice(current = "0.1.13") {
|
|
457
457
|
const u = await checkCliUpdate(current);
|
|
458
458
|
return u && `${t("update.available", { ...u })}
|
|
459
459
|
${t("update.changelog")}`;
|
|
@@ -609,7 +609,7 @@ async function main(argv) {
|
|
|
609
609
|
if (String(typeof warning === "string" ? warning : warning.message).startsWith("SQLite is an experimental feature")) return;
|
|
610
610
|
emitWarning(warning, ...rest2);
|
|
611
611
|
});
|
|
612
|
-
const { startServer } = await import("./chunks/src-
|
|
612
|
+
const { startServer } = await import("./chunks/src-MWG3MA6Y.mjs");
|
|
613
613
|
await startServer();
|
|
614
614
|
console.log(t("start.pair", { url: localPairUrl() }));
|
|
615
615
|
return;
|
|
@@ -631,7 +631,7 @@ async function main(argv) {
|
|
|
631
631
|
case "--version":
|
|
632
632
|
case "-v":
|
|
633
633
|
case "version":
|
|
634
|
-
console.log("0.1.
|
|
634
|
+
console.log("0.1.13");
|
|
635
635
|
return;
|
|
636
636
|
case "remote":
|
|
637
637
|
case "away":
|
package/package.json
CHANGED