# DARKOZA Solution Capsule — DSC v1

DSC is a portable, content-addressed ZIP package. It separates private DARKOZA implementation from public solution definitions.

## Archive layout

Exactly four members are accepted:

```text
manifest.json
solution.json
tests.json
README.md
```

Names must be flat relative filenames. Directories, duplicate entries, symbolic links, hard links, traversal paths, encrypted entries, additional files, and oversized members are rejected.

## Manifest

`manifest.json` is canonical UTF-8 JSON (sorted keys, compact separators, one trailing newline). It declares the package identity, runtime, capabilities, empty permissions, and SHA-256 plus byte size for each content file.

- Schema: `darkoza.solution-package/v1`
- Runtime: `darkoza.declarative/1`
- ID: `community.<publisher>.<solution-slug>`
- Version: semantic version `MAJOR.MINOR.PATCH`
- Entrypoint: `solution.json`
- Permissions: exactly `[]`
- File table: exactly `solution.json`, `tests.json`, and `README.md`

The SHA-256 digest detects byte changes. It does **not** prove author identity, publisher authorization, safety, truth, or endorsement.

## Solution

Example:

```json
{
  "schema": "darkoza.solution/v1",
  "inputs": {
    "name": {"type": "string", "required": true, "max_length": 120}
  },
  "steps": [
    {
      "id": "greeting",
      "op": "text.concat",
      "parts": [
        {"literal": "Hello, "},
        {"input": "name"},
        {"literal": "!"}
      ]
    }
  ],
  "output": {"step": "greeting"}
}
```

Input types are `string`, `number`, `boolean`, `object`, and `array`. Every field is type-checked; undeclared inputs are rejected. The interpreter bounds JSON depth, item count, string length, package size, number of steps, and output size.

A step ID must be unique. Steps execute in order. A reference can point only to an input or a previously declared step. This makes the graph acyclic without evaluating expressions.

## Tests

`tests.json` uses schema `darkoza.solution-tests/v1` and contains named input/expected-output cases. All test inputs are checked against the solution input schema. A local install is refused when any included test fails.

## Current capability allowlist

- `text.concat`
- `text.replace`
- `json.pick`
- `json.set`

The manifest capability list must exactly match the operations in the solution. A package cannot add permissions or register new operations.

## Local installation semantics

The installer verifies the complete package and all tests, stores an immutable copy under the selected user-owned root, and atomically switches a JSON pointer to the installed version. The package archive, files, manifest, and content digest are retained so rollback can re-verify the prior version before switching.

Local installation does not alter a hosted DARKOZA account, a production service, Caddy, a public route, or a private source tree.
