@owloops/browserbird 1.8.2 → 1.8.4
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/index.mjs +30 -23
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -193,8 +193,8 @@ function unknownSubcommand(subcommand, command, validCommands) {
|
|
|
193
193
|
/** @fileoverview ASCII banner displayed on daemon startup and in help text. */
|
|
194
194
|
const pkg = createRequire(import.meta.url)("../package.json");
|
|
195
195
|
const buildInfo = [];
|
|
196
|
-
buildInfo.push(`commit: ${"
|
|
197
|
-
buildInfo.push(`built: 2026-03-22T17:
|
|
196
|
+
buildInfo.push(`commit: ${"0c9ac36840820c423556f319162084f0279de38d".substring(0, 7)}`);
|
|
197
|
+
buildInfo.push(`built: 2026-03-22T17:39:52+04:00`);
|
|
198
198
|
const buildString = buildInfo.length > 0 ? ` (${buildInfo.join(", ")})` : "";
|
|
199
199
|
const VERSION = `browserbird ${pkg.version}${buildString}`;
|
|
200
200
|
const BIRD = [
|
|
@@ -1010,6 +1010,7 @@ function deleteCronJob(jobUid) {
|
|
|
1010
1010
|
try {
|
|
1011
1011
|
d.prepare("DELETE FROM cron_runs WHERE job_uid = ?").run(jobUid);
|
|
1012
1012
|
d.prepare("UPDATE jobs SET cron_job_uid = NULL WHERE cron_job_uid = ?").run(jobUid);
|
|
1013
|
+
d.prepare("DELETE FROM key_bindings WHERE target_type = 'bird' AND target_id = ?").run(jobUid);
|
|
1013
1014
|
const result = d.prepare("DELETE FROM cron_jobs WHERE uid = ?").run(jobUid);
|
|
1014
1015
|
d.exec("COMMIT");
|
|
1015
1016
|
return Number(result.changes) > 0;
|
|
@@ -1413,6 +1414,25 @@ function ensureVaultKey(envPath) {
|
|
|
1413
1414
|
|
|
1414
1415
|
//#endregion
|
|
1415
1416
|
//#region src/db/keys.ts
|
|
1417
|
+
const KEY_NAME_RE = /^[A-Z][A-Z0-9_]*$/;
|
|
1418
|
+
const RESERVED_KEY_NAMES = new Set([
|
|
1419
|
+
"ANTHROPIC_API_KEY",
|
|
1420
|
+
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
1421
|
+
"CLAUDE_CONFIG_DIR",
|
|
1422
|
+
"CLAUDECODE",
|
|
1423
|
+
"CLAUDE_CODE_ENTRYPOINT",
|
|
1424
|
+
"SLACK_BOT_TOKEN",
|
|
1425
|
+
"SLACK_APP_TOKEN",
|
|
1426
|
+
"BROWSERBIRD_VAULT_KEY",
|
|
1427
|
+
"BROWSERBIRD_CONFIG",
|
|
1428
|
+
"BROWSERBIRD_DB"
|
|
1429
|
+
]);
|
|
1430
|
+
function validateKeyName(raw) {
|
|
1431
|
+
const name = raw.trim().toUpperCase();
|
|
1432
|
+
if (!KEY_NAME_RE.test(name)) return { error: "Name must match [A-Z][A-Z0-9_]* (e.g. GITHUB_TOKEN)" };
|
|
1433
|
+
if (RESERVED_KEY_NAMES.has(name)) return { error: `"${name}" is reserved (managed via config)` };
|
|
1434
|
+
return { name };
|
|
1435
|
+
}
|
|
1416
1436
|
function decryptValue(raw) {
|
|
1417
1437
|
return isEncrypted(raw) ? decrypt(raw, getVaultKey()) : raw;
|
|
1418
1438
|
}
|
|
@@ -2119,25 +2139,6 @@ function maskSecret(value) {
|
|
|
2119
2139
|
hint: prefix ? `${prefix}...${tail}` : `...${tail}`
|
|
2120
2140
|
};
|
|
2121
2141
|
}
|
|
2122
|
-
const KEY_NAME_RE = /^[A-Z][A-Z0-9_]*$/;
|
|
2123
|
-
const RESERVED_KEY_NAMES = new Set([
|
|
2124
|
-
"ANTHROPIC_API_KEY",
|
|
2125
|
-
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
2126
|
-
"CLAUDE_CONFIG_DIR",
|
|
2127
|
-
"CLAUDECODE",
|
|
2128
|
-
"CLAUDE_CODE_ENTRYPOINT",
|
|
2129
|
-
"SLACK_BOT_TOKEN",
|
|
2130
|
-
"SLACK_APP_TOKEN",
|
|
2131
|
-
"BROWSERBIRD_VAULT_KEY",
|
|
2132
|
-
"BROWSERBIRD_CONFIG",
|
|
2133
|
-
"BROWSERBIRD_DB"
|
|
2134
|
-
]);
|
|
2135
|
-
function validateKeyName(raw) {
|
|
2136
|
-
const name = raw.trim().toUpperCase();
|
|
2137
|
-
if (!KEY_NAME_RE.test(name)) return { error: "Name must match [A-Z][A-Z0-9_]* (e.g. GITHUB_TOKEN)" };
|
|
2138
|
-
if (RESERVED_KEY_NAMES.has(name)) return { error: `"${name}" is reserved (managed via config)` };
|
|
2139
|
-
return { name };
|
|
2140
|
-
}
|
|
2141
2142
|
const HH_MM_RE = /^\d{2}:\d{2}$/;
|
|
2142
2143
|
const ALLOWED_TOP_LEVEL_KEYS = new Set([
|
|
2143
2144
|
"timezone",
|
|
@@ -4492,7 +4493,7 @@ function createHandler(client, getConfig, signal, getTeamId, getChannelNameToId)
|
|
|
4492
4493
|
let toolSuccesses = 0;
|
|
4493
4494
|
function isStreamExpired(err) {
|
|
4494
4495
|
const msg = err instanceof Error ? err.message : String(err);
|
|
4495
|
-
return msg.includes("not_in_streaming_state") || msg.includes("streaming");
|
|
4496
|
+
return msg.includes("not_in_streaming_state") || msg.includes("streaming") || msg.includes("msg_too_long");
|
|
4496
4497
|
}
|
|
4497
4498
|
async function safeAppend(content) {
|
|
4498
4499
|
if (streamDead) {
|
|
@@ -6166,6 +6167,12 @@ async function handleKeys(argv) {
|
|
|
6166
6167
|
process.exitCode = 1;
|
|
6167
6168
|
return;
|
|
6168
6169
|
}
|
|
6170
|
+
const validated = validateKeyName(name);
|
|
6171
|
+
if ("error" in validated) {
|
|
6172
|
+
logger.error(validated.error);
|
|
6173
|
+
process.exitCode = 1;
|
|
6174
|
+
return;
|
|
6175
|
+
}
|
|
6169
6176
|
let secret = values.value;
|
|
6170
6177
|
if (!secret) {
|
|
6171
6178
|
secret = await promptSecret(`value for ${name.toUpperCase()}: `);
|
|
@@ -6176,7 +6183,7 @@ async function handleKeys(argv) {
|
|
|
6176
6183
|
}
|
|
6177
6184
|
}
|
|
6178
6185
|
try {
|
|
6179
|
-
const key = createKey(name
|
|
6186
|
+
const key = createKey(validated.name, secret, values.description?.trim());
|
|
6180
6187
|
logger.success(`key ${key.name} created`);
|
|
6181
6188
|
process.stderr.write(c("dim", ` hint: run 'browserbird keys bind ${key.name} channel *' to bind it`) + "\n");
|
|
6182
6189
|
} catch (err) {
|