import type { AgentControllerEvent } from '@mastra/core/agent-controller'; import type { SourceControlStorageHandle } from '../storage/domains/source-control/base.js'; export interface FirstExecCaptureSession { readonly identity: { getResourceId(): string; }; subscribe(listener: (event: AgentControllerEvent) => void): () => void; } export interface FirstExecCaptureDependencies { sourceControl: { sessions: Pick; }; } export declare function isMeaningfulToolName(name: string | undefined): boolean; /** * Record when a session's agent completed its first successful meaningful * tool call (the TTFME anchor — "time to first meaningful exec"). * * Meaningful = a workspace tool the agent invoked itself (filesystem, * search, code intelligence, sandbox exec, process control). We accept any * tool whose name starts with the workspace prefix `mastra_workspace_` or * matches the post-remap mastracode tool names. Non-workspace tools (memory, * notification inbox, subagent, etc.) and skill-loader / preflight / * materializer `sandbox.executeCommand()` calls that never flow through the * tool layer are intentionally excluded. * * Failed tool calls (`isError === true`) don't count. Approval-denied and * abort-while-parked tool completions (`denied === true`) also don't count: * the run-engine emits `tool_end` with `isError: false` for those paths * because the tool didn't fail, but it also never ran, so treating them as * "meaningful exec" would re-introduce the same contamination this fix is * removing on the message side. The listener stays subscribed until a * successful qualifying end, then unsubscribes. The storage write is guarded * (`first_meaningful_exec_at IS NULL`), so restarts, re-materialized * sessions, and sessions without a source-control row are no-ops. */ export declare function observeSessionFirstExec(session: FirstExecCaptureSession, { sourceControl }: FirstExecCaptureDependencies): () => void; //# sourceMappingURL=first-exec-capture.d.ts.map