@seele00/seele 0.1.60 → 0.1.61
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/codex/package.json +1 -1
- package/package.json +1 -1
- package/server/dist/auth/users.js +90 -6
- package/server/dist/server.js +36 -27
- package/web/dist/assets/{abnfDiagram-VRR7QNED-DevTexTl.js → abnfDiagram-VRR7QNED-C-GmxOf1.js} +1 -1
- package/web/dist/assets/{arc-WlXuN6B_.js → arc-DDtd5ukE.js} +1 -1
- package/web/dist/assets/{architectureDiagram-ZJ3FMSHR-DJYRAqSp.js → architectureDiagram-ZJ3FMSHR-Zcrj93zx.js} +1 -1
- package/web/dist/assets/{blockDiagram-677ZJIJ3-CsjO1oTv.js → blockDiagram-677ZJIJ3-BmW_eWmu.js} +1 -1
- package/web/dist/assets/{c4Diagram-LMCZKHZV-DjUCYgVk.js → c4Diagram-LMCZKHZV-BqjKf0hc.js} +1 -1
- package/web/dist/assets/channel-C383rS7h.js +1 -0
- package/web/dist/assets/{chunk-2Q5K7J3B-By6S-6eo.js → chunk-2Q5K7J3B-a9AZFLXE.js} +1 -1
- package/web/dist/assets/{chunk-32BRIVSS-Cl-hXbZD.js → chunk-32BRIVSS-BCkXoLsJ.js} +1 -1
- package/web/dist/assets/{chunk-5VM5RSS4--cWPnxlT.js → chunk-5VM5RSS4-CYvgXUg9.js} +1 -1
- package/web/dist/assets/{chunk-EX3LRPZG-PakDrWLX.js → chunk-EX3LRPZG-Bk4pbTj4.js} +1 -1
- package/web/dist/assets/{chunk-JWPE2WC7-DMfuuvGl.js → chunk-JWPE2WC7-BWqM8eD-.js} +1 -1
- package/web/dist/assets/{chunk-MOJQB5TN-BHD_IRop.js → chunk-MOJQB5TN-BDc7Owjb.js} +1 -1
- package/web/dist/assets/{chunk-RYQCIY6F-T4jqSvsD.js → chunk-RYQCIY6F-D09BsSzx.js} +1 -1
- package/web/dist/assets/{chunk-V7JOEXUC-C4paE6t8.js → chunk-V7JOEXUC-CTzvzLEU.js} +1 -1
- package/web/dist/assets/{chunk-VR4S4FIN-F5foapWH.js → chunk-VR4S4FIN-C1ZE--Nt.js} +1 -1
- package/web/dist/assets/{chunk-XXDRQBXY-Dp4WIFPJ.js → chunk-XXDRQBXY-BXoQdCUS.js} +1 -1
- package/web/dist/assets/classDiagram-OUVF2IWQ-COnk6cPI.js +1 -0
- package/web/dist/assets/classDiagram-v2-EOCWNBFH-COnk6cPI.js +1 -0
- package/web/dist/assets/{core-CGjsG6g4.js → core-7jBzBKfi.js} +1 -1
- package/web/dist/assets/{cose-bilkent-JH36ORCC-DcMU2oKv.js → cose-bilkent-JH36ORCC-Dj8ACMXD.js} +1 -1
- package/web/dist/assets/{cynefin-VYW2F7L2-SiDUbAfJ.js → cynefin-VYW2F7L2-B02zjHpN.js} +1 -1
- package/web/dist/assets/{cynefinDiagram-TSTJHNR4-DhkNlW7i.js → cynefinDiagram-TSTJHNR4-S6xOPYUg.js} +1 -1
- package/web/dist/assets/{dagre-VKFMJZFB-Co--CY4-.js → dagre-VKFMJZFB-DBps2cpF.js} +1 -1
- package/web/dist/assets/{diagram-FQU43EPY-BZs6G_Wi.js → diagram-FQU43EPY-Csa0t7d6.js} +1 -1
- package/web/dist/assets/{diagram-G47NLZAW-C6SAe39v.js → diagram-G47NLZAW-CJDkgMuf.js} +1 -1
- package/web/dist/assets/{diagram-NH7WQ7WH-D6EoRzQM.js → diagram-NH7WQ7WH-DipELJWi.js} +1 -1
- package/web/dist/assets/{diagram-OA4YK3LP-kHe4KJ_b.js → diagram-OA4YK3LP-Du1l3-2I.js} +1 -1
- package/web/dist/assets/{diagram-WEI45ONY-BM-NnNEq.js → diagram-WEI45ONY-B3sreihq.js} +1 -1
- package/web/dist/assets/{ebnfDiagram-CCIWWBDH-BfwqR7DU.js → ebnfDiagram-CCIWWBDH-DK92dwOE.js} +1 -1
- package/web/dist/assets/{erDiagram-Q63AITRT-BwUkv7nL.js → erDiagram-Q63AITRT-DEEPoGT-.js} +1 -1
- package/web/dist/assets/{flowDiagram-23GEKE2U-Cn0zH9bm.js → flowDiagram-23GEKE2U-DfHAV-5d.js} +1 -1
- package/web/dist/assets/{ganttDiagram-NO4QXBWP-BY_VLaEQ.js → ganttDiagram-NO4QXBWP-DuPB9mQa.js} +1 -1
- package/web/dist/assets/{gitGraphDiagram-IHSO6WYX-D0xpVnfm.js → gitGraphDiagram-IHSO6WYX-DRiejHE6.js} +1 -1
- package/web/dist/assets/index-B04o0cQL.css +1 -0
- package/web/dist/assets/index-CQuxrDDr.js +111 -0
- package/web/dist/assets/{infoDiagram-FWYZ7A6U-DnmnPGAH.js → infoDiagram-FWYZ7A6U-BFbN_gCc.js} +1 -1
- package/web/dist/assets/{ishikawaDiagram-FXEZZL3T-DTWLm3ZQ.js → ishikawaDiagram-FXEZZL3T-qpQEAqZ0.js} +1 -1
- package/web/dist/assets/{journeyDiagram-5HDEW3XC-RN13a5iK.js → journeyDiagram-5HDEW3XC-B6Hucs1I.js} +1 -1
- package/web/dist/assets/{kanban-definition-HUTT4EX6-CvmlJTH9.js → kanban-definition-HUTT4EX6-DcJgfaLq.js} +1 -1
- package/web/dist/assets/{linear-zHsglUI0.js → linear-BGGGx9QM.js} +1 -1
- package/web/dist/assets/{mermaid.core-Bfj9YagN.js → mermaid.core-BpfGpLSK.js} +4 -4
- package/web/dist/assets/{mindmap-definition-LN4V7U3C-CkcLeMWS.js → mindmap-definition-LN4V7U3C-w9Nrze0Z.js} +1 -1
- package/web/dist/assets/{pegDiagram-2B236MQR-eturQJg0.js → pegDiagram-2B236MQR-DR8kd-Uf.js} +1 -1
- package/web/dist/assets/{pieDiagram-ENE6RG2P-DJmmSZSO.js → pieDiagram-ENE6RG2P-cJAEwOMZ.js} +1 -1
- package/web/dist/assets/{quadrantDiagram-ABIIQ3AL-Br5y_5ZO.js → quadrantDiagram-ABIIQ3AL-uqa2DfnD.js} +1 -1
- package/web/dist/assets/{railroadDiagram-RFXS5EU6-DwnwvUqm.js → railroadDiagram-RFXS5EU6-B3D_Qhhz.js} +1 -1
- package/web/dist/assets/{requirementDiagram-TGXJPOKE-CMMKGrPQ.js → requirementDiagram-TGXJPOKE-HTpZiir8.js} +1 -1
- package/web/dist/assets/{sankeyDiagram-HTMAVEWB-BKP-cLrV.js → sankeyDiagram-HTMAVEWB-Dk5U_RAw.js} +1 -1
- package/web/dist/assets/{sequenceDiagram-DBY2YBRQ-YgkgEj_6.js → sequenceDiagram-DBY2YBRQ-BVQdjwc7.js} +1 -1
- package/web/dist/assets/{sizeCapture-X5ZJPWSS-nkigHDeZ.js → sizeCapture-X5ZJPWSS-cQqggv7d.js} +1 -1
- package/web/dist/assets/{stateDiagram-2N3HPSRC-CEoMK2Kt.js → stateDiagram-2N3HPSRC-DYyCojiz.js} +1 -1
- package/web/dist/assets/stateDiagram-v2-6OUMAXLB-C_Jg0hPe.js +1 -0
- package/web/dist/assets/{swimlanes-5IMT3BWC-Co9CmBP_.js → swimlanes-5IMT3BWC-D3DM4_kt.js} +2 -2
- package/web/dist/assets/swimlanesDiagram-G3AALYLV-Dq3PD0M1.js +8 -0
- package/web/dist/assets/{timeline-definition-FHXFAJF6-C5njALNw.js → timeline-definition-FHXFAJF6-Cn_urqFk.js} +1 -1
- package/web/dist/assets/{vennDiagram-L72KCM5P-BpvLQRHS.js → vennDiagram-L72KCM5P-BsDcbpwv.js} +1 -1
- package/web/dist/assets/{wardleyDiagram-EHGQE667-CWINCOno.js → wardleyDiagram-EHGQE667-B7QBTkxh.js} +1 -1
- package/web/dist/assets/{xychartDiagram-FW5EYKEG-xDH3ABG4.js → xychartDiagram-FW5EYKEG-BmBhEATK.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/channel-DGnywxBx.js +0 -1
- package/web/dist/assets/classDiagram-OUVF2IWQ-DjHXtkKr.js +0 -1
- package/web/dist/assets/classDiagram-v2-EOCWNBFH-DjHXtkKr.js +0 -1
- package/web/dist/assets/index-Bl4JO4M7.css +0 -1
- package/web/dist/assets/index-D9Ao6WQl.js +0 -111
- package/web/dist/assets/stateDiagram-v2-6OUMAXLB--iEtUEGo.js +0 -1
- package/web/dist/assets/swimlanesDiagram-G3AALYLV-BzapPKvi.js +0 -8
package/codex/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { randomBytes, randomUUID, scryptSync, timingSafeEqual } from "node:crypto";
|
|
1
|
+
import { randomBytes, randomUUID, scrypt, scryptSync, timingSafeEqual, } from "node:crypto";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { mkdirSync } from "node:fs";
|
|
4
|
-
import { openSqliteDatabase, } from "../storage/sqlite.js";
|
|
4
|
+
import { openSqliteDatabase, runInTransaction, } from "../storage/sqlite.js";
|
|
5
5
|
export class UserStore {
|
|
6
6
|
sessionSecret;
|
|
7
7
|
db;
|
|
8
|
+
dummyPasswordHash;
|
|
8
9
|
constructor(databasePath, bootstrap) {
|
|
9
10
|
mkdirSync(path.dirname(databasePath), { recursive: true });
|
|
10
11
|
this.db = openSqliteDatabase(databasePath);
|
|
11
12
|
this.db.exec("pragma journal_mode = WAL");
|
|
12
13
|
this.initializeSchema();
|
|
13
14
|
this.sessionSecret = this.ensureSessionSecret();
|
|
15
|
+
this.dummyPasswordHash = this.ensureDummyPasswordHash();
|
|
14
16
|
if (this.countUsers() === 0 && bootstrap?.password) {
|
|
15
17
|
this.createUser({
|
|
16
18
|
username: bootstrap.username,
|
|
@@ -40,15 +42,64 @@ export class UserStore {
|
|
|
40
42
|
.get(username.trim());
|
|
41
43
|
return row ? userFromRow(row) : null;
|
|
42
44
|
}
|
|
43
|
-
authenticate(username, password) {
|
|
45
|
+
async authenticate(username, password) {
|
|
44
46
|
const row = this.db
|
|
45
47
|
.prepare("select * from auth_users where username = ? collate nocase")
|
|
46
48
|
.get(username.trim());
|
|
47
|
-
|
|
49
|
+
const passwordMatches = await verifyPassword(password, row?.password_hash ?? this.dummyPasswordHash);
|
|
50
|
+
if (!row || !row.active || !passwordMatches) {
|
|
48
51
|
return null;
|
|
49
52
|
}
|
|
50
53
|
return userFromRow(row);
|
|
51
54
|
}
|
|
55
|
+
loginBlockedUntil(keys, now = Date.now()) {
|
|
56
|
+
let blockedUntil = 0;
|
|
57
|
+
const statement = this.db.prepare("select locked_until from auth_login_attempts where key = ?");
|
|
58
|
+
for (const key of keys) {
|
|
59
|
+
const row = statement.get(key);
|
|
60
|
+
blockedUntil = Math.max(blockedUntil, row?.locked_until ?? 0);
|
|
61
|
+
}
|
|
62
|
+
return blockedUntil > now ? blockedUntil : 0;
|
|
63
|
+
}
|
|
64
|
+
recordLoginFailure(buckets, windowMs, lockoutMs, now = Date.now()) {
|
|
65
|
+
runInTransaction(this.db, () => {
|
|
66
|
+
const read = this.db.prepare(`
|
|
67
|
+
select failure_count, window_started_at, locked_until
|
|
68
|
+
from auth_login_attempts where key = ?
|
|
69
|
+
`);
|
|
70
|
+
const write = this.db.prepare(`
|
|
71
|
+
insert into auth_login_attempts (
|
|
72
|
+
key, failure_count, window_started_at, locked_until, updated_at
|
|
73
|
+
) values (?, ?, ?, ?, ?)
|
|
74
|
+
on conflict(key) do update set
|
|
75
|
+
failure_count = excluded.failure_count,
|
|
76
|
+
window_started_at = excluded.window_started_at,
|
|
77
|
+
locked_until = excluded.locked_until,
|
|
78
|
+
updated_at = excluded.updated_at
|
|
79
|
+
`);
|
|
80
|
+
for (const bucket of buckets) {
|
|
81
|
+
const current = read.get(bucket.key);
|
|
82
|
+
const expired = !current ||
|
|
83
|
+
(current.locked_until <= now &&
|
|
84
|
+
now - current.window_started_at >= windowMs);
|
|
85
|
+
const failureCount = expired ? 1 : current.failure_count + 1;
|
|
86
|
+
const windowStartedAt = expired ? now : current.window_started_at;
|
|
87
|
+
const lockedUntil = failureCount >= bucket.maxFailures ? now + lockoutMs : 0;
|
|
88
|
+
write.run(bucket.key, failureCount, windowStartedAt, lockedUntil, now);
|
|
89
|
+
}
|
|
90
|
+
this.db
|
|
91
|
+
.prepare("delete from auth_login_attempts where updated_at < ?")
|
|
92
|
+
.run(now - Math.max(windowMs, lockoutMs) * 4);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
clearLoginFailures(keys) {
|
|
96
|
+
const statement = this.db.prepare("delete from auth_login_attempts where key = ?");
|
|
97
|
+
runInTransaction(this.db, () => {
|
|
98
|
+
for (const key of keys) {
|
|
99
|
+
statement.run(key);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
52
103
|
createUser(input) {
|
|
53
104
|
const username = normalizeUsername(input.username);
|
|
54
105
|
validatePassword(input.password);
|
|
@@ -132,6 +183,15 @@ export class UserStore {
|
|
|
132
183
|
key text primary key,
|
|
133
184
|
value text not null
|
|
134
185
|
);
|
|
186
|
+
create table if not exists auth_login_attempts (
|
|
187
|
+
key text primary key,
|
|
188
|
+
failure_count integer not null,
|
|
189
|
+
window_started_at integer not null,
|
|
190
|
+
locked_until integer not null,
|
|
191
|
+
updated_at integer not null
|
|
192
|
+
);
|
|
193
|
+
create index if not exists auth_login_attempts_updated_at
|
|
194
|
+
on auth_login_attempts(updated_at);
|
|
135
195
|
`);
|
|
136
196
|
}
|
|
137
197
|
ensureSessionSecret() {
|
|
@@ -147,6 +207,19 @@ export class UserStore {
|
|
|
147
207
|
.run(value);
|
|
148
208
|
return value;
|
|
149
209
|
}
|
|
210
|
+
ensureDummyPasswordHash() {
|
|
211
|
+
const existing = this.db
|
|
212
|
+
.prepare("select value from auth_metadata where key = 'dummy_password_hash'")
|
|
213
|
+
.get();
|
|
214
|
+
if (existing) {
|
|
215
|
+
return existing.value;
|
|
216
|
+
}
|
|
217
|
+
const value = hashPassword(randomBytes(32).toString("base64url"));
|
|
218
|
+
this.db
|
|
219
|
+
.prepare("insert into auth_metadata (key, value) values ('dummy_password_hash', ?)")
|
|
220
|
+
.run(value);
|
|
221
|
+
return value;
|
|
222
|
+
}
|
|
150
223
|
}
|
|
151
224
|
function userFromRow(row) {
|
|
152
225
|
return {
|
|
@@ -176,17 +249,28 @@ function hashPassword(password) {
|
|
|
176
249
|
const digest = scryptSync(password, salt, 64);
|
|
177
250
|
return `scrypt:${salt.toString("base64url")}:${digest.toString("base64url")}`;
|
|
178
251
|
}
|
|
179
|
-
function verifyPassword(password, stored) {
|
|
252
|
+
async function verifyPassword(password, stored) {
|
|
180
253
|
const [algorithm, encodedSalt, encodedDigest] = stored.split(":");
|
|
181
254
|
if (algorithm !== "scrypt" || !encodedSalt || !encodedDigest) {
|
|
182
255
|
return false;
|
|
183
256
|
}
|
|
184
257
|
try {
|
|
185
258
|
const expected = Buffer.from(encodedDigest, "base64url");
|
|
186
|
-
const actual =
|
|
259
|
+
const actual = await derivePassword(password, Buffer.from(encodedSalt, "base64url"), expected.length);
|
|
187
260
|
return expected.length === actual.length && timingSafeEqual(expected, actual);
|
|
188
261
|
}
|
|
189
262
|
catch {
|
|
190
263
|
return false;
|
|
191
264
|
}
|
|
192
265
|
}
|
|
266
|
+
function derivePassword(password, salt, length) {
|
|
267
|
+
return new Promise((resolve, reject) => {
|
|
268
|
+
scrypt(password, salt, length, (error, derivedKey) => {
|
|
269
|
+
if (error) {
|
|
270
|
+
reject(error);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
resolve(derivedKey);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
}
|
package/server/dist/server.js
CHANGED
|
@@ -38,6 +38,10 @@ const RUNTIME_WATCHDOG_INTERVAL_MS = 10_000;
|
|
|
38
38
|
const TURN_LONG_RUNNING_AFTER_MS = 15 * 60 * 1000;
|
|
39
39
|
const TURN_PHASE_BOUNDARY_OPERATION_COUNT = 20;
|
|
40
40
|
const LOGIN_MAX_FAILURES = 5;
|
|
41
|
+
const LOGIN_USER_MAX_FAILURES = 10;
|
|
42
|
+
const LOGIN_SOURCE_MAX_FAILURES = 30;
|
|
43
|
+
const LOGIN_MAX_CONCURRENT_VERIFICATIONS = 4;
|
|
44
|
+
const LOGIN_FAILURE_WINDOW_MS = 15 * 60 * 1000;
|
|
41
45
|
const LOGIN_LOCKOUT_MS = 15 * 60 * 1000;
|
|
42
46
|
const RESPONSIBILITY_UPDATE_GUIDE_RELATIVE_PATH = ".seele/skills/responsibility-update.md";
|
|
43
47
|
const KNOWLEDGE_SOURCE_GUIDE_RELATIVE_PATH = ".seele/skills/knowledge-source.md";
|
|
@@ -45,7 +49,7 @@ let codexUpdateJob = null;
|
|
|
45
49
|
let codexLatestVersion = null;
|
|
46
50
|
let runtimeModelCatalogRefresh = null;
|
|
47
51
|
let runtimeRateLimitsRefresh = null;
|
|
48
|
-
|
|
52
|
+
let activeLoginVerifications = 0;
|
|
49
53
|
const RESPONSIBILITY_UPDATE_GUIDE = `# Seele 职责总结与更新指南
|
|
50
54
|
|
|
51
55
|
仅当你需要总结或更新 workspace 的长期职责时再阅读本文件。它不是每轮默认注入内容。
|
|
@@ -287,20 +291,32 @@ const server = createServer(async (request, response) => {
|
|
|
287
291
|
const body = await readJsonBody(request);
|
|
288
292
|
const username = typeof body.username === "string" ? body.username : "";
|
|
289
293
|
const password = typeof body.password === "string" ? body.password : "";
|
|
290
|
-
const
|
|
291
|
-
const blockedUntil = loginBlockedUntil(
|
|
294
|
+
const loginBuckets = loginAttemptBuckets(request, username);
|
|
295
|
+
const blockedUntil = userStore.loginBlockedUntil(loginBuckets.map((bucket) => bucket.key));
|
|
292
296
|
if (blockedUntil > Date.now()) {
|
|
293
297
|
response.setHeader("Retry-After", String(Math.max(1, Math.ceil((blockedUntil - Date.now()) / 1000))));
|
|
294
298
|
sendJson(response, 429, { error: "login_rate_limited" });
|
|
295
299
|
return;
|
|
296
300
|
}
|
|
297
|
-
|
|
301
|
+
if (activeLoginVerifications >= LOGIN_MAX_CONCURRENT_VERIFICATIONS) {
|
|
302
|
+
response.setHeader("Retry-After", "1");
|
|
303
|
+
sendJson(response, 429, { error: "login_rate_limited" });
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
activeLoginVerifications += 1;
|
|
307
|
+
let user;
|
|
308
|
+
try {
|
|
309
|
+
user = await userStore.authenticate(username, password);
|
|
310
|
+
}
|
|
311
|
+
finally {
|
|
312
|
+
activeLoginVerifications -= 1;
|
|
313
|
+
}
|
|
298
314
|
if (!user) {
|
|
299
|
-
recordLoginFailure(
|
|
315
|
+
userStore.recordLoginFailure(loginBuckets, LOGIN_FAILURE_WINDOW_MS, LOGIN_LOCKOUT_MS);
|
|
300
316
|
sendJson(response, 401, { error: "invalid_credentials" });
|
|
301
317
|
return;
|
|
302
318
|
}
|
|
303
|
-
|
|
319
|
+
userStore.clearLoginFailures(loginBuckets.slice(0, 2).map((bucket) => bucket.key));
|
|
304
320
|
setSessionCookie(response, request, {
|
|
305
321
|
userId: user.id,
|
|
306
322
|
sessionVersion: user.sessionVersion,
|
|
@@ -4508,27 +4524,20 @@ function userMutationError(error) {
|
|
|
4508
4524
|
? message
|
|
4509
4525
|
: "user_update_failed";
|
|
4510
4526
|
}
|
|
4511
|
-
function
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
function recordLoginFailure(key) {
|
|
4526
|
-
const current = loginFailures.get(key) ?? { count: 0, lockedUntil: 0 };
|
|
4527
|
-
const count = current.count + 1;
|
|
4528
|
-
loginFailures.set(key, {
|
|
4529
|
-
count,
|
|
4530
|
-
lockedUntil: count >= LOGIN_MAX_FAILURES ? Date.now() + LOGIN_LOCKOUT_MS : 0,
|
|
4531
|
-
});
|
|
4527
|
+
function loginAttemptBuckets(request, username) {
|
|
4528
|
+
const source = request.socket.remoteAddress ?? "unknown";
|
|
4529
|
+
const usernameDigest = createHash("sha256")
|
|
4530
|
+
.update(username.trim().toLowerCase())
|
|
4531
|
+
.digest("hex");
|
|
4532
|
+
const sourceDigest = createHash("sha256").update(source).digest("hex");
|
|
4533
|
+
return [
|
|
4534
|
+
{
|
|
4535
|
+
key: `pair:${sourceDigest}:${usernameDigest}`,
|
|
4536
|
+
maxFailures: LOGIN_MAX_FAILURES,
|
|
4537
|
+
},
|
|
4538
|
+
{ key: `user:${usernameDigest}`, maxFailures: LOGIN_USER_MAX_FAILURES },
|
|
4539
|
+
{ key: `source:${sourceDigest}`, maxFailures: LOGIN_SOURCE_MAX_FAILURES },
|
|
4540
|
+
];
|
|
4532
4541
|
}
|
|
4533
4542
|
function isServableConversationFileContentType(value) {
|
|
4534
4543
|
return (value.startsWith("image/") ||
|
package/web/dist/assets/{abnfDiagram-VRR7QNED-DevTexTl.js → abnfDiagram-VRR7QNED-C-GmxOf1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-BDc7Owjb.js";import{p as f}from"./chunk-JWPE2WC7-BWqM8eD-.js";import{_ as n,l as o}from"./mermaid.core-BpfGpLSK.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-B02zjHpN.js";import"./index-CQuxrDDr.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-
|
|
1
|
+
import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-BpfGpLSK.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,K,u){var D=q-l,i=O-h,n=K-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function W(l,h,q,O,v,R,K){var u=l-q,D=h-O,i=(K?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,L=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(on(0,T*T*A-P*P)),G=(P*g-m*E)/A,H=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=G-L,e=H-t,r=w-L,M=p-t;return x*x+e*e>r*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(L<un)if(S=pn(Q,V,X,Y,F,U,B,C)){var Z=Q-S[0],$=V-S[1],k=F-S[0],b=U-S[1],nn=1/I(fn((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(Q,V),u.arc(0,0,s,m,g,!t)):u.moveTo(Q,V),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-un/2;return[N(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:J(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:J(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:J(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:J(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:J(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:J(+n),i):R},i.padAngle=function(n){return arguments.length?(K=typeof n=="function"?n:J(+n),i):K},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};
|