/** * @license * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { AuthConfig } from '../auth/auth_tool.js'; import { ToolConfirmation } from '../tools/tool_confirmation.js'; /** * Represents the actions attached to an event. */ export interface EventActions { /** * If true, it won't call model to summarize function response. * Only used for function_response event. */ skipSummarization?: boolean; /** * Indicates that the event is updating the state with the given delta. */ stateDelta: { [key: string]: unknown; }; /** * Indicates that the event is updating an artifact. key is the filename, * value is the version. */ artifactDelta: { [key: string]: number; }; /** * If set, the event transfers to the specified agent. */ transferToAgent?: string; /** * The agent is escalating to a higher level agent. */ escalate?: boolean; /** * Authentication configurations requested by tool responses. * * This field will only be set by a tool response event indicating tool * request auth credential. * - Keys: The function call id. Since one function response event could * contain multiple function responses that correspond to multiple function * calls. Each function call could request different auth configs. This id is * used to identify the function call. * - Values: The requested auth config. */ requestedAuthConfigs: { [key: string]: AuthConfig; }; /** * A dict of tool confirmation requested by this event, keyed by the function * call id. */ requestedToolConfirmations: { [key: string]: ToolConfirmation; }; /** * Workflow: a serialized node/agent state snapshot used for resumable * checkpointing. Mirrors Python `EventActions.agent_state`. */ agentState?: Record; /** * Workflow: marks that the emitting agent/workflow has reached the end of its * execution for this invocation. Mirrors Python `EventActions.end_of_agent`. */ endOfAgent?: boolean; } /** * Creates an {@link EventActions} object with default empty-dict values for * all dictionary fields. * * @param state - Optional partial {@link EventActions} whose properties * override the defaults. Dictionary fields (`stateDelta`, `artifactDelta`, * `requestedAuthConfigs`, `requestedToolConfirmations`) default to `{}`; * scalar fields (`skipSummarization`, `transferToAgent`, `escalate`) default * to `undefined`. * @returns A fully populated {@link EventActions} object. */ export declare function createEventActions(state?: Partial): EventActions; /** * Merges a list of {@link EventActions} objects into a single * {@link EventActions} object. * * Merge semantics: * 1. **Dictionary fields** (`stateDelta`, `artifactDelta`, * `requestedAuthConfigs`, `requestedToolConfirmations`) — all entries from * every source are combined via `Object.assign`. Later sources win on * duplicate keys. * 2. **Scalar fields** (`skipSummarization`, `transferToAgent`, `escalate`) — * last-writer-wins: the value from the last source that sets the field is * kept. * * @param sources - Ordered list of partial {@link EventActions} to merge. * Falsy entries are silently skipped. * @param target - Optional base {@link EventActions} to merge into. When * provided it is used as the starting state before applying `sources`. * @returns A new {@link EventActions} containing the merged result. */ export declare function mergeEventActions(sources: Array>, target?: EventActions): EventActions;