ResolveWorkspaceHome returns the workspace user's home directory.
( ctx context.Context, conn workspacesdk.AgentConn, )
| 19 | |
| 20 | // ResolveWorkspaceHome returns the workspace user's home directory. |
| 21 | func ResolveWorkspaceHome( |
| 22 | ctx context.Context, |
| 23 | conn workspacesdk.AgentConn, |
| 24 | ) (string, error) { |
| 25 | if conn == nil { |
| 26 | return "", xerrors.New("workspace connection is required") |
| 27 | } |
| 28 | |
| 29 | resp, err := conn.LS(ctx, "", workspacesdk.LSRequest{ |
| 30 | Path: []string{}, |
| 31 | Relativity: workspacesdk.LSRelativityHome, |
| 32 | }) |
| 33 | if err != nil { |
| 34 | return "", xerrors.Errorf("resolve workspace home: %w", err) |
| 35 | } |
| 36 | |
| 37 | home := strings.TrimSpace(resp.AbsolutePathString) |
| 38 | if home == "" { |
| 39 | return "", xerrors.New("workspace home path is empty") |
| 40 | } |
| 41 | |
| 42 | return home, nil |
| 43 | } |
| 44 | |
| 45 | // PlanPathForChat returns the per-chat plan file path rooted in the |
| 46 | // workspace home directory. |