| ... | ... | @@ -4,9 +4,9 @@ import { |
| 4 | 4 | scopeThreadRef, |
| 5 | 5 | } from "@t3tools/client-runtime/environment"; |
| 6 | 6 | import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"; |
| 7 | | import { type ScopedThreadRef, ThreadId } from "@t3tools/contracts"; |
| 7 | import { EnvironmentId, type ScopedThreadRef, ThreadId } from "@t3tools/contracts"; |
| 8 | 8 | import * as Cause from "effect/Cause"; |
| 9 | | import * as Data from "effect/Data"; |
| 9 | import * as Schema from "effect/Schema"; |
| 10 | 10 | import { AsyncResult } from "effect/unstable/reactivity"; |
| 11 | 11 | import { useRouter } from "@tanstack/react-router"; |
| 12 | 12 | import { useCallback, useMemo, useRef } from "react"; |
| ... | ... | @@ -27,9 +27,17 @@ import { stackedThreadToast, toastManager } from "../components/ui/toast"; |
| 27 | 27 | import { useClientSettings } from "./useSettings"; |
| 28 | 28 | import { useAtomCommand } from "../state/use-atom-command"; |
| 29 | 29 | |
| 30 | | export class ThreadArchiveBlockedError extends Data.TaggedError("ThreadArchiveBlockedError")<{ |
| 31 | | readonly message: string; |
| 32 | | }> {} |
| 30 | export class ThreadArchiveBlockedError extends Schema.TaggedErrorClass<ThreadArchiveBlockedError>()( |
| 31 | "ThreadArchiveBlockedError", |
| 32 | { |
| 33 | environmentId: EnvironmentId, |
| 34 | threadId: ThreadId, |
| 35 | }, |
| 36 | ) { |
| 37 | override get message(): string { |
| 38 | return "Cannot archive a running thread."; |
| 39 | } |
| 40 | } |
| 33 | 41 | |
| 34 | 42 | export function useThreadActions() { |
| 35 | 43 | const closeTerminal = useAtomCommand(terminalEnvironment.close); |
| ... | ... | @@ -89,7 +97,8 @@ export function useThreadActions() { |
| 89 | 97 | return AsyncResult.failure( |
| 90 | 98 | Cause.fail( |
| 91 | 99 | new ThreadArchiveBlockedError({ |
| 92 | | message: "Cannot archive a running thread.", |
| 100 | environmentId: threadRef.environmentId, |
| 101 | threadId: threadRef.threadId, |
| 93 | 102 | }), |
| 94 | 103 | ), |
| 95 | 104 | ); |