feat: release v1.0.0

This commit is contained in:
chrishuan
2026-06-09 15:28:05 +08:00
parent bc1575a0da
commit 9b7dbdd7b2
83 changed files with 7737 additions and 335 deletions
+29
View File
@@ -0,0 +1,29 @@
/**
* Offload Session Utilities — unified sessionId sanitization.
*
* sessionId: opaque identifier from client (free format, e.g. "main:main", "coding:session-001")
* sanitizedSessionId: filesystem-safe version used for:
* - File/directory paths (offload/{sanitizedSessionId}/)
* - Distributed lock keys
* - Task queue session identifiers
*
* Conversion: replace all non-alphanumeric/dot/hyphen/underscore chars with "_"
*/
/**
* Convert a raw sessionId to a filesystem-safe string.
* Replaces colons and other unsafe characters with underscores.
*/
export function sanitizeSessionId(sessionId: string): string {
return sessionId.replace(/[^a-zA-Z0-9._\-]/g, "_");
}
/**
* Build the offload storage base path for a session.
*/
export function buildOffloadBasePath(sessionId: string): string {
return `offload/${sanitizeSessionId(sessionId)}`;
}
// Legacy compat: keep old name as alias (will remove after all callers migrated)
export const toSessionId = sanitizeSessionId;