Download packages/a2a-server/src/utils/executor_utils.ts from SaylorTwift/gemini-cli: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/SaylorTwift/gemini-cli/resolve/main/packages/a2a-server/src/utils/executor_utils.ts
- Command line
-
hf download hf://SaylorTwift/gemini-cli/packages/a2a-server/src/utils/executor_utils.ts
-
curl -L -o executor_utils.ts https://huggingface.co/SaylorTwift/gemini-cli/resolve/main/packages/a2a-server/src/utils/executor_utils.ts
1.12 kB
| /** | |
| * @license | |
| * Copyright 2025 Google LLC | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ | |
| import type { Message } from '@a2a-js/sdk'; | |
| import type { ExecutionEventBus } from '@a2a-js/sdk/server'; | |
| import { v4 as uuidv4 } from 'uuid'; | |
| import { CoderAgentEvent, type StateChange } from '../types.js'; | |
| export async function pushTaskStateFailed( | |
| error: unknown, | |
| eventBus: ExecutionEventBus, | |
| taskId: string, | |
| contextId: string, | |
| ) { | |
| const errorMessage = | |
| error instanceof Error ? error.message : 'Agent execution error'; | |
| const stateChange: StateChange = { | |
| kind: CoderAgentEvent.StateChangeEvent, | |
| }; | |
| eventBus.publish({ | |
| kind: 'status-update', | |
| taskId, | |
| contextId, | |
| status: { | |
| state: 'failed', | |
| message: { | |
| kind: 'message', | |
| role: 'agent', | |
| parts: [ | |
| { | |
| kind: 'text', | |
| text: errorMessage, | |
| }, | |
| ], | |
| messageId: uuidv4(), | |
| taskId, | |
| contextId, | |
| } as Message, | |
| }, | |
| final: true, | |
| metadata: { | |
| coderAgent: stateChange, | |
| model: 'unknown', | |
| error: errorMessage, | |
| }, | |
| }); | |
| } | |