# `H.WorkspaceLease`
[🔗](https://github.com/parlant/harness/blob/v0.3.0/lib/h/workspace_lease.ex#L1)

Coordinates per-workspace mutating tool leases by `{env_id, canonical_cwd}`
so concurrent coding runs do not clobber the same working tree while keeping
separate execution environments isolated.

# `holder_key`

```elixir
@type holder_key() :: term()
```

# `server`

```elixir
@type server() :: GenServer.server()
```

# `workspace_key`

```elixir
@type workspace_key() :: {env_id :: String.t(), cwd :: String.t()} | String.t()
```

# `acquire`

```elixir
@spec acquire(server(), workspace_key(), holder_key(), pid()) ::
  :ok | {:error, {:workspace_busy, holder_key()}}
```

# `acquire_or_wait`

```elixir
@spec acquire_or_wait(server(), workspace_key(), holder_key(), pid(), reference()) ::
  :ok | {:waiting, holder_key(), String.t()}
```

Acquires immediately or queues a monitored waiter for a reserved, signalled handoff.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `current?`

# `release`

```elixir
@spec release(server(), workspace_key(), holder_key()) :: :ok
```

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

# `stop_holder`

Requests cancellation by the current owner; never forcibly clears a live lease.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
