import { I as Failure, M as Settings, T as Fetch, _ as Plan, k as Logger, m as Tracer, p as RunSpec, v as Explanation, y as ExternalLink } from "./plugin-DYhXH7JX.mjs"; import * as sdk from "@nullplatform/tracing"; /** What a run and a step are both told: their narrative, and how they ended. */ interface NodeHandleLike { /** `tracing.explain`: the words the console leads with; `title` is the node's name. */ explain: (body: Explanation & { title: string; }) => unknown; /** `tracing.external_links`: the node's whole list, each call replacing the last. */ externalLinks: (links: ExternalLink[]) => unknown; /** Inline `tracing.output`: what the node produced. */ output: (name: string, value: unknown) => unknown; /** `tracing.error`: how the node failed, its code and whether it may be retried, over what `fail` derives. */ error: (body: Failure) => unknown; complete: () => unknown; fail: (thrown: unknown) => unknown; } /** A job's handle: the definition every run like one is an instance of, carrying its plan. */ interface JobHandleLike { plan: (body: Plan) => JobHandleLike; toRef: () => sdk.JobRef; } /** A run's handle. */ interface RunHandleLike extends NodeHandleLike { labels: (values: Record) => unknown; /** `tracing.actor`: who asked for the run. */ actor: (body: { kind: "user" | "service"; id: string; }) => unknown; /** Inline `tracing.input`: what the run consumed. */ input: (name: string, value: unknown) => unknown; /** `tracing.plan` on the run itself, the SDK's run-level plan: a run with a plan and no job. */ plan: (body: Plan) => unknown; /** The `instance_of` edge to the run's job. */ instanceOf: (job: JobHandleLike) => unknown; step: (spec: { key: string; }) => NodeHandleLike; } /** A run's identity, as the SDK's run spec takes it: identity only, everything else told to its handle. */ interface RunIdentity { trace_id: string; run_id: string; nrn: string; } /** A job's identity in a tenant: the job the kind names, at its run's NRN. */ type JobIdentity = NonNullable & { nrn: string; }; /** A producer client: the SDK's own Tracer as it is, or a fake of it. */ interface TracingClientLike { run: (spec: RunIdentity) => RunHandleLike; /** A job definition, lazy: emitted once, the first time a run is an instance of it. */ job: (spec: JobIdentity) => JobHandleLike; flush: () => Promise; /** Told each event the client drops: one the API refused, or its queue had no room for. */ on: (event: "drop", listener: (envelope: { type?: string; } | undefined, reason: unknown) => void) => unknown; } /** What the tracing port takes: a Tracer (`noopTracing`, a test's), or the SDK's own Tracer as it is. */ type TracingPort = Tracer | TracingClientLike; /** The ports every transport runs a plugin with; each defaults as it says. */ interface Ports { /** The run's settings (contract/settings.json): each the one given, else its default. `main` fills what the code leaves unset from the variables the agent sets. */ settings?: Partial; /** The platform port every call of `context.api` goes through: the one the settings authorize (`authorizedFetch`) unless given (a local run passes `recordingPlatform().fetch`). */ fetch?: Fetch; /** Where every run is traced: a Tracer (`noopTracing`), or the tracing SDK's Tracer as it is; the settings' unless given. */ tracing?: TracingPort; /** The run's logger: what the handler, the server and tracing say. `stderrLogger` unless given; never stdout, which is the answer's. */ log?: Logger; /** Aborted when the worker must stop; never unless given. */ signal?: AbortSignal; } /** * The argument a run of a plugin whose own ports are `Own` is handed, its * ports or its options (`Given`): optional when each of its own ports is, * else required (as `Required`, its own ports in it), so no plugin runs * without a port it needs. `main`, `handle` and `serve` take their ports so, * and `run` its options. */ type OwnPortsArgument = {} extends Own ? [Given?] : [Required]; export { Ports as n, TracingPort as r, OwnPortsArgument as t }; //# sourceMappingURL=ports-5rVV3z3m.d.mts.map