UNPKG

@mastra/core

Version:
52 lines • 2.56 kB
/** * Topic prefixes whose events are only ever consumed by the process that * published them. * * `workflow.events.v2.<runId>` carries per-run watch events: the execution * engine subscribes per-run, in-process, and nothing replays them. The payloads * accumulate step results and routinely run to megabytes. */ export declare const RUN_LOCAL_TOPIC_PREFIXES: readonly ['workflow.events.v2.']; /** * Whether a topic is run-local — consumed only by the publishing process. * * Run-local topics must never be relayed to other instances, nor mirrored into * a shared replay cache: no other instance can read them, so caching only grows * the store without bound (see issue #20646). * * This predicate is the single source of truth for that policy. It is consumed * both by the `mastra.pubsub` proxy (which tags publishes `localOnly` so the * broker skips cross-instance fan-out) and by the durable agent's * `CachingPubSub` wiring (which sits *above* that proxy and so cannot observe * the `localOnly` flag itself). */ export declare function isRunLocalTopic(topic: string): boolean; /** * How long a durable run's stream log (`agent.stream.<runId>`) is retained. * * The log is what `observe({ offset })` replays from, and its counter numbers * every frame. A run parked on a tool approval can wait far longer than a * cache's default TTL; if the log expired meanwhile, numbering would restart at * 0 while an attached observer still held the old cursor. The run's suspension * frame is its last append before it parks, so stamping this on every append * covers the parked window. Run cleanup deletes the log when the run ends. */ export declare const RUN_LOG_TTL_MS: number; /** Minimum retention for a topic's cached log, or `undefined` for the cache default. */ export declare function cachedLogTtlMs(topic: string): number | undefined; /** * The copy of `event` a run's cached log keeps. * * A delegated sub-agent's chunks are forwarded on the run stream inside * `tool-output` / `workflow-step-output`, and each nested step-start, * step-finish and finish carries the sub-agent's full prompt, history and * steps. Stored as-is, every delegated run grows the log by megabytes. The log * keeps them slimmed; live subscribers still receive the event as published, * so a caller reading its own run sees the same chunks as a plain Agent's * caller (see #29035). */ export declare function toCachedLogFrame<E extends { type: string; data?: unknown; }>(topic: string, event: E): E; //# sourceMappingURL=topics.d.ts.map