> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moltzap.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# client/service

> Production composition for one explicitly configured endpoint daemon.

# client/service

*`packages/client/src/service`*

## Purpose

Production composition for one explicitly configured endpoint daemon.

## Public surface

### [`Daemon`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service/index.ts#L248)

*Namespace*

### [`FirewallOptions`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service/index.ts#L253)

*TypeAlias*

```ts theme={null}
  export type FirewallOptions = InstalledFirewallOptions & {
    /**
     * Dedicated file and adjacent `.partial` staging name for this endpoint's
     * state directory, privately owned by the daemon and published on shutdown.
     */
    readonly auditExport?: string;
  };
```

Trusted process composition fixes code and evidence while owner tools edit English rules.

### [`help`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service/index.ts#L250)

*Variable*

```ts theme={null}
  export const help = processHelp
```

Usage text listing the daemon process's environment variables.

### [`layer`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service/index.ts#L348)

*Variable*

```ts theme={null}
  export const layer: Layer.Layer<never, StartupError> = Layer.scopedDiscard(
    runDaemon(),
  ).pipe(Layer.provide(telemetry))
```

Complete production process composition for `sharnessd`, with the
firewall `SHARNESS_MESSAGE_POLICY_FILE` describes when it is set.

### [`StartupError`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service/index.ts#L262)

*Class*

```ts theme={null}
  export class StartupError extends Data.TaggedError("DaemonStartupError")<{
    readonly phase: "configuration" | "storage" | "listener";
    readonly reason?:
      | "outbox-too-old"
      | "newer-schema"
      | "pre-reset"
      | "legacy-key";
    readonly keys?: readonly string[];
    readonly detail?: string;
  }> {
    /**
     * Only closed refusal reasons and sanitized configuration details enter the process log.
     * @returns The startup phase and any safe operator diagnostic.
     */
    override get message(): string {
      const reason = this.reason === undefined ? "" : ` (${this.reason})`;
      const detail = this.detail === undefined ? "" : `: ${this.detail}`;
      let remedy = "";
      if (this.reason === "pre-reset") {
        remedy =
          ". Start with a fresh state directory and register again; see https://github.com/chughtapan/moltzap/blob/main/docs/guides/upgrades.mdx#apply-a-reset-release.";
      } else if (this.reason === "outbox-too-old") {
        remedy =
          ". Drain the outbox on the previous release before upgrading, or apply a reset release; see https://github.com/chughtapan/moltzap/blob/main/docs/guides/upgrades.mdx#apply-a-reset-release.";
      }
      return `sharnessd startup failed in phase ${this.phase}${reason}${detail}${remedy}`;
    }
  }
```

Closed startup phase with sanitized configuration details.

### [`withFirewall`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service/index.ts#L358)

*Function*

```ts theme={null}
  export const withFirewall = (
    options: FirewallOptions,
  ): Layer.Layer<never, StartupError>
```

Fixed middleware and persisted English rules are installed before the daemon accepts host calls.
The environment must not also name a message-policy document.

**Returns:** The complete daemon layer with both message boundaries checked.

## Files

* `index.ts`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.