HyperlinkTag<Self, S, Svc>The type of a HyperService tag carrying spec S — what Hyperlink.Tag produces
(and what you extend). Lets a consumer write
<S extends Spec>(tag: HyperlinkTag<Self, S>) and read the spec through named types
(specOf / groupOf) instead of a Parameters<typeof specOf> workaround.
export interface interface HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>The type of a HyperService tag carrying spec S — what
Hyperlink.Tag
produces
(and what you extend). Lets a consumer write
<S extends Spec>(tag: HyperlinkTag<Self, S>) and read the spec through named types
(
specOf
/
groupOf
) instead of a Parameters<typeof specOf> workaround.
HyperlinkTag<function (type parameter) Self in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Self, function (type parameter) S in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>S extends Spec, function (type parameter) Svc in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Svc = type ServiceOf<S extends Spec, Self = unknown> = { [K in keyof { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends DefaultMethod<infer F> ? F : S[K] extends {
readonly _tag: "value";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }]: { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends DefaultMethod<infer F> ? F : S[K] extends {
readonly _tag: "value";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }[K]; } extends infer B ? B : never
The full service interface inferred from a
Spec
. Wire
Method
s map to
Effect/function members; off-wire
LocalMethod
s surface as
Effect<T, never, Local<Self>> — yield* to obtain the value, requiring the local layer
(
Local
) (so they're uncallable through
Hyperlink.client
).
ServiceOf<function (type parameter) S in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>S, function (type parameter) Self in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Self>>
extends import ContextContext.interface ServiceClass<in out Self, in out Identifier extends string, in out Shape>Class-style service key produced by Context.Service<Self, Shape>()("Id").
When to use
Use when declaring a service as a class so the class value can serve as the
Context key.
Details
The class itself is the Context key, and its string key identifies the
service at runtime.
Namespace containing helper types for class-style Context.Service
declarations.
ServiceClass<function (type parameter) Self in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Self, string, function (type parameter) Svc in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Svc> {
/** Wire prefix — namespaces this HyperService's procedures on a shared `RpcServer`. */
readonly [const wireKeySym: typeof wireKeySymWhere the wire key (RpcGroup prefix) is stowed on a Tag. Solo
Tag
s use the
same string as
Context.Key.key
; shared-Spec instances use the factory wire key.
Read with
wireKeyOf
.
wireKeySym]: string;
/** Hyperlink-level help text (CLI/TUI section help, dashboard panel title) — if declared. */
readonly HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>.description: string | undefinedHyperlink-level help text (CLI/TUI section help, dashboard panel title) — if declared.
description: string | undefined;
readonly [const specSym: typeof specSymWhere the contract spec is stowed on a Tag (hidden from the value surface). Exported so
the public
HyperlinkTag
type is nameable across modules.
specSym]: type FlatSpec = {
[x: string]:
| AnyMethod
| AnyLocalMethod
| AnyDefaultMethod
}
A flat spec — a path-keyed record of leaves (no nested groups). The wire machinery runs on this;
a (possibly nested)
Spec
flattens to it via
flattenSpec
.
FlatSpec;
readonly [const specTypeSym: typeof specTypeSymPhantom carrier of a tag's (possibly nested) spec type S, so functions can infer S from a tag —
specSym
holds the flat spec at runtime and can't carry the nested S. Type-only, never set at
runtime.
specTypeSym]?: function (type parameter) S in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>S;
readonly [const groupSym: typeof groupSymWhere the built RPC group is stowed on a Tag.
groupSym]: type RpcGroupOf<S extends Spec> =
RpcGroup.RpcGroup<RpcUnionOf<S, "">>
The precisely-typed RPC contract group for a
Spec
. Carrying this exact type
(rather than a loose Rpc<string, …>) is what keeps the remote client's requirement
channel honest: concrete schemas declare never encoding/decoding services, so
RpcClient.make infers a real R (just the transport Protocol) instead of any.
RpcGroupOf<function (type parameter) S in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>S>;
readonly [const localCapSym: typeof localCapSymWhere the per-HyperService local-capability key is stowed on a Tag.
localCapSym]: import ContextContext.interface Key<out Identifier, out Shape>Typed identifier for a service stored in a Context.
When to use
Use as the typed handle for storing, retrieving, and requiring a specific
service in a Context.
Details
Identifier tracks the requirement in Effect types, while Shape is the
service implementation retrieved by the key. A key is also an Effect value,
so yielding it inside Effect.gen retrieves the service from the current
fiber context.
Key<
interface Local<in out Self>Granted only by a HyperService's local layer (
Hyperlink.layer
/
serve
) — never by
Hyperlink.client
. Local to this runtime's materialized impl for the tag (not a remote
client, not a peer). A
LocalMethod
carries it in its requirement channel, so calling a
non-serializable method against a client is a compile error (unsatisfied requirement); the
same call resolves when the local layer is provided. Branded by Self so one HyperService's local
layer can't unlock another's.
Local<function (type parameter) Self in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Self>,
{ readonly granted: truegranted: true }
>;
/**
* The HyperService's {@link Node} (its transport), or `undefined` for a nodeless tag. Uniform
* across all tags (always present) so a node-bearing tag stays assignable wherever a plain
* {@link HyperlinkTag} is expected; the node-bearing tag constructors **narrow** this to a
* concrete {@link NodeKey} in their return type, which is how {@link Hyperlink.client}
* discriminates the node-aware path.
*/
readonly [const nodeSym: typeof nodeSymWhere the HyperService's
Node
(if any) is stowed on a Tag.
nodeSym]: type NodeKey<HSelf> = Context.Key<HSelf, NodeProtocol>The Context key of a
Node
(HSelf = its identity): a service whose value is the
transport
NodeProtocol
. Stored on a node-bearing tag under
nodeSym
; read by
Hyperlink.client
to resolve where to connect (its requirement channel).
NodeKey<unknown> | undefined;
/** The contract's kind (canonical id) — set by a contract `.Tag` factory, `undefined` for a bare
* {@link Hyperlink.Tag}. Read it with {@link kindOf}. */
readonly [const kindSym: typeof kindSymWhere a contract's kind (its canonical id, e.g. hyperlink-ts/WorkPool) is
stowed on a Tag — set by each contract's .Tag factory so consumers (the dashboard) can
classify a tag without sniffing its spec. Absent on a bare
Hyperlink.Tag
.
kindSym]: string | undefined;
/** The HyperService's readiness derivation, if any (applied by {@link withReadiness}); `undefined`
* ⇒ ready by default. Read it via {@link readinessCheck}. */
readonly [const readinessSym: typeof readinessSymWhere a HyperService's readiness derivation (status → ready) is stowed on a Tag — a sibling of
kindSym
, applied by
withReadiness
. Absent ⇒ the HyperService is ready by default.
readinessSym]: type ReadinessOf<Service> = (
service: Service,
base: Effect.Effect<Readiness, never, any>
) => Effect.Effect<Readiness, never, any>
Derive
Readiness
from a HyperService's materialized service — read its status, don't store new
state. The second argument, base, is the readiness already on the tag (e.g. a contract
factory's own check) — yield* base to extend it (a queue's phase === "running" and your
dependency checks), or ignore it to replace it. Stacks: each
withReadiness
wraps the prior.
Attach one with
withReadiness
; read the result with
readinessCheck
.
ReadinessOf<type ServiceOf<S extends Spec, Self = unknown> = { [K in keyof { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends DefaultMethod<infer F> ? F : S[K] extends {
readonly _tag: "value";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }]: { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends DefaultMethod<infer F> ? F : S[K] extends {
readonly _tag: "value";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
readonly _tag: "ref";
} ? Subscribable<SuccessOf<AsMethod<S[K]>>> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }[K]; } extends infer B ? B : never
The full service interface inferred from a
Spec
. Wire
Method
s map to
Effect/function members; off-wire
LocalMethod
s surface as
Effect<T, never, Local<Self>> — yield* to obtain the value, requiring the local layer
(
Local
) (so they're uncallable through
Hyperlink.client
).
ServiceOf<function (type parameter) S in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>S, function (type parameter) Self in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Self>> | undefined;
/** The per-HyperService {@link peers} capability key — its value is this HyperService's peer clients
* (the other nodes' leaf services), keyed by node. Provided by {@link peersLayer}, read via {@link peers}. */
readonly [const peersSym: typeof peersSymHolds a tag's per-HyperService
peers
capability key.
peersSym]: import ContextContext.interface Key<out Identifier, out Shape>Typed identifier for a service stored in a Context.
When to use
Use as the typed handle for storing, retrieving, and requiring a specific
service in a Context.
Details
Identifier tracks the requirement in Effect types, while Shape is the
service implementation retrieved by the key. A key is also an Effect value,
so yielding it inside Effect.gen retrieves the service from the current
fiber context.
Key<interface PeersId<Self>Phantom brand for the per-HyperService
peers
capability, so distinct HyperServices' peer sets
don't collide in one context.
PeersId<function (type parameter) Self in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Self>, type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<string, type PeerServiceOf<S extends Spec> = {
readonly [K in keyof S as S[K] extends {
readonly fleet: true
}
? never
: S[K] extends
| AnyLocalMethod
| AnyDefaultMethod
? never
: K]: S[K] extends {
readonly _tag: "ref"
}
? Effect.Effect<
SuccessOf<AsMethod<S[K]>>,
never,
never
>
: S[K] extends {
readonly kind: MethodKind
}
? ServiceMethod<AsMethod<S[K]>>
: S[K] extends Spec
? PeerServiceOf<S[K]>
: never
}
A peer's service as seen by
peers
— the per-instance ("leaf") wire methods only:
FleetField
s and
LocalMethod
s are excluded, so a fold can't recurse into a peer's
own fleet field. A full
ServiceOf
is assignable to it (width), so real clients fit.
PeerServiceOf<function (type parameter) S in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>S>>>;
/** The per-HyperService {@link selfNode} capability key — its value is the node key this instance runs
* as (the same key its peers are keyed by). Provided by {@link peersLayer} / {@link selfNodeLayer},
* read via {@link selfNode}. */
readonly [const selfNodeSym: typeof selfNodeSymHolds a tag's per-HyperService
selfNode
capability key.
selfNodeSym]: import ContextContext.interface Key<out Identifier, out Shape>Typed identifier for a service stored in a Context.
When to use
Use as the typed handle for storing, retrieving, and requiring a specific
service in a Context.
Details
Identifier tracks the requirement in Effect types, while Shape is the
service implementation retrieved by the key. A key is also an Effect value,
so yielding it inside Effect.gen retrieves the service from the current
fiber context.
Key<interface SelfNodeId<Self>Phantom brand for the per-HyperService
selfNode
capability (which node this instance runs as),
so distinct HyperServices' self-node identities don't collide in one context.
SelfNodeId<function (type parameter) Self in HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>Self>, string>;
/** The Node set (C1), if declared via {@link nodes} / `{ node }` / {@link distributed}; else `undefined`. */
readonly [const nodesSym: typeof nodesSymHolds a tag's distributed set (the fleet).
nodesSym]?: interface ReadonlyArray<T>ReadonlyArray<type AnyNode = NodeKey<unknown> & {
readonly url: string | undefined;
readonly path: string | undefined;
readonly kind: ProtocolKind | undefined;
readonly endpoints?: Endpoints;
readonly onConflict?: OnConflict;
readonly [portSym]?: number;
}
A
Tag
erased — its transport endpoints set, plus the primary address
(url and/or Unix path) and
ProtocolKind
kind (the first-declared endpoint, kept for
single-protocol readers), so a tag's distributed set is self-describing about where AND how to
reach each one.
AnyNode>;
/** Set when the tag was piped through {@link identity} — layer/serve claim at Lookup first. */
readonly [const identitySym: typeof identitySymMarks a Tag as identity-claiming (
identity
pipe) — layer/serve claim at Lookup first.
identitySym]?: true;
}