/** * Reduce an arbitrary author-supplied string to one filesystem-safe path segment: lowercase, anything * outside `[a-z0-9._-]` becomes `-`, runs of `-` collapse, leading/trailing `-` go. May return `""` (a * name made entirely of separators or non-ASCII); callers pass the result through {@link orHash} so a * name that survives sanitization as nothing still produces a distinct, stable filename. */ export declare function sanitizeSegment(raw: string): string; /** A workflow's declared name as it appears in a run id / session filename: sanitized, capped, tagged if truncated. */ export declare function sanitizeWorkflowName(name: string): string; /** * A node path (spec §8.5) as it appears in a session filename. The separators are transliterated before * sanitizing — `/`→`.`, `#`→`-`, `@`→`-` — rather than being flattened to `-` along with everything * else, so the path's shape survives: `batch@7/review` reads as `batch-7.review`, not as one anonymous * run of dashes. An over-cap path is truncated and tagged ({@link capWithHash}), which is what keeps * two deep foreach items apart when their prefixes are identical. */ export declare function sanitizeNodePath(nodePath: string): string; /** A run id's random tail — the short form a user can type instead of the whole slug (see {@link matchRunId}). */ export declare function runIdHash(runId: string): string; /** * Mint a run id: `workflow--<8 hex>` (spec §8.9 — the id the whole run is keyed by). * * `isTaken` is asked before the id is used, because unlike a UUID this one is only 32 random bits behind * a name many runs share — a project that runs the same workflow often WILL collide eventually, and a * collision is not cosmetic: the second run would append its events onto the first run's log and both * would then read as one incoherent run. `hex` is injectable so the retry path is testable without * waiting for a real 1-in-4-billion event. */ export declare function mintRunId(workflowName: string, isTaken: (runId: string) => Promise, hex?: () => string): Promise; /** * The session file a `resumable` step continues across runs (spec §2.2): `workflow--key-.jsonl`. * * Deliberately carries NO run component. `resumeKey` exists precisely to span executions — a worker * time-boxed out of one round and re-run in the next must pick up where it left off — so mixing the run * id in would give every run a fresh file and turn `resumable` into a silent no-op. */ export declare function resumeSessionFile(workflowName: string, resumeKey: string): string; /** * The session file a NON-resumable execution records itself into (spec §2.2): * `workflow--run---a.jsonl`. Unique per execution — a fresh look at the world * is the point of an isolated step — but no longer thrown away, so what a step was told, replied and * spent stays readable afterwards. * * The `-run-` / `-key-` infixes keep the two namespaces structurally disjoint: no step name, path or * author-chosen key can make a trace collide with a keyed session, whatever it is called. That guarantee * used to come from putting traces in a `traces/` subdirectory, which is gone — everything a run writes * now lives in one flat directory beside the harness's own sessions. */ export declare function traceSessionFile(workflowName: string, runId: string, nodePath: string, attempt: number): string; /** The display name a spawned step session is launched with (`--name`), so it reads as something in a picker rather than as a filename. */ export declare function stepSessionName(workflowName: string, nodePath: string, runId: string): string; /** How a `/workflow resume|cancel|delete` argument resolved against the runs actually on disk. */ export type RunIdMatch = { readonly kind: "ok"; readonly runId: string; } | { readonly kind: "unknown"; } | { readonly kind: "ambiguous"; readonly candidates: readonly string[]; }; /** * Resolve a user-typed run reference (spec §6.2/§6.4/§6.5): exact id, then the 8-hex tail alone, then * any unique prefix. Mirrors the harness's own session lookup, which tries an exact id before falling * back to `startsWith` — a user who just watched `/workflow run list` print * `workflow-deploy-3f2a1c4b` should be able to type `3f2a1c4b`. * * Exact wins outright, so a run id that happens to be a prefix of another is always addressable. Anything * short enough to match several runs is reported AMBIGUOUS with the candidates rather than resolved by * picking one — the operations behind this are cancel and delete. */ export declare function matchRunId(known: readonly string[], arg: string): RunIdMatch; //# sourceMappingURL=naming.d.ts.map