Download src/tasks/LocalShellTask/guards.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/chenbhao/codev/resolve/714ab7d15ffd78992a4c3d4e2bf153c2f62f4841/src/tasks/LocalShellTask/guards.ts
- Command line
-
hf download hf://chenbhao/codev@714ab7d15ffd78992a4c3d4e2bf153c2f62f4841/src/tasks/LocalShellTask/guards.ts
-
curl -L -o guards.ts https://huggingface.co/chenbhao/codev/resolve/714ab7d15ffd78992a4c3d4e2bf153c2f62f4841/src/tasks/LocalShellTask/guards.ts
1.55 kB
| // Pure type + type guard for LocalShellTask state. | |
| // Extracted from LocalShellTask.tsx so non-React consumers (stopTask.ts via | |
| // print.ts) don't pull React/ink into the module graph. | |
| import type { TaskStateBase } from '../../Task.js' | |
| import type { AgentId } from '../../types/ids.js' | |
| import type { ShellCommand } from '../../utils/ShellCommand.js' | |
| export type BashTaskKind = 'bash' | 'monitor' | |
| export type LocalShellTaskState = TaskStateBase & { | |
| type: 'local_bash' // Keep as 'local_bash' for backward compatibility with persisted session state | |
| command: string | |
| result?: { | |
| code: number | |
| interrupted: boolean | |
| } | |
| completionStatusSentInAttachment: boolean | |
| shellCommand: ShellCommand | null | |
| unregisterCleanup?: () => void | |
| cleanupTimeoutId?: NodeJS.Timeout | |
| // Track what we last reported for computing deltas (total lines from TaskOutput) | |
| lastReportedTotalLines: number | |
| // Whether the task has been backgrounded (false = foreground running, true = backgrounded) | |
| isBackgrounded: boolean | |
| // Agent that spawned this task. Used to kill orphaned bash tasks when the | |
| // agent exits (see killShellTasksForAgent). Undefined = main thread. | |
| agentId?: AgentId | |
| // UI display variant. 'monitor' → shows description instead of command, | |
| // 'Monitor details' dialog title, distinct status bar pill. | |
| kind?: BashTaskKind | |
| } | |
| export function isLocalShellTask(task: unknown): task is LocalShellTaskState { | |
| return ( | |
| typeof task === 'object' && | |
| task !== null && | |
| 'type' in task && | |
| task.type === 'local_bash' | |
| ) | |
| } | |