@fungi.computer/corral

中文文档
0.1.31发布于 2026/11/15MITTypeScriptES Module近 30 天下载 5718

Optional Herdr activity reporting for Shiitake clients

原始使用文档
文档目录7 节
  1. Install or set up
  2. Quick start
  3. Core concepts
  4. API reference
  5. Examples and checks
  6. Limits and errors
  7. Contribute and license

Corral (@fungi.computer/corral)

Corral reports a Shiitake client's current activity in the active Herdr pane. It is an optional client extension: the client supplies activity, and Herdr owns the pane and its lifecycle.

Install or set up

npm install @fungi.computer/corral

The package ships ESM only and depends on effect and Shiitake at runtime. Its only entrypoint, @fungi.computer/corral, exports the Shiitake client extension as its default export and attachCorral for hosts that supply their own activity stream.

The default extension reads HERDR_ENV, HERDR_SOCKET_PATH, and HERDR_PANE_ID from its process environment. It attaches only when HERDR_ENV is 1 and both the socket path and pane ID are set. Outside that environment, attachment has no effect.

Quick start

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([{ state: "idle" }, { state: "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.

Core concepts

The activity stream contains idle, working, blocked, or unknown. Corral reports changes from that stream. It does not open another Session watch or read a Session database. The client remains responsible for producing activity. The default entry borrows an AsyncIterable with an independent sliding latest-value subscription per iterator and a detach signal. attachCorral accepts an Effect stream, including a stream with typed Error failures. Source and socket errors reach onError; closing the scope still releases the pane report. Fungi borrows its existing Session observation and command interaction store. An open agent question, a pending command question or a browser hand-off reports blocked. Answering it restores the current activity. An agent question may add its short header to the blocked message; question bodies, answer choices, answers and credentials are never included in reports.

Herdr derives done when an unseen background turn returns to idle. It owns whether the user has seen that completion. Corral never guesses completion from an unavailable observation.

attachCorral needs an Effect scope. When that scope closes, Corral cancels its reporter, closes any in-flight socket, and releases the current pane report. It sends pane.report_agent and pane.release_agent over Herdr's API socket with the fungi:agent:v1 source and fungi agent label. A monotone timestamp sequence orders reports across attachments and process restarts.

API reference

See the generated Corral API reference. The default export is an attach-only shiitake.client/v1 entry. attachCorral is the lower-level integration for hosts that supply an activity stream directly.

Examples and checks

The activity tests cover environment gating, activity changes, cleanup on scope close, and report failure handling. Run them with:

pnpm --filter @fungi.computer/corral test

Limits and errors

Corral is trusted local extension code, not a sandbox. It does not start or stop the Herdr service and does not decide what counts as successful work. Report and release requests are optional IPC: each is limited to two seconds. Failures are passed to onError. A reporting failure does not veto client activity or terminal restoration. The caller owns any user-facing recovery.

The wire contract follows Herdr's agent integration guide and its Pi extension.

Contribute and license

Corral is MIT licensed. See LICENSE.

版本与发布记录

@fungi.computer/corral 共发布 34 个版本,首次发布于 2026/10/17;过去 12 个月发布了 34 个版本。

版本发布日期距今
0.1.31latest2026/11/15今天
0.1.302026/11/15今天
0.1.292026/11/141 天前
0.1.282026/11/141 天前
0.1.272026/11/141 天前
0.1.262026/11/141 天前

关于 @fungi.computer/corral 的常见问题

@fungi.computer/corral 是什么?

Optional Herdr activity reporting for Shiitake clients

如何安装 @fungi.computer/corral?

在项目目录运行 npm install @fungi.computer/corral,或使用 pnpm add / yarn add / bun add。

@fungi.computer/corral 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fungi.computer/corral 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fungi.computer/corral 可以商用吗?

@fungi.computer/corral 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fungi.computer/corral 的下载量有多少?

根据 npm 官方下载统计,@fungi.computer/corral 在 2026/10/16 – 2026/11/14 这 30 天内被下载 5,718 次,日均约 191 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fungi.computer/corral 还在维护吗?

最新版本 0.1.31 发布于 2026/11/15(今天);至今共发布 34 个版本,其中过去 12 个月发布了 34 个;首次发布于 2026/10/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。