@langchain/langgraph-sdk
Version:
Client library for interacting with the LangGraph API
49 lines (48 loc) • 1.45 kB
JavaScript
import "./constants.js";
//#region src/stream/namespace.ts
/**
* Stable string key for a protocol namespace tuple.
*/
function namespaceKey(namespace) {
return namespace.join("\0");
}
/**
* True when an event is scoped to the root namespace.
*/
function isRootNamespace(namespace) {
return namespace.length === 0;
}
/**
* True when a namespace segment points at a tool execution namespace.
*/
function isToolNamespaceSegment(segment) {
return segment.startsWith("tools:");
}
/**
* True when a namespace segment points at a legacy task/subagent namespace.
*/
function isTaskNamespaceSegment(segment) {
return segment.startsWith("task:");
}
/**
* True when a namespace belongs to tool/subagent-internal work.
*/
function isInternalWorkNamespace(namespace) {
return namespace.some((segment) => isTaskNamespaceSegment(segment) || isToolNamespaceSegment(segment));
}
/**
* True when a namespace includes the legacy task/subagent convention.
*/
function isLegacySubagentNamespace(namespace) {
return namespace.some(isTaskNamespaceSegment);
}
/**
* True when the namespace itself is a concrete tool execution namespace.
*/
function isConcreteToolNamespace(namespace) {
const last = namespace.at(-1);
return last != null && isToolNamespaceSegment(last);
}
//#endregion
export { isConcreteToolNamespace, isInternalWorkNamespace, isLegacySubagentNamespace, isRootNamespace, isToolNamespaceSegment, namespaceKey };
//# sourceMappingURL=namespace.js.map