Forked clean from public hackathon repo (Starfire-AgentTeam, BSL 1.1) with full rebrand to Molecule AI under github.com/Molecule-AI/molecule-monorepo. Brand: Starfire → Molecule AI. Slug: starfire / agent-molecule → molecule. Env vars: STARFIRE_* → MOLECULE_*. Go module: github.com/agent-molecule/platform → github.com/Molecule-AI/molecule-monorepo/platform. Python packages: starfire_plugin → molecule_plugin, starfire_agent → molecule_agent. DB: agentmolecule → molecule. History truncated; see public repo for prior commits and contributor attribution. Verified green: go test -race ./... (platform), pytest (workspace-template 1129 + sdk 132), vitest (canvas 352), build (mcp). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
19 lines
665 B
Python
19 lines
665 B
Python
"""Canonical namespace helpers for workspace-scoped resources."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
def workspace_awareness_namespace(workspace_id: str) -> str:
|
|
"""Return the default awareness namespace for a workspace."""
|
|
workspace_id = workspace_id.strip()
|
|
return f"workspace:{workspace_id}" if workspace_id else "workspace:unknown"
|
|
|
|
|
|
def resolve_awareness_namespace(
|
|
workspace_id: str,
|
|
configured_namespace: str | None = None,
|
|
) -> str:
|
|
"""Return the configured namespace, or the workspace default when unset."""
|
|
namespace = (configured_namespace or "").strip()
|
|
return namespace or workspace_awareness_namespace(workspace_id)
|