Provides constants, type guards, and parsing logic for validating and handling session source metadata used to attribute AI sessions and scheduled task runs.
// Source: https://github.com/QwenLM/qwen-code | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
export interface SessionSourceMetadata {
sourceType?: string;
sourceId?: string;
}
export const SESSION_SOURCE_META_KEY = 'qwen.session.source';
export const SESSION_SOURCE_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
export const MAX_SESSION_SOURCE_ID_LENGTH = 256;
export const STANDALONE_SESSION_SOURCE_TYPE = 'standalone';
export const DAEMON_OWNED_STANDALONE_CREATION_KEY =
'daemonOwnedStandaloneCreation';
export function isReservedStandaloneSessionSourceType(
sourceType: unknown,
): sourceType is typeof STANDALONE_SESSION_SOURCE_TYPE {
return sourceType === STANDALONE_SESSION
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key