| 1 | import { WS_METHODS } from "@t3tools/contracts"; |
| 2 | import { |
| 3 | createEnvironmentRpcCommand, |
| 4 | createEnvironmentRpcQueryAtomFamily, |
| 5 | } from "@t3tools/client-runtime/state/runtime"; |
| 6 | |
| 7 | import { connectionAtomRuntime } from "../connection/runtime"; |
| 8 | |
| 9 | /** |
| 10 | * Scan of Claude Code / Codex home directories on an environment, surfacing |
| 11 | * project candidates for the welcome wizard's import step. The scan walks the |
| 12 | * filesystem server-side, so results are cached briefly and refreshed when the |
| 13 | * import step remounts. |
| 14 | */ |
| 15 | export const agentSessionScan = createEnvironmentRpcQueryAtomFamily(connectionAtomRuntime, { |
| 16 | label: "environment-data:agent-sessions:scan", |
| 17 | tag: WS_METHODS.agentSessionsScan, |
| 18 | staleTimeMs: 30_000, |
| 19 | idleTtlMs: 5 * 60_000, |
| 20 | }); |
| 21 | |
| 22 | export const agentSessionImport = createEnvironmentRpcCommand(connectionAtomRuntime, { |
| 23 | label: "environment-data:agent-sessions:import", |
| 24 | tag: WS_METHODS.agentSessionsImport, |
| 25 | }); |