@langchain/langgraph-sdk
Version:
Client library for interacting with the LangGraph API
54 lines (53 loc) • 1.63 kB
JavaScript
require("./constants.cjs");
//#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
exports.isConcreteToolNamespace = isConcreteToolNamespace;
exports.isInternalWorkNamespace = isInternalWorkNamespace;
exports.isLegacySubagentNamespace = isLegacySubagentNamespace;
exports.isRootNamespace = isRootNamespace;
exports.isToolNamespaceSegment = isToolNamespaceSegment;
exports.namespaceKey = namespaceKey;
//# sourceMappingURL=namespace.cjs.map