Config

Keys live under terret. listen is http or stdio. policy is Closed, Inherit, or Clamp. Clamp reads allow as permission names. Closed and Inherit ignore allow.

harness is grok or dsh. The default is grok. An unset command follows the harness. profile belongs to dsh and defaults to headless. A profile on grok is rejected. transport (Cli, AcpStdio, or AcpWebSocket), approval (Ask or Always), and the bind triple belong to grok. Setting them on dsh is rejected. Ask is the default. Under Closed or Clamp, an omitted transport is AcpStdio, and an explicit Cli is rejected. Inherit keeps Cli. writeRoots is an optional comma-separated list of absolute paths a shell write may use besides the session workspace. A socket transport needs bindHost, bindPort, and bindSecret. Bind fields on any other transport are rejected. mcp is an opt-in grant for harness MCP calls. Empty denies them. histos grants every tool on that server. histos:version grants only version. dsh stores the value and does not pass servers. An allowed server comes from the workspace .mcp.json. find and call use that same grant. Empty returns no hits and hint NoGrants. A call also needs the server defined in .mcp.json. network is a host allowlist. Empty denies every host. example.com grants that host. dsh stores the value and does not apply it. events.verification is Skip or Required. The default is Skip, because the edge already rejects a request with no x-terret-key. events.key (TERRET_EVENTS_KEY) is optional. When it is set, that header must match it or the caller is not a principal. When it is unset, or empty, any non-empty x-terret-key is a principal. The id is key: plus the first 8 hex characters of the SHA-256 of the key. The key is not logged. events.floor, events.default, and events.cap are the webhook TTL. They default to 1 minute, 2 hours, and 24 hours. A requested ttl below the floor is raised, an omitted ttl uses the default, and a longer one, including an unbounded ttl, is the cap.

grok.config (TERRET_GROK_CONFIG) is the file whose [model.<name>] tables name the models open may request. Absent, that file is ~/.grok/config.toml. An empty path is rejected. Nested tables and the [models] settings table are not names. The file is read when open names a model.

An empty version is rejected. A relative root is rejected. The packaged process does not spawn grok agent serve. It connects to a serve the user already started.

supervisor is launchd, foreground, or none. none is the default: restart does not call a service manager. launchd reads launchd.labels and launchd.plistDir. There is no built-in job label. foreground reads foreground.command, one executable path. The server writes pidFile when it starts. Restart waits use restart.pace, restart.exit, restart.port, and restart.listen.

terret.app.ProcessConfig.local.harness
Grok(GrokConfig(grok,AcpStdio,Ask,None))
terret.grok.GrokConfig.stdio.transport
AcpStdio
terret.grok.GrokConfig.unbound
GrokConfig(grok,AcpWebSocket,Ask,None)
AcpBind.make("127.0.0.1", 6767, "secret").map(GrokConfig.socket)
Right(GrokConfig(grok,AcpWebSocket,Ask,Some(AcpBind(127.0.0.1,6767,secret))))
ProcessConfig.load(base.copy(listen = "stdio")).map(_.listen)
Right(Stdio)
ProcessConfig.load(base.copy(version = ""))
Left(Version)
ProcessConfig.load(base.copy(root = Some("work")))
Left(Workspace(Relative(work)))
ProcessConfig.load(base.copy(transport = Some("AcpWebSocket")))
Left(BindIncomplete)
ProcessConfig
  .load(base.copy(harness = "dsh", command = None, profile = None, transport = None, approval = None))
  .map(_.harness)
Right(Dsh(DshConfig(dsh,headless)))
ProcessConfig.load(base.copy(profile = Some("headless")))
Left(ProfileUnexpected)
ProcessConfig.load(base.copy(harness = "dsh"))
Left(GrokKeys)
ProcessConfig.load(base.copy(transport = Some("Cli")))
Left(CliAsk)
ProcessConfig.load(base.copy(writeRoots = Some("work")))
Left(Workspace(Relative(work)))
ProcessConfig.load(base.copy(mcp = Some("histos:version"))).map(_.mcp)
Right(McpPolicy(Chunk(McpGrant(histos,Some(Set(version))))))
ProcessConfig.load(base.copy(mcp = Some("histos:")))
Left(McpGrant(EmptyTool(histos)))
ProcessConfig.load(base.copy(network = Some("example.com"))).map(_.network)
Right(NetworkPolicy(Set(example.com)))
ProcessConfig.load(base.copy(network = Some("example.com,")))
Left(NetworkGrant(BadToken()))
ProcessConfig.load(base.copy(grokConfig = Some("/var/terret/grok.toml"))).map(_.grokConfig)
Right(/var/terret/grok.toml)
ProcessConfig.load(base.copy(grokConfig = Some("")))
Left(GrokConfigPath)
ZIO
  .config(ProcessConfig.raw)
  .mapError(ProcessError.Config(_))
  .flatMap(raw => ZIO.fromEither(ProcessConfig.load(raw)))
  .withConfigProvider(ConfigProvider.fromMap(Map("terret.grok.config" -> "/var/terret/grok.toml")))
ProcessConfig(Http(127.0.0.1,8080),Closed,None,dev,Grok(GrokConfig(grok,AcpStdio,Ask,None)),Chunk(),McpPolicy(Chunk()),NetworkPolicy(Set()),EventPolicy(Skip,PT1M,PT2H,PT24H),None,/var/terret/grok.toml)
ProcessConfig.load(base).map(_.events)
Right(EventPolicy(Skip,PT1M,PT2H,PT24H))
ZIO
  .config(ProcessConfig.raw)
  .mapError(ProcessError.Config(_))
  .flatMap(raw => ZIO.fromEither(ProcessConfig.load(raw)))
  .withConfigProvider(
    ConfigProvider.fromMap(
      Map(
        "terret.events.verification" -> "Required",
        "terret.events.floor"        -> "2 minutes",
        "terret.events.default"      -> "10 minutes",
        "terret.events.cap"          -> "45 minutes",
      )
    )
  )
ProcessConfig(Http(127.0.0.1,8080),Closed,None,dev,Grok(GrokConfig(grok,AcpStdio,Ask,None)),Chunk(),McpPolicy(Chunk()),NetworkPolicy(Set()),EventPolicy(Required,PT2M,PT10M,PT45M),None,/home/runner/.grok/config.toml)
ProcessConfig
  .load(
    base.copy(
      eventVerification = "Required",
      eventFloor = 2.minutes,
      eventDefault = 10.minutes,
      eventCap = 45.minutes,
    )
  )
  .map(_.events)
Right(EventPolicy(Required,PT2M,PT10M,PT45M))
ProcessConfig.load(base.copy(eventVerification = "Ask"))
Left(Events(Verification(Ask)))
ProcessConfig.load(base.copy(eventFloor = 3.hours))
Left(Events(Order))
ProcessConfig.load(base.copy(eventCap = Duration.Zero))
Left(Events(Duration(cap)))
ProcessConfig.load(base).map(_.eventsKey)
Right(None)
ZIO
  .config(ProcessConfig.raw)
  .mapError(ProcessError.Config(_))
  .flatMap(raw => ZIO.fromEither(ProcessConfig.load(raw)))
  .withConfigProvider(ConfigProvider.fromMap(Map("terret.events.key" -> "example-events-key")))
ProcessConfig(Http(127.0.0.1,8080),Closed,None,dev,Grok(GrokConfig(grok,AcpStdio,Ask,None)),Chunk(),McpPolicy(Chunk()),NetworkPolicy(Set()),EventPolicy(Skip,PT1M,PT2H,PT24H),Some(EventsKey),/home/runner/.grok/config.toml)
ZIO
  .config(ProcessConfig.raw)
  .mapError(ProcessError.Config(_))
  .flatMap(raw => ZIO.fromEither(ProcessConfig.load(raw)))
  .withConfigProvider(ConfigProvider.fromMap(Map("terret.events.key" -> "")))
ProcessConfig(Http(127.0.0.1,8080),Closed,None,dev,Grok(GrokConfig(grok,AcpStdio,Ask,None)),Chunk(),McpPolicy(Chunk()),NetworkPolicy(Set()),EventPolicy(Skip,PT1M,PT2H,PT24H),None,/home/runner/.grok/config.toml)
ServiceConfig.load(ServiceConfig.defaultRaw).map(_.supervisor)
Right(None)
ServiceConfig.load(ServiceConfig.defaultRaw.copy(supervisor = "launchd"))
Left(LabelsMissing)