# jackin-instance (https://jackin.tailrocks.com/reference/crates/jackin-instance/)



{/* GENERATED from crates/jackin-instance/README.md — edit the README, not this file */}

Role instance lifecycle: the instance index, the per-role state directory, auth provisioning, and container naming. An "instance" is the on-disk + in-Docker state for a single running (or restorable) role session.

## What this crate owns [#what-this-crate-owns]

* The instance index and lifecycle (`lib`, `tests`), role-state directory management, and container naming (`naming`).
* Auth provisioning for an instance (`auth`) and the instance's view of its manifest (`manifest`).

## Architecture tier and allowed dependencies [#architecture-tier-and-allowed-dependencies]

**L1 application.** Allowed workspace dependencies: `jackin-core`, `jackin-config`, `jackin-manifest`, `jackin-diagnostics`. No presentation or runtime dependencies — instance lifecycle stays a domain/app concern above the leaf and below orchestration.

## Structure [#structure]

| Module                                                                                                                                                            | Owns                       | Tests                                                                               |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | ----------------------------------------------------------------------------------- |
| <RepoFile path="crates/jackin-instance/src/lib.rs">`lib.rs`</RepoFile>                                                                                            | instance index + lifecycle | —                                                                                   |
| <RepoFile path="crates/jackin-instance/src/auth.rs">`auth.rs`</RepoFile> · <RepoFile path="crates/jackin-instance/src/auth.rs">`auth/`</RepoFile>                 | auth provisioning          | <RepoFile path="crates/jackin-instance/src/auth/tests.rs">`tests.rs`</RepoFile>     |
| <RepoFile path="crates/jackin-instance/src/manifest.rs">`manifest.rs`</RepoFile> · <RepoFile path="crates/jackin-instance/src/manifest.rs">`manifest/`</RepoFile> | instance manifest view     | <RepoFile path="crates/jackin-instance/src/manifest/tests.rs">`tests.rs`</RepoFile> |
| <RepoFile path="crates/jackin-instance/src/naming.rs">`naming.rs`</RepoFile> · <RepoFile path="crates/jackin-instance/src/naming.rs">`naming/`</RepoFile>         | container/instance naming  | <RepoFile path="crates/jackin-instance/src/naming/tests.rs">`tests.rs`</RepoFile>   |
| <RepoFile path="crates/jackin-instance/src/tests.rs">`tests.rs`</RepoFile>                                                                                        | integration tests          | —                                                                                   |

## Public API [#public-api]

Instance identity, the role-state directory contract, and naming used by `jackin-runtime`, `jackin-isolation`, and the host CLI. Naming is shared with the capsule side via `jackin-protocol`.

Typed errors: <RepoFile path="crates/jackin-instance/src/error.rs">`InstanceError`</RepoFile> (index/auth join/manifest agent) and
<RepoFile path="crates/jackin-instance/src/error.rs">`SyncSourceValidationError`</RepoFile> (sync-source folder checks).

## How to verify [#how-to-verify]

```sh
cargo nextest run -p jackin-instance
cargo clippy -p jackin-instance --all-targets -- -D warnings
```
