§
    ÛŽ’jD  ã                   ór   — U d Z ddlmZ dZdZdZdZdZdZ	d	Z
d
ZdZdZeedf         ed<   defd„Zdefd„ZdS )a‘  Host-side helpers shared by workspace implementations.

Constants for the standard workspace layout, plus pure functions for
detecting the local ``agentscope`` version and reading scripts bundled
with the package. No Docker / E2B SDK dependency lives here.

This module is internal to ``agentscope.workspace``. Public-sounding
constants are shared within the package, not exported as user-facing
API.
é    NuF  <workspace>You have access to a {backend} workspace at {workdir} with the following structure:

```
{workdir}
â”œâ”€â”€ data/        # offloaded multimodal files (images, etc.) â€” system-managed
â”œâ”€â”€ skills/      # reusable skills, each in its own subdirectory
â””â”€â”€ sessions/    # offloaded session context and tool results â€” system-managed
```

This workspace is your personal working environment. You are responsible for keeping it clean, structured, and easy to navigate over time.

### Project Directory
- Create a dedicated subdirectory for each task or project under the workspace root.
- Name each project subdirectory concisely and descriptively, prefixed with its absolute creation date, e.g. `20240315_web-scraper`, so it stays identifiable long after creation.
- Always create a `README.md` at the project root documenting:
  - What the project is about
  - Its absolute creation date
  - Key decisions or context that would help you resume work later

### Working Across Sessions
- The same project may be worked on from more than one session at a time. There is no live lock that tells you another session is editing a file â€” avoid conflicts by isolation, not by hoping:
  - Prefer `git worktree` with a session-specific name so parallel work happens on separate trees and never shares the same files.
  - Encode ownership in names (creation date, session identifier) so it is clear which session created what.
- Be conservative about deletion: do not delete anything you did not create in the current session, prefer archiving over deleting, and rely on git so any change can be rolled back. Confirm before destructive cleanup.

### Scratch / Temporary Files
- Put one-off experiments, intermediate data, and anything you would otherwise drop in `/tmp` under a `scratch/` directory (created on first use), not inside project directories â€” this keeps projects and their git history clean.
- Treat `scratch/` as disposable: exclude it from git, and assume nothing in it is guaranteed to persist. Nothing clears it automatically (it lives inside your persistent workspace, not the OS temp dir), so delete your own scratch files when you are done with them.

### Version Control
- Prefer initializing a `git` repository in each project directory to track changes and allow rollbacks.
- If you use git, create a `.gitignore` before the first commit to exclude unwanted files (e.g. virtual environments, cache, `scratch/`, secrets).
- Never hard-code secrets into project files or commit them â€” this is a personal environment, but treat credentials as if they could leak.

### Python Environment
- `uv` is recommended for managing and isolating Python environments per project:
```shell
uv venv && uv pip install ...
- Never install packages into a shared or global environment â€” each project must manage its own dependencies to avoid conflicts.</workspace>ÚdataÚskillsÚsessionsz.mcpz.venvzgateway.logú_mcp_gateway_app.pyú_glob_helper.py)z	mcp<2.0.0ÚuvicornÚfastapiÚhttpx.Ú_GATEWAY_BASE_REQUIREMENTSÚreturnc                  ót   — t          j        d¦  «                             d¦  «                             ¦   «         S )at  Read the standalone gateway script as bytes via ``importlib.resources``.

    The script ships at
    ``agentscope/workspace/_mcp_gateway/_mcp_gateway_app.py``. Both
    backends copy it to a fixed in-container / in-sandbox path so the
    launch command can invoke it directly, avoiding ``python -m`` and
    the heavy ``agentscope.workspace.__init__`` import graph.
    z!agentscope.workspace._mcp_gatewayr   ©Ú_resÚfilesÚjoinpathÚ
read_bytes© ó    úIC:\Projects\DSCons\.venv\Lib\site-packages\agentscope\workspace\_utils.pyÚ_read_gateway_script_bytesr   u   s.   € õ 	Œ
Ð6Ñ7Ô7ß	ŠÐ'Ñ	(Ô	(ß	Š‰Œðr   c                  ót   — t          j        d¦  «                             d¦  «                             ¦   «         S )an  Read the standalone glob helper script as bytes.

    The script ships at
    ``agentscope/tool/_builtin/_scripts/_glob_helper.py``. Both Docker
    and E2B backends copy it into the workspace so the :class:`Glob`
    tool can invoke it uniformly via ``exec_shell``.

    Returns:
        `bytes`:
            The raw contents of the ``_glob_helper.py`` script.
    z!agentscope.tool._builtin._scriptsr   r   r   r   r   Ú_read_glob_helper_bytesr   ˆ   s.   € õ 	Œ
Ð6Ñ7Ô7ß	ŠÐ#Ñ	$Ô	$ß	Š‰Œðr   )Ú__doc__Úimportlib.resourcesÚ	resourcesr   ÚDEFAULT_WORKSPACE_INSTRUCTIONSÚDEFAULT_DATA_DIRÚDEFAULT_SKILLS_DIRÚDEFAULT_SESSIONS_DIRÚDEFAULT_MCP_FILEÚDEFAULT_GATEWAY_VENVÚDEFAULT_GATEWAY_LOGÚDEFAULT_GATEWAY_SCRIPTÚDEFAULT_GLOB_HELPER_SCRIPTr   ÚtupleÚstrÚ__annotations__Úbytesr   r   r   r   r   ú<module>r)      sË   ðð	ð 	ð 	ð #Ð "Ð "Ð "Ð "Ð "ð
<"DÐ ð~ Ð ð Ð ð "Ð ð Ð àÐ Ø#Ð Ø.Ð Ø.Ð ð/Ð ˜E # s (œOð ð ñ ð Eð ð ð ð ð& ð ð ð ð ð ð r   