Skip to content

Quickstart

This illustrative example attaches a stream supplied by the client. Closing the Effect scope stops reporting and releases the pane’s report:

import * as Effect from "effect/Effect";
import * as Exit from "effect/Exit";
import * as Scope from "effect/Scope";
import * as Stream from "effect/Stream";
import { attachCorral } from "@fungi.computer/corral";
const scope = await Effect.runPromise(Scope.make());
await Effect.runPromise(
attachCorral(Stream.fromIterable(["idle", "working"]), {
environment: {
HERDR_ENV: "1",
HERDR_SOCKET_PATH: "/path/to/herdr.sock",
HERDR_PANE_ID: "pane-id",
},
onError: (error) => console.error("Herdr report failed", error),
}).pipe(Scope.provide(scope)),
);
await Effect.runPromise(Scope.close(scope, Exit.void));

The snippet is illustrative: a real client supplies its live activity stream and the Herdr values from its managed environment. The integration tests run report and release requests against a local socket server in test/activity.test.ts.