{"version":3,"file":"namespace.cjs","names":[],"sources":["../../src/stream/namespace.ts"],"sourcesContent":["import { NAMESPACE_SEPARATOR } from \"./constants.js\";\n\n/**\n * Stable string key for a protocol namespace tuple.\n */\nexport function namespaceKey(namespace: readonly string[]): string {\n  return namespace.join(NAMESPACE_SEPARATOR);\n}\n\n/**\n * True when an event is scoped to the root namespace.\n */\nexport function isRootNamespace(namespace: readonly string[]): boolean {\n  return namespace.length === 0;\n}\n\n/**\n * True when a namespace segment points at a tool execution namespace.\n */\nexport function isToolNamespaceSegment(segment: string): boolean {\n  return segment.startsWith(\"tools:\");\n}\n\n/**\n * True when a namespace segment points at a legacy task/subagent namespace.\n */\nexport function isTaskNamespaceSegment(segment: string): boolean {\n  return segment.startsWith(\"task:\");\n}\n\n/**\n * True when a namespace belongs to tool/subagent-internal work.\n */\nexport function isInternalWorkNamespace(namespace: readonly string[]): boolean {\n  return namespace.some(\n    (segment) =>\n      isTaskNamespaceSegment(segment) || isToolNamespaceSegment(segment)\n  );\n}\n\n/**\n * True when a namespace includes the legacy task/subagent convention.\n */\nexport function isLegacySubagentNamespace(\n  namespace: readonly string[]\n): boolean {\n  return namespace.some(isTaskNamespaceSegment);\n}\n\n/**\n * True when the namespace itself is a concrete tool execution namespace.\n */\nexport function isConcreteToolNamespace(namespace: readonly string[]): boolean {\n  const last = namespace.at(-1);\n  return last != null && isToolNamespaceSegment(last);\n}\n"],"mappings":";;;;;AAKA,SAAgB,aAAa,WAAsC;AACjE,QAAO,UAAU,KAAA,KAAyB;;;;;AAM5C,SAAgB,gBAAgB,WAAuC;AACrE,QAAO,UAAU,WAAW;;;;;AAM9B,SAAgB,uBAAuB,SAA0B;AAC/D,QAAO,QAAQ,WAAW,SAAS;;;;;AAMrC,SAAgB,uBAAuB,SAA0B;AAC/D,QAAO,QAAQ,WAAW,QAAQ;;;;;AAMpC,SAAgB,wBAAwB,WAAuC;AAC7E,QAAO,UAAU,MACd,YACC,uBAAuB,QAAQ,IAAI,uBAAuB,QAAQ,CACrE;;;;;AAMH,SAAgB,0BACd,WACS;AACT,QAAO,UAAU,KAAK,uBAAuB;;;;;AAM/C,SAAgB,wBAAwB,WAAuC;CAC7E,MAAM,OAAO,UAAU,GAAG,GAAG;AAC7B,QAAO,QAAQ,QAAQ,uBAAuB,KAAK"}