@axiom-lattice/protocols 7.3.0 → 7.4.0
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +90 -0
- package/dist/index.d.mts +44 -4
- package/dist/index.d.ts +44 -4
- package/dist/index.js +209 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +201 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AuthCssContract.ts +45 -0
- package/src/CollectionStoreProtocol.ts +8 -0
- package/src/McpUiProtocol.ts +2 -0
- package/src/OpenProtocol.ts +2 -2
- package/src/PlatformBrandingCss.ts +180 -0
- package/src/PlatformSettingsProtocol.ts +4 -0
- package/src/PluginProtocol.ts +9 -0
- package/src/SandboxResourceProtocol.ts +1 -1
- package/src/__tests__/PlatformBrandingCss.test.ts +103 -0
- package/src/index.ts +2 -0
package/dist/index.mjs
CHANGED
|
@@ -234,6 +234,9 @@ var ChannelBindingMigrationConflictError = class extends Error {
|
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
+
// src/CollectionStoreProtocol.ts
|
|
238
|
+
var COLLECTION_ENTRY_BATCH_MAX = 50;
|
|
239
|
+
|
|
237
240
|
// src/TaskStoreProtocol.ts
|
|
238
241
|
function normalizeTaskMetadataScalar(value) {
|
|
239
242
|
if (typeof value === "string") return value;
|
|
@@ -1266,7 +1269,10 @@ var PLATFORM_SETTINGS_DEFAULTS = {
|
|
|
1266
1269
|
}
|
|
1267
1270
|
};
|
|
1268
1271
|
var DEFAULT_PLATFORM_BRANDING = {
|
|
1269
|
-
brandName: "AlphaFina"
|
|
1272
|
+
brandName: "AlphaFina",
|
|
1273
|
+
logoUrl: "/logo.png",
|
|
1274
|
+
primaryColor: "#5b50c6",
|
|
1275
|
+
backgroundColor: "#ffffff"
|
|
1270
1276
|
};
|
|
1271
1277
|
function normalizeBrandingHost(raw) {
|
|
1272
1278
|
let host = raw.trim().toLowerCase();
|
|
@@ -1281,16 +1287,205 @@ function normalizeBrandingHost(raw) {
|
|
|
1281
1287
|
}
|
|
1282
1288
|
return host.replace(/\.+$/, "");
|
|
1283
1289
|
}
|
|
1290
|
+
|
|
1291
|
+
// src/PlatformBrandingCss.ts
|
|
1292
|
+
var MAX_CUSTOM_CSS_LENGTH = 65536;
|
|
1293
|
+
var IDENTIFIER_CHAR = /[A-Za-z0-9_-]/;
|
|
1294
|
+
function skipQuoted(css, start) {
|
|
1295
|
+
const quote = css[start];
|
|
1296
|
+
let index = start + 1;
|
|
1297
|
+
while (index < css.length) {
|
|
1298
|
+
if (css[index] === "\\") {
|
|
1299
|
+
index += 2;
|
|
1300
|
+
continue;
|
|
1301
|
+
}
|
|
1302
|
+
if (css[index] === quote) return index + 1;
|
|
1303
|
+
index += 1;
|
|
1304
|
+
}
|
|
1305
|
+
return css.length;
|
|
1306
|
+
}
|
|
1307
|
+
function decodeCssEscapeAt(css, index) {
|
|
1308
|
+
let cursor = index + 1;
|
|
1309
|
+
if (cursor >= css.length) return { value: "", next: cursor };
|
|
1310
|
+
const escaped = css[cursor];
|
|
1311
|
+
if (escaped === "\n" || escaped === "\f" || escaped === "\r") {
|
|
1312
|
+
if (escaped === "\r" && css[cursor + 1] === "\n") cursor += 1;
|
|
1313
|
+
return { value: "", next: cursor + 1 };
|
|
1314
|
+
}
|
|
1315
|
+
const hex = /^[0-9a-fA-F]{1,6}/.exec(css.slice(cursor));
|
|
1316
|
+
if (hex) {
|
|
1317
|
+
cursor += hex[0].length;
|
|
1318
|
+
if (cursor < css.length && /\s/.test(css[cursor])) {
|
|
1319
|
+
if (css[cursor] === "\r" && css[cursor + 1] === "\n") cursor += 1;
|
|
1320
|
+
cursor += 1;
|
|
1321
|
+
}
|
|
1322
|
+
const codePoint = Number.parseInt(hex[0], 16);
|
|
1323
|
+
if (codePoint === 0 || codePoint > 1114111 || codePoint >= 55296 && codePoint <= 57343) {
|
|
1324
|
+
return { value: "\uFFFD", next: cursor };
|
|
1325
|
+
}
|
|
1326
|
+
return { value: String.fromCodePoint(codePoint), next: cursor };
|
|
1327
|
+
}
|
|
1328
|
+
return { value: escaped, next: cursor + 1 };
|
|
1329
|
+
}
|
|
1330
|
+
function readDecodedIdentifier(css, start) {
|
|
1331
|
+
let value = "";
|
|
1332
|
+
let index = start;
|
|
1333
|
+
let consumed = false;
|
|
1334
|
+
while (index < css.length) {
|
|
1335
|
+
const current = css[index];
|
|
1336
|
+
if (current === "\\") {
|
|
1337
|
+
const decoded = decodeCssEscapeAt(css, index);
|
|
1338
|
+
value += decoded.value;
|
|
1339
|
+
index = decoded.next;
|
|
1340
|
+
consumed = true;
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1343
|
+
if (!IDENTIFIER_CHAR.test(current) && current.charCodeAt(0) < 128) break;
|
|
1344
|
+
value += current;
|
|
1345
|
+
index += 1;
|
|
1346
|
+
consumed = true;
|
|
1347
|
+
}
|
|
1348
|
+
return consumed ? { value, next: index } : null;
|
|
1349
|
+
}
|
|
1350
|
+
function matchUrlToken(css, start) {
|
|
1351
|
+
if (start > 0 && IDENTIFIER_CHAR.test(css[start - 1])) return null;
|
|
1352
|
+
const identifier = readDecodedIdentifier(css, start);
|
|
1353
|
+
if (!identifier || identifier.value.toLowerCase() !== "url") return null;
|
|
1354
|
+
let index = identifier.next;
|
|
1355
|
+
while (index < css.length && /\s/.test(css[index])) index += 1;
|
|
1356
|
+
if (css[index] !== "(") return null;
|
|
1357
|
+
return index + 1;
|
|
1358
|
+
}
|
|
1359
|
+
function skipUrlContents(css, start) {
|
|
1360
|
+
let index = start;
|
|
1361
|
+
while (index < css.length && /\s/.test(css[index])) index += 1;
|
|
1362
|
+
if (css[index] === '"' || css[index] === "'") {
|
|
1363
|
+
index = skipQuoted(css, index);
|
|
1364
|
+
while (index < css.length && /\s/.test(css[index])) index += 1;
|
|
1365
|
+
if (css[index] !== ")") return null;
|
|
1366
|
+
return index + 1;
|
|
1367
|
+
}
|
|
1368
|
+
const end = css.indexOf(")", index);
|
|
1369
|
+
return end === -1 ? null : end + 1;
|
|
1370
|
+
}
|
|
1371
|
+
function stripCssForImportScan(css) {
|
|
1372
|
+
let out = "";
|
|
1373
|
+
let index = 0;
|
|
1374
|
+
while (index < css.length) {
|
|
1375
|
+
const current = css[index];
|
|
1376
|
+
const next = css[index + 1];
|
|
1377
|
+
if (current === "/" && next === "*") {
|
|
1378
|
+
const end = css.indexOf("*/", index + 2);
|
|
1379
|
+
index = end === -1 ? css.length : end + 2;
|
|
1380
|
+
out += " ";
|
|
1381
|
+
continue;
|
|
1382
|
+
}
|
|
1383
|
+
if (current === '"' || current === "'") {
|
|
1384
|
+
index = skipQuoted(css, index);
|
|
1385
|
+
continue;
|
|
1386
|
+
}
|
|
1387
|
+
const urlContentStart = matchUrlToken(css, index);
|
|
1388
|
+
if (urlContentStart !== null) {
|
|
1389
|
+
const urlEnd = skipUrlContents(css, urlContentStart);
|
|
1390
|
+
if (urlEnd !== null) {
|
|
1391
|
+
index = urlEnd;
|
|
1392
|
+
out += "url()";
|
|
1393
|
+
continue;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
out += current;
|
|
1397
|
+
index += 1;
|
|
1398
|
+
}
|
|
1399
|
+
return out;
|
|
1400
|
+
}
|
|
1401
|
+
function decodeCssEscapes(css) {
|
|
1402
|
+
let out = "";
|
|
1403
|
+
let index = 0;
|
|
1404
|
+
while (index < css.length) {
|
|
1405
|
+
const current = css[index];
|
|
1406
|
+
if (current !== "\\") {
|
|
1407
|
+
out += current;
|
|
1408
|
+
index += 1;
|
|
1409
|
+
continue;
|
|
1410
|
+
}
|
|
1411
|
+
const decoded = decodeCssEscapeAt(css, index);
|
|
1412
|
+
out += decoded.value;
|
|
1413
|
+
index = decoded.next;
|
|
1414
|
+
}
|
|
1415
|
+
return out;
|
|
1416
|
+
}
|
|
1417
|
+
function hasCssImport(css) {
|
|
1418
|
+
const stripped = stripCssForImportScan(css);
|
|
1419
|
+
return /@import\b/i.test(decodeCssEscapes(stripped));
|
|
1420
|
+
}
|
|
1421
|
+
function hasStyleBreakout(css) {
|
|
1422
|
+
return /<\/style/i.test(css);
|
|
1423
|
+
}
|
|
1424
|
+
function validateCustomCss(value) {
|
|
1425
|
+
if (typeof value !== "string" || value.length > MAX_CUSTOM_CSS_LENGTH) {
|
|
1426
|
+
return { ok: false, reason: "length" };
|
|
1427
|
+
}
|
|
1428
|
+
if (hasCssImport(value)) return { ok: false, reason: "import" };
|
|
1429
|
+
if (hasStyleBreakout(value)) return { ok: false, reason: "breakout" };
|
|
1430
|
+
return { ok: true };
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
// src/AuthCssContract.ts
|
|
1434
|
+
var AUTH_CSS_CONTRACT_PARTS = [
|
|
1435
|
+
"page",
|
|
1436
|
+
"card",
|
|
1437
|
+
"header",
|
|
1438
|
+
"logo",
|
|
1439
|
+
"logo-image",
|
|
1440
|
+
"title",
|
|
1441
|
+
"subtitle",
|
|
1442
|
+
"form",
|
|
1443
|
+
"field",
|
|
1444
|
+
"input",
|
|
1445
|
+
"submit",
|
|
1446
|
+
"sso",
|
|
1447
|
+
"sso-button",
|
|
1448
|
+
"alert",
|
|
1449
|
+
"footer",
|
|
1450
|
+
"link",
|
|
1451
|
+
"cancel",
|
|
1452
|
+
"tenant-list",
|
|
1453
|
+
"tenant-card",
|
|
1454
|
+
"tenant-search",
|
|
1455
|
+
"tenant-footer",
|
|
1456
|
+
"invite-notice"
|
|
1457
|
+
];
|
|
1458
|
+
var AUTH_CSS_CONTRACT_VARIABLES = [
|
|
1459
|
+
"--axiom-auth-primary",
|
|
1460
|
+
"--axiom-auth-primary-hover",
|
|
1461
|
+
"--axiom-auth-primary-active",
|
|
1462
|
+
"--axiom-auth-bg",
|
|
1463
|
+
"--axiom-auth-surface",
|
|
1464
|
+
"--axiom-auth-text",
|
|
1465
|
+
"--axiom-auth-text-secondary",
|
|
1466
|
+
"--axiom-auth-border",
|
|
1467
|
+
"--axiom-auth-radius",
|
|
1468
|
+
"--axiom-auth-page-padding",
|
|
1469
|
+
"--axiom-auth-card-width",
|
|
1470
|
+
"--axiom-auth-card-padding",
|
|
1471
|
+
"--axiom-auth-card-shadow",
|
|
1472
|
+
"--axiom-auth-card-shadow-hover",
|
|
1473
|
+
"--axiom-auth-logo-size",
|
|
1474
|
+
"--axiom-auth-input-height"
|
|
1475
|
+
];
|
|
1284
1476
|
export {
|
|
1285
1477
|
AFFINITY_ECHO_HEADER,
|
|
1286
1478
|
AFFINITY_MISS_CODE,
|
|
1287
1479
|
AGENT_AFFINITY_HEADER,
|
|
1288
1480
|
ASR_DEFAULT_KEY,
|
|
1481
|
+
AUTH_CSS_CONTRACT_PARTS,
|
|
1482
|
+
AUTH_CSS_CONTRACT_VARIABLES,
|
|
1289
1483
|
AgentType,
|
|
1290
1484
|
AuthError,
|
|
1291
1485
|
CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT,
|
|
1292
1486
|
CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
|
|
1293
1487
|
CHANNEL_REPLY_JOB_LIST_LIMIT_MIN,
|
|
1488
|
+
COLLECTION_ENTRY_BATCH_MAX,
|
|
1294
1489
|
ChannelBindingMigrationConflictError,
|
|
1295
1490
|
DEFAULT_MODEL_KEY,
|
|
1296
1491
|
DEFAULT_PLATFORM_BRANDING,
|
|
@@ -1304,6 +1499,7 @@ export {
|
|
|
1304
1499
|
InvalidProjectCapabilityBundleConfigError,
|
|
1305
1500
|
LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION,
|
|
1306
1501
|
LoggerType,
|
|
1502
|
+
MAX_CUSTOM_CSS_LENGTH,
|
|
1307
1503
|
MAX_PENDING_EXECUTION_RESULTS_LIMIT,
|
|
1308
1504
|
McpMessageType,
|
|
1309
1505
|
MemoryType,
|
|
@@ -1350,6 +1546,8 @@ export {
|
|
|
1350
1546
|
firstNonEmptyString,
|
|
1351
1547
|
getSubAgentsFromConfig,
|
|
1352
1548
|
getToolsFromConfig,
|
|
1549
|
+
hasCssImport,
|
|
1550
|
+
hasStyleBreakout,
|
|
1353
1551
|
hasTools,
|
|
1354
1552
|
interruptAnswerKeySchema,
|
|
1355
1553
|
isA2ARemoteAgentConfig,
|
|
@@ -1394,6 +1592,7 @@ export {
|
|
|
1394
1592
|
toModelKey,
|
|
1395
1593
|
toProjectRoomPublicBotMembership,
|
|
1396
1594
|
toProjectRoomPublicMembership,
|
|
1397
|
-
toProjectRoomPublicMessage
|
|
1595
|
+
toProjectRoomPublicMessage,
|
|
1596
|
+
validateCustomCss
|
|
1398
1597
|
};
|
|
1399
1598
|
//# sourceMappingURL=index.mjs.map
|