import { AutoTarget, ActivityFilter, AutoActivityEvent } from '@particle-academy/fancy-auto-common'; export { ActivityFilter, AutoActivityEvent as AgentActivityEvent, AutoActivityListener as AgentActivityListener, AutoTarget as AgentTarget, AutoTargetKind as AgentTargetKind, emitActivity, onActivity, readActivityHistory, resetActivityRegistry } from '@particle-academy/fancy-auto-common'; import { C as CallToolResult } from '../types-ITRQFAir.cjs'; type ActivityAgent = { id: string; name?: string; color?: string; }; type ActivityResolverContext> = { /** Tool name as registered. */ toolName: string; /** Arguments the tool was called with. */ args: TArgs; /** The CallToolResult the underlying handler produced. */ result: CallToolResult; }; /** * Resolves an `AgentTarget` for an executed tool. Bridges declare one of * these per registration so the wrapper knows which surface / element / * screen the activity belongs to. * * The resolver runs AFTER the tool handler so it can inspect the result * (e.g. read a newly-created item id from `structuredContent`). */ type ActivityTargetResolver> = (ctx: ActivityResolverContext) => AutoTarget | null; type ToolHandler> = (args: TArgs) => Promise | CallToolResult; /** * wrapToolWithActivity — decorate a bridge tool handler so every successful * call emits an `AgentActivityEvent`. Returns a new handler with the same shape. * * Usage in a bridge: * * server.registerTool( * definition, * wrapToolWithActivity( * handler, * { agent, kind: "whiteboard", resolveTarget: ({ args }) => ({ * kind: "whiteboard", elementId: args.id as string, * }) }, * ), * ); */ declare function wrapToolWithActivity>(handler: ToolHandler, options: { toolName: string; agent: ActivityAgent; /** Optional fancy-screens screen id this bridge is scoped to. */ screenId?: string; /** Default target kind if the resolver returns one without `kind`. */ kind: AutoTarget["kind"]; /** Per-call resolver. Return `null` to skip emitting (e.g. for read-only tools). */ resolveTarget?: ActivityTargetResolver; /** Optional ttl override. */ ttlMs?: number; /** * Build the `meta` broadcast to all relay peers. Defaults to the tool's full * `structuredContent`. Override to REDACT sensitive fields before fan-out — * e.g. the terminal bridge strips raw command/keystroke bytes so a command * line (or its secrets) is never broadcast verbatim to every peer. */ buildMeta?: (result: CallToolResult) => Record | undefined; }): ToolHandler; /** * useAgentActivity — React subscription to the in-process activity stream. * * Returns: * - `events`: capped scrollback of recent events matching the filter * - `latest`: the most recent event (handy for transient highlights) */ declare function useAgentActivity(filter?: ActivityFilter, options?: { capacity?: number; }): { events: AutoActivityEvent[]; latest: AutoActivityEvent | null; }; /** * useAgentActivityForScreen — convenience wrapper that filters by screen id. * Drives "agent is here" badges in fancy-screens-based shells. */ declare function useAgentActivityForScreen(screenId: string, options?: { capacity?: number; }): { events: AutoActivityEvent[]; latest: AutoActivityEvent | null; isAgentActive: boolean; }; export { type ActivityAgent, type ActivityResolverContext, type ActivityTargetResolver, type ToolHandler, useAgentActivity, useAgentActivityForScreen, wrapToolWithActivity };