@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.js
CHANGED
|
@@ -24,11 +24,14 @@ __export(index_exports, {
|
|
|
24
24
|
AFFINITY_MISS_CODE: () => AFFINITY_MISS_CODE,
|
|
25
25
|
AGENT_AFFINITY_HEADER: () => AGENT_AFFINITY_HEADER,
|
|
26
26
|
ASR_DEFAULT_KEY: () => ASR_DEFAULT_KEY,
|
|
27
|
+
AUTH_CSS_CONTRACT_PARTS: () => AUTH_CSS_CONTRACT_PARTS,
|
|
28
|
+
AUTH_CSS_CONTRACT_VARIABLES: () => AUTH_CSS_CONTRACT_VARIABLES,
|
|
27
29
|
AgentType: () => AgentType,
|
|
28
30
|
AuthError: () => AuthError,
|
|
29
31
|
CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT: () => CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT,
|
|
30
32
|
CHANNEL_REPLY_JOB_LIST_LIMIT_MAX: () => CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
|
|
31
33
|
CHANNEL_REPLY_JOB_LIST_LIMIT_MIN: () => CHANNEL_REPLY_JOB_LIST_LIMIT_MIN,
|
|
34
|
+
COLLECTION_ENTRY_BATCH_MAX: () => COLLECTION_ENTRY_BATCH_MAX,
|
|
32
35
|
ChannelBindingMigrationConflictError: () => ChannelBindingMigrationConflictError,
|
|
33
36
|
DEFAULT_MODEL_KEY: () => DEFAULT_MODEL_KEY,
|
|
34
37
|
DEFAULT_PLATFORM_BRANDING: () => DEFAULT_PLATFORM_BRANDING,
|
|
@@ -42,6 +45,7 @@ __export(index_exports, {
|
|
|
42
45
|
InvalidProjectCapabilityBundleConfigError: () => InvalidProjectCapabilityBundleConfigError,
|
|
43
46
|
LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION: () => LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION,
|
|
44
47
|
LoggerType: () => LoggerType,
|
|
48
|
+
MAX_CUSTOM_CSS_LENGTH: () => MAX_CUSTOM_CSS_LENGTH,
|
|
45
49
|
MAX_PENDING_EXECUTION_RESULTS_LIMIT: () => MAX_PENDING_EXECUTION_RESULTS_LIMIT,
|
|
46
50
|
McpMessageType: () => McpMessageType,
|
|
47
51
|
MemoryType: () => MemoryType,
|
|
@@ -88,6 +92,8 @@ __export(index_exports, {
|
|
|
88
92
|
firstNonEmptyString: () => firstNonEmptyString,
|
|
89
93
|
getSubAgentsFromConfig: () => getSubAgentsFromConfig,
|
|
90
94
|
getToolsFromConfig: () => getToolsFromConfig,
|
|
95
|
+
hasCssImport: () => hasCssImport,
|
|
96
|
+
hasStyleBreakout: () => hasStyleBreakout,
|
|
91
97
|
hasTools: () => hasTools,
|
|
92
98
|
interruptAnswerKeySchema: () => interruptAnswerKeySchema,
|
|
93
99
|
isA2ARemoteAgentConfig: () => isA2ARemoteAgentConfig,
|
|
@@ -132,7 +138,8 @@ __export(index_exports, {
|
|
|
132
138
|
toModelKey: () => toModelKey,
|
|
133
139
|
toProjectRoomPublicBotMembership: () => toProjectRoomPublicBotMembership,
|
|
134
140
|
toProjectRoomPublicMembership: () => toProjectRoomPublicMembership,
|
|
135
|
-
toProjectRoomPublicMessage: () => toProjectRoomPublicMessage
|
|
141
|
+
toProjectRoomPublicMessage: () => toProjectRoomPublicMessage,
|
|
142
|
+
validateCustomCss: () => validateCustomCss
|
|
136
143
|
});
|
|
137
144
|
module.exports = __toCommonJS(index_exports);
|
|
138
145
|
|
|
@@ -372,6 +379,9 @@ var ChannelBindingMigrationConflictError = class extends Error {
|
|
|
372
379
|
}
|
|
373
380
|
};
|
|
374
381
|
|
|
382
|
+
// src/CollectionStoreProtocol.ts
|
|
383
|
+
var COLLECTION_ENTRY_BATCH_MAX = 50;
|
|
384
|
+
|
|
375
385
|
// src/TaskStoreProtocol.ts
|
|
376
386
|
function normalizeTaskMetadataScalar(value) {
|
|
377
387
|
if (typeof value === "string") return value;
|
|
@@ -1404,7 +1414,10 @@ var PLATFORM_SETTINGS_DEFAULTS = {
|
|
|
1404
1414
|
}
|
|
1405
1415
|
};
|
|
1406
1416
|
var DEFAULT_PLATFORM_BRANDING = {
|
|
1407
|
-
brandName: "AlphaFina"
|
|
1417
|
+
brandName: "AlphaFina",
|
|
1418
|
+
logoUrl: "/logo.png",
|
|
1419
|
+
primaryColor: "#5b50c6",
|
|
1420
|
+
backgroundColor: "#ffffff"
|
|
1408
1421
|
};
|
|
1409
1422
|
function normalizeBrandingHost(raw) {
|
|
1410
1423
|
let host = raw.trim().toLowerCase();
|
|
@@ -1419,17 +1432,206 @@ function normalizeBrandingHost(raw) {
|
|
|
1419
1432
|
}
|
|
1420
1433
|
return host.replace(/\.+$/, "");
|
|
1421
1434
|
}
|
|
1435
|
+
|
|
1436
|
+
// src/PlatformBrandingCss.ts
|
|
1437
|
+
var MAX_CUSTOM_CSS_LENGTH = 65536;
|
|
1438
|
+
var IDENTIFIER_CHAR = /[A-Za-z0-9_-]/;
|
|
1439
|
+
function skipQuoted(css, start) {
|
|
1440
|
+
const quote = css[start];
|
|
1441
|
+
let index = start + 1;
|
|
1442
|
+
while (index < css.length) {
|
|
1443
|
+
if (css[index] === "\\") {
|
|
1444
|
+
index += 2;
|
|
1445
|
+
continue;
|
|
1446
|
+
}
|
|
1447
|
+
if (css[index] === quote) return index + 1;
|
|
1448
|
+
index += 1;
|
|
1449
|
+
}
|
|
1450
|
+
return css.length;
|
|
1451
|
+
}
|
|
1452
|
+
function decodeCssEscapeAt(css, index) {
|
|
1453
|
+
let cursor = index + 1;
|
|
1454
|
+
if (cursor >= css.length) return { value: "", next: cursor };
|
|
1455
|
+
const escaped = css[cursor];
|
|
1456
|
+
if (escaped === "\n" || escaped === "\f" || escaped === "\r") {
|
|
1457
|
+
if (escaped === "\r" && css[cursor + 1] === "\n") cursor += 1;
|
|
1458
|
+
return { value: "", next: cursor + 1 };
|
|
1459
|
+
}
|
|
1460
|
+
const hex = /^[0-9a-fA-F]{1,6}/.exec(css.slice(cursor));
|
|
1461
|
+
if (hex) {
|
|
1462
|
+
cursor += hex[0].length;
|
|
1463
|
+
if (cursor < css.length && /\s/.test(css[cursor])) {
|
|
1464
|
+
if (css[cursor] === "\r" && css[cursor + 1] === "\n") cursor += 1;
|
|
1465
|
+
cursor += 1;
|
|
1466
|
+
}
|
|
1467
|
+
const codePoint = Number.parseInt(hex[0], 16);
|
|
1468
|
+
if (codePoint === 0 || codePoint > 1114111 || codePoint >= 55296 && codePoint <= 57343) {
|
|
1469
|
+
return { value: "\uFFFD", next: cursor };
|
|
1470
|
+
}
|
|
1471
|
+
return { value: String.fromCodePoint(codePoint), next: cursor };
|
|
1472
|
+
}
|
|
1473
|
+
return { value: escaped, next: cursor + 1 };
|
|
1474
|
+
}
|
|
1475
|
+
function readDecodedIdentifier(css, start) {
|
|
1476
|
+
let value = "";
|
|
1477
|
+
let index = start;
|
|
1478
|
+
let consumed = false;
|
|
1479
|
+
while (index < css.length) {
|
|
1480
|
+
const current = css[index];
|
|
1481
|
+
if (current === "\\") {
|
|
1482
|
+
const decoded = decodeCssEscapeAt(css, index);
|
|
1483
|
+
value += decoded.value;
|
|
1484
|
+
index = decoded.next;
|
|
1485
|
+
consumed = true;
|
|
1486
|
+
continue;
|
|
1487
|
+
}
|
|
1488
|
+
if (!IDENTIFIER_CHAR.test(current) && current.charCodeAt(0) < 128) break;
|
|
1489
|
+
value += current;
|
|
1490
|
+
index += 1;
|
|
1491
|
+
consumed = true;
|
|
1492
|
+
}
|
|
1493
|
+
return consumed ? { value, next: index } : null;
|
|
1494
|
+
}
|
|
1495
|
+
function matchUrlToken(css, start) {
|
|
1496
|
+
if (start > 0 && IDENTIFIER_CHAR.test(css[start - 1])) return null;
|
|
1497
|
+
const identifier = readDecodedIdentifier(css, start);
|
|
1498
|
+
if (!identifier || identifier.value.toLowerCase() !== "url") return null;
|
|
1499
|
+
let index = identifier.next;
|
|
1500
|
+
while (index < css.length && /\s/.test(css[index])) index += 1;
|
|
1501
|
+
if (css[index] !== "(") return null;
|
|
1502
|
+
return index + 1;
|
|
1503
|
+
}
|
|
1504
|
+
function skipUrlContents(css, start) {
|
|
1505
|
+
let index = start;
|
|
1506
|
+
while (index < css.length && /\s/.test(css[index])) index += 1;
|
|
1507
|
+
if (css[index] === '"' || css[index] === "'") {
|
|
1508
|
+
index = skipQuoted(css, index);
|
|
1509
|
+
while (index < css.length && /\s/.test(css[index])) index += 1;
|
|
1510
|
+
if (css[index] !== ")") return null;
|
|
1511
|
+
return index + 1;
|
|
1512
|
+
}
|
|
1513
|
+
const end = css.indexOf(")", index);
|
|
1514
|
+
return end === -1 ? null : end + 1;
|
|
1515
|
+
}
|
|
1516
|
+
function stripCssForImportScan(css) {
|
|
1517
|
+
let out = "";
|
|
1518
|
+
let index = 0;
|
|
1519
|
+
while (index < css.length) {
|
|
1520
|
+
const current = css[index];
|
|
1521
|
+
const next = css[index + 1];
|
|
1522
|
+
if (current === "/" && next === "*") {
|
|
1523
|
+
const end = css.indexOf("*/", index + 2);
|
|
1524
|
+
index = end === -1 ? css.length : end + 2;
|
|
1525
|
+
out += " ";
|
|
1526
|
+
continue;
|
|
1527
|
+
}
|
|
1528
|
+
if (current === '"' || current === "'") {
|
|
1529
|
+
index = skipQuoted(css, index);
|
|
1530
|
+
continue;
|
|
1531
|
+
}
|
|
1532
|
+
const urlContentStart = matchUrlToken(css, index);
|
|
1533
|
+
if (urlContentStart !== null) {
|
|
1534
|
+
const urlEnd = skipUrlContents(css, urlContentStart);
|
|
1535
|
+
if (urlEnd !== null) {
|
|
1536
|
+
index = urlEnd;
|
|
1537
|
+
out += "url()";
|
|
1538
|
+
continue;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
out += current;
|
|
1542
|
+
index += 1;
|
|
1543
|
+
}
|
|
1544
|
+
return out;
|
|
1545
|
+
}
|
|
1546
|
+
function decodeCssEscapes(css) {
|
|
1547
|
+
let out = "";
|
|
1548
|
+
let index = 0;
|
|
1549
|
+
while (index < css.length) {
|
|
1550
|
+
const current = css[index];
|
|
1551
|
+
if (current !== "\\") {
|
|
1552
|
+
out += current;
|
|
1553
|
+
index += 1;
|
|
1554
|
+
continue;
|
|
1555
|
+
}
|
|
1556
|
+
const decoded = decodeCssEscapeAt(css, index);
|
|
1557
|
+
out += decoded.value;
|
|
1558
|
+
index = decoded.next;
|
|
1559
|
+
}
|
|
1560
|
+
return out;
|
|
1561
|
+
}
|
|
1562
|
+
function hasCssImport(css) {
|
|
1563
|
+
const stripped = stripCssForImportScan(css);
|
|
1564
|
+
return /@import\b/i.test(decodeCssEscapes(stripped));
|
|
1565
|
+
}
|
|
1566
|
+
function hasStyleBreakout(css) {
|
|
1567
|
+
return /<\/style/i.test(css);
|
|
1568
|
+
}
|
|
1569
|
+
function validateCustomCss(value) {
|
|
1570
|
+
if (typeof value !== "string" || value.length > MAX_CUSTOM_CSS_LENGTH) {
|
|
1571
|
+
return { ok: false, reason: "length" };
|
|
1572
|
+
}
|
|
1573
|
+
if (hasCssImport(value)) return { ok: false, reason: "import" };
|
|
1574
|
+
if (hasStyleBreakout(value)) return { ok: false, reason: "breakout" };
|
|
1575
|
+
return { ok: true };
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
// src/AuthCssContract.ts
|
|
1579
|
+
var AUTH_CSS_CONTRACT_PARTS = [
|
|
1580
|
+
"page",
|
|
1581
|
+
"card",
|
|
1582
|
+
"header",
|
|
1583
|
+
"logo",
|
|
1584
|
+
"logo-image",
|
|
1585
|
+
"title",
|
|
1586
|
+
"subtitle",
|
|
1587
|
+
"form",
|
|
1588
|
+
"field",
|
|
1589
|
+
"input",
|
|
1590
|
+
"submit",
|
|
1591
|
+
"sso",
|
|
1592
|
+
"sso-button",
|
|
1593
|
+
"alert",
|
|
1594
|
+
"footer",
|
|
1595
|
+
"link",
|
|
1596
|
+
"cancel",
|
|
1597
|
+
"tenant-list",
|
|
1598
|
+
"tenant-card",
|
|
1599
|
+
"tenant-search",
|
|
1600
|
+
"tenant-footer",
|
|
1601
|
+
"invite-notice"
|
|
1602
|
+
];
|
|
1603
|
+
var AUTH_CSS_CONTRACT_VARIABLES = [
|
|
1604
|
+
"--axiom-auth-primary",
|
|
1605
|
+
"--axiom-auth-primary-hover",
|
|
1606
|
+
"--axiom-auth-primary-active",
|
|
1607
|
+
"--axiom-auth-bg",
|
|
1608
|
+
"--axiom-auth-surface",
|
|
1609
|
+
"--axiom-auth-text",
|
|
1610
|
+
"--axiom-auth-text-secondary",
|
|
1611
|
+
"--axiom-auth-border",
|
|
1612
|
+
"--axiom-auth-radius",
|
|
1613
|
+
"--axiom-auth-page-padding",
|
|
1614
|
+
"--axiom-auth-card-width",
|
|
1615
|
+
"--axiom-auth-card-padding",
|
|
1616
|
+
"--axiom-auth-card-shadow",
|
|
1617
|
+
"--axiom-auth-card-shadow-hover",
|
|
1618
|
+
"--axiom-auth-logo-size",
|
|
1619
|
+
"--axiom-auth-input-height"
|
|
1620
|
+
];
|
|
1422
1621
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1423
1622
|
0 && (module.exports = {
|
|
1424
1623
|
AFFINITY_ECHO_HEADER,
|
|
1425
1624
|
AFFINITY_MISS_CODE,
|
|
1426
1625
|
AGENT_AFFINITY_HEADER,
|
|
1427
1626
|
ASR_DEFAULT_KEY,
|
|
1627
|
+
AUTH_CSS_CONTRACT_PARTS,
|
|
1628
|
+
AUTH_CSS_CONTRACT_VARIABLES,
|
|
1428
1629
|
AgentType,
|
|
1429
1630
|
AuthError,
|
|
1430
1631
|
CHANNEL_REPLY_JOB_LIST_LIMIT_DEFAULT,
|
|
1431
1632
|
CHANNEL_REPLY_JOB_LIST_LIMIT_MAX,
|
|
1432
1633
|
CHANNEL_REPLY_JOB_LIST_LIMIT_MIN,
|
|
1634
|
+
COLLECTION_ENTRY_BATCH_MAX,
|
|
1433
1635
|
ChannelBindingMigrationConflictError,
|
|
1434
1636
|
DEFAULT_MODEL_KEY,
|
|
1435
1637
|
DEFAULT_PLATFORM_BRANDING,
|
|
@@ -1443,6 +1645,7 @@ function normalizeBrandingHost(raw) {
|
|
|
1443
1645
|
InvalidProjectCapabilityBundleConfigError,
|
|
1444
1646
|
LANGFUSE_OBSERVABILITY_DASHBOARD_VERSION,
|
|
1445
1647
|
LoggerType,
|
|
1648
|
+
MAX_CUSTOM_CSS_LENGTH,
|
|
1446
1649
|
MAX_PENDING_EXECUTION_RESULTS_LIMIT,
|
|
1447
1650
|
McpMessageType,
|
|
1448
1651
|
MemoryType,
|
|
@@ -1489,6 +1692,8 @@ function normalizeBrandingHost(raw) {
|
|
|
1489
1692
|
firstNonEmptyString,
|
|
1490
1693
|
getSubAgentsFromConfig,
|
|
1491
1694
|
getToolsFromConfig,
|
|
1695
|
+
hasCssImport,
|
|
1696
|
+
hasStyleBreakout,
|
|
1492
1697
|
hasTools,
|
|
1493
1698
|
interruptAnswerKeySchema,
|
|
1494
1699
|
isA2ARemoteAgentConfig,
|
|
@@ -1533,6 +1738,7 @@ function normalizeBrandingHost(raw) {
|
|
|
1533
1738
|
toModelKey,
|
|
1534
1739
|
toProjectRoomPublicBotMembership,
|
|
1535
1740
|
toProjectRoomPublicMembership,
|
|
1536
|
-
toProjectRoomPublicMessage
|
|
1741
|
+
toProjectRoomPublicMessage,
|
|
1742
|
+
validateCustomCss
|
|
1537
1743
|
});
|
|
1538
1744
|
//# sourceMappingURL=index.js.map
|