@yeaft/webchat-agent 0.1.900 → 0.1.902
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/package.json
CHANGED
|
@@ -78,9 +78,10 @@ export class AmsRegistry {
|
|
|
78
78
|
/**
|
|
79
79
|
* Resolve the on-disk path for a group's ams.json.
|
|
80
80
|
*
|
|
81
|
-
* `sessionId` is trusted: `nextSessionId()` (
|
|
82
|
-
* `grp_[a-z0-9_-]
|
|
83
|
-
* `DEFAULT_GROUP_KEY`. No defensive
|
|
81
|
+
* `sessionId` is trusted: `nextSessionId()` (sessions/ids.js) emits ids matching
|
|
82
|
+
* `grp_[a-z0-9_-]+_[0-9A-HJKMNP-TV-Z]{8}` (slug + 8-char crockford suffix),
|
|
83
|
+
* and the single-VP path uses the literal `DEFAULT_GROUP_KEY`. No defensive
|
|
84
|
+
* escaping is needed.
|
|
84
85
|
*
|
|
85
86
|
* @param {string} sessionId
|
|
86
87
|
* @returns {string}
|
package/yeaft/sessions/ids.js
CHANGED
|
@@ -38,9 +38,15 @@ export function nextMsgId() {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function nextSessionId(slug = 'default') {
|
|
41
|
-
// Slug-tolerant: lowercase a-z0-9_- only
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
// Slug-tolerant: lowercase a-z0-9_- only, capped at 24 chars so the
|
|
42
|
+
// total id stays compact after the suffix is appended.
|
|
43
|
+
const safe = String(slug).toLowerCase().replace(/[^a-z0-9_-]+/g, '-').slice(0, 24) || 'group';
|
|
44
|
+
// Append 8 crockford-base32 chars (~40 bits) so re-creating a session
|
|
45
|
+
// with the same display name yields a fresh id instead of throwing
|
|
46
|
+
// `duplicate` on the existsSync check in session-crud.js. The
|
|
47
|
+
// `duplicate` branch is now a true defensive guard rather than the
|
|
48
|
+
// first-collision footgun it used to be.
|
|
49
|
+
return `grp_${safe}_${randEncoded(8)}`;
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
/**
|