//#region ../app/capabilities/core.d.ts
type CapabilityScope = string;
/**
 * Phantom carrier for a capability *stream* (Part D). A stream is declared in a
 * capability's `Streams` surface as `name(input): Stream<Event>` — unlike a
 * one-shot `Method`, the host runs it as `(input, emit) => unsubscribe` and the
 * kernel routes each emitted `Event` back into the app's reducer as a
 * `t.fromEvent` edge. The phantom `Event` carries that payload type to the edge,
 * so authors never restate it. Types-only: no value is ever constructed.
 */
type Stream<Event> = {
  readonly __event?: Event;
};
/**
 * Runtime twin of one contract method — optional, supplied to `defineCapability`.
 * A capability that carries it becomes self-describing: `implementTool` derives
 * agent tools from it, and seam-level input validation can consume it later.
 */
interface MethodMeta {
  /** What the method does. Doubles as the derived tool's LLM-facing description. */
  description: string;
  /** JSON Schema for the method's single input argument. */
  input: Record<string, unknown>;
}
type MethodMetaMap<Methods> = Partial<Record<Extract<keyof Methods, string>, MethodMeta>>;
/**
 * Factory returned by `defineCapability`. Apps call it with their requested
 * scopes; the host broker enforces method-level grants at invocation time.
 *
 * `Methods` describes the one-shot request/response surface (what the app
 * calls). The optional `Streams` describes the ongoing streams the app may
 * subscribe to via `subscriptions(state)`; both the input and the emitted-event
 * types flow from here to the app at compile time. The factory also carries the
 * contract's runtime side — `id` plus any per-method metadata — so hosts can
 * derive from the contract without calling it.
 */
type CapabilityFactory<Id extends string, Methods, Streams = Record<never, never>> = ((opts: {
  scopes: readonly CapabilityScope[];
}) => {
  id: Id;
  scopes: readonly CapabilityScope[];
  readonly __methods?: Methods;
  readonly __streams?: Streams;
}) & {
  id: Id;
  methods?: MethodMetaMap<Methods>;
};
//#endregion
export { Stream as n, CapabilityFactory as t };
//# sourceMappingURL=core-CSZf27yz.d.ts.map