Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 04:45 UTC
| 1 | import { Data, Runtime } from 'effect'; |
| 2 | import { signalExitCode, type TerminationSignal } from 'src/services/shutdown-signal'; |
| 3 | |
| 4 | /** |
| 5 | * A child process the command proxies (`composio run`) exited with a non-zero `code`. The child |
| 6 | * already wrote its own output, so the runner logs nothing (`[Runtime.errorReported]` is false) |
| 7 | * and `Runtime.defaultTeardown` exits with the child's code. |
| 8 | */ |
| 9 | export class ChildProcessExited extends Data.TaggedError('effects/ChildProcessExited')<{ |
| 10 | readonly code: number; |
| 11 | }> { |
| 12 | get [Runtime.errorReported]() { |
| 13 | return false; |
| 14 | } |
| 15 | |
| 16 | get [Runtime.errorExitCode]() { |
| 17 | return this.code; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * A child process the command proxies (`composio run`) was ended by `signal`. The runner |
| 23 | * (`src/run-main.ts`) re-raises the signal so the CLI ends the same way; the exit code, 128 + n, |
| 24 | * is what a caller sees if the re-raise cannot end the process. |
| 25 | */ |
| 26 | export class ChildProcessSignaled extends Data.TaggedError('effects/ChildProcessSignaled')<{ |
| 27 | readonly signal: TerminationSignal; |
| 28 | }> { |
| 29 | get [Runtime.errorReported]() { |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | get [Runtime.errorExitCode]() { |
| 34 | return signalExitCode(this.signal); |
| 35 | } |
| 36 | } |